00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00038 #ifndef LIBEBML_UINTEGER_H
00039 #define LIBEBML_UINTEGER_H
00040 
00041 #include "EbmlTypes.h"
00042 #include "EbmlElement.h"
00043 
00044 START_LIBEBML_NAMESPACE
00045 
00046 const int DEFAULT_UINT_SIZE = 0; 
00047 
00052 class EBML_DLL_API EbmlUInteger : public EbmlElement {
00053         public:
00054                 EbmlUInteger();
00055                 EbmlUInteger(uint64 DefaultValue);
00056                 EbmlUInteger(const EbmlUInteger & ElementToClone);
00057         
00058                 EbmlUInteger & operator=(uint64 NewValue) {Value = NewValue; SetValueIsSet(); return *this;}
00059 
00063                 virtual void SetDefaultSize(uint64 nDefaultSize = DEFAULT_UINT_SIZE) {EbmlElement::SetDefaultSize(nDefaultSize); SetSize_(nDefaultSize);}
00064 
00065                 virtual bool ValidateSize() const {return IsFiniteSize() && (GetSize() <= 8);}
00066                 filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
00067                 filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
00068                 filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
00069                 
00070                 virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
00071                 
00072                 operator uint8()  const {return uint8(Value); }
00073                 operator uint16() const {return uint16(Value);}
00074                 operator uint32() const {return uint32(Value);}
00075                 operator uint64() const {return Value;}
00076 
00077                 void SetDefaultValue(uint64);
00078     
00079                 uint64 DefaultVal() const;
00080 
00081                 bool IsDefaultValue() const {
00082                         return (DefaultISset() && Value == DefaultValue);
00083                 }
00084 
00085 #if defined(EBML_STRICT_API)
00086     private:
00087 #else
00088     protected:
00089 #endif
00090                 uint64 Value; 
00091                 uint64 DefaultValue;
00092 };
00093 
00094 END_LIBEBML_NAMESPACE
00095 
00096 #endif // LIBEBML_UINTEGER_H