1/**************************************************************************** 2** libebml : parse EBML files, see http://embl.sourceforge.net/ 3** 4** <file/class description> 5** 6** Copyright (C) 2002-2005 Steve Lhomme. All rights reserved. 7** 8** This file is part of libebml. 9** 10** This library is free software; you can redistribute it and/or 11** modify it under the terms of the GNU Lesser General Public 12** License as published by the Free Software Foundation; either 13** version 2.1 of the License, or (at your option) any later version. 14** 15** This library is distributed in the hope that it will be useful, 16** but WITHOUT ANY WARRANTY; without even the implied warranty of 17** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18** Lesser General Public License for more details. 19** 20** You should have received a copy of the GNU Lesser General Public 21** License along with this library; if not, write to the Free Software 22** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23** 24** See http://www.matroska.org/license/lgpl/ for LGPL licensing information. 25** 26** Contact license@matroska.org if any conditions of this licensing are 27** not clear to you. 28** 29**********************************************************************/ 30 31/*! 32 \file 33 \version \$Id: EbmlString.h 1079 2005-03-03 13:18:14Z robux4 $ 34 \author Steve Lhomme <robux4 @ users.sf.net> 35*/ 36#ifndef LIBEBML_STRING_H 37#define LIBEBML_STRING_H 38 39#include <string> 40 41#include "EbmlTypes.h" 42#include "EbmlElement.h" 43 44START_LIBEBML_NAMESPACE 45 46/*! 47 \class EbmlString 48 \brief Handle all operations on a printable string EBML element 49*/ 50class EBML_DLL_API EbmlString : public EbmlElement { 51 public: 52 EbmlString(); 53 EbmlString(const std::string & aDefaultValue); 54 EbmlString(const EbmlString & ElementToClone); 55 56 virtual ~EbmlString() {} 57 58 bool ValidateSize() const {return true;} // any size is possible 59 uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false); 60 uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA); 61 uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false); 62 63 EbmlString & operator=(const std::string); 64 operator const std::string &() const {return Value;} 65 66 void SetDefaultValue(std::string & aValue) {assert(!DefaultIsSet); DefaultValue = aValue; DefaultIsSet = true;} 67 68 const std::string DefaultVal() const {assert(DefaultIsSet); return DefaultValue;} 69 70 bool IsDefaultValue() const { 71 return (DefaultISset() && Value == DefaultValue); 72 } 73 74 protected: 75 std::string Value; /// The actual value of the element 76 std::string DefaultValue; 77}; 78 79END_LIBEBML_NAMESPACE 80 81#endif // LIBEBML_STRING_H 82