File indexing completed on 2025-01-18 10:04:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef LDOMBasicString_HeaderFile
0017 #define LDOMBasicString_HeaderFile
0018
0019 #include <Standard_Macro.hxx>
0020 #include <TCollection_AsciiString.hxx>
0021 #include <TCollection_ExtendedString.hxx>
0022
0023 class LDOM_MemManager;
0024 class LDOM_NullPtr;
0025 class TCollection_AsciiString;
0026 class TCollection_ExtendedString;
0027
0028
0029
0030
0031 class LDOMBasicString
0032 {
0033 friend class LDOM_MemManager;
0034 friend class LDOM_Node;
0035 public:
0036 enum StringType {
0037 LDOM_NULL = 0,
0038 LDOM_Integer,
0039
0040 LDOM_AsciiFree,
0041 LDOM_AsciiDoc,
0042 LDOM_AsciiDocClear,
0043 LDOM_AsciiHashed
0044 };
0045
0046 Standard_EXPORT ~LDOMBasicString ();
0047
0048 StringType Type () const { return myType; }
0049
0050 Standard_EXPORT Standard_Boolean
0051 GetInteger (Standard_Integer& aResult) const;
0052
0053
0054 const char *
0055 GetString () const { return myType == LDOM_Integer ||
0056 myType == LDOM_NULL ?
0057 "" : (const char *) myVal.ptr; }
0058
0059
0060 Standard_EXPORT Standard_Boolean
0061 equals (const LDOMBasicString& anOther) const;
0062
0063
0064 Standard_EXPORT LDOMBasicString&
0065 operator = (const LDOM_NullPtr *);
0066
0067 Standard_EXPORT LDOMBasicString&
0068 operator = (const LDOMBasicString& anOther);
0069
0070 Standard_Boolean
0071 operator == (const LDOM_NullPtr *) const
0072 { return myType==LDOM_NULL; }
0073 Standard_Boolean
0074 operator != (const LDOM_NullPtr *) const
0075 { return myType!=LDOM_NULL; }
0076
0077 Standard_Boolean
0078 operator == (const LDOMBasicString& anOther) const
0079 {
0080 return myType==anOther.myType && myVal.i==anOther.myVal.i;
0081 }
0082
0083 Standard_Boolean
0084 operator != (const LDOMBasicString& anOther) const
0085 {
0086 return myType!=anOther.myType || myVal.i!=anOther.myVal.i;
0087 }
0088
0089
0090 Standard_EXPORT operator TCollection_AsciiString () const;
0091
0092 Standard_EXPORT operator TCollection_ExtendedString () const;
0093
0094 LDOMBasicString ()
0095 : myType (LDOM_NULL) { myVal.ptr = NULL; }
0096
0097
0098 Standard_EXPORT LDOMBasicString (const LDOMBasicString& anOther);
0099
0100
0101 LDOMBasicString (const Standard_Integer aValue)
0102 : myType (LDOM_Integer) { myVal.i = aValue; }
0103
0104 Standard_EXPORT LDOMBasicString (const char * aValue);
0105
0106
0107 Standard_EXPORT LDOMBasicString (const char * aValue,
0108 const Handle(LDOM_MemManager)& aDoc);
0109
0110
0111 Standard_EXPORT LDOMBasicString (const char * aValue,
0112 const Standard_Integer aLen,
0113 const Handle(LDOM_MemManager)& aDoc);
0114
0115
0116 protected:
0117
0118 void SetDirect (const StringType aType, const char * aValue)
0119 { myType = aType; myVal.ptr = (void *) aValue; }
0120
0121
0122 protected:
0123
0124
0125 StringType myType;
0126 union {
0127 int i;
0128 void * ptr;
0129 } myVal;
0130 friend char * db_pretty_print (const LDOMBasicString *, int, char *);
0131 };
0132
0133 #endif