File indexing completed on 2025-01-18 10:05:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef VrmlData_Node_HeaderFile
0017 #define VrmlData_Node_HeaderFile
0018
0019 #include <NCollection_List.hxx>
0020 #include <Standard_Type.hxx>
0021 #include <Standard_TypeDef.hxx>
0022 #include <TCollection_AsciiString.hxx>
0023 #include <Standard_CStringHasher.hxx>
0024 #include <VrmlData_ErrorStatus.hxx>
0025
0026 #define VRMLDATA_LCOMPARE(aa, bb) \
0027 ((strncmp (aa, bb, sizeof(bb)-1)) ? 0L : (aa += sizeof(bb)-1))
0028
0029 struct VrmlData_InBuffer;
0030 class VrmlData_Scene;
0031 class TCollection_AsciiString;
0032
0033
0034
0035
0036 class VrmlData_Node : public Standard_Transient
0037 {
0038 public:
0039
0040
0041
0042
0043
0044 Standard_EXPORT VrmlData_Node ();
0045
0046
0047
0048
0049 virtual ~VrmlData_Node () {}
0050
0051
0052
0053
0054 inline const VrmlData_Scene& Scene () const
0055 { return * myScene; }
0056
0057
0058
0059
0060 inline const char * Name () const { return myName; }
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 Standard_EXPORT VrmlData_ErrorStatus
0074 ReadNode (VrmlData_InBuffer& theBuffer,
0075 Handle(VrmlData_Node)&theNode,
0076 const Handle(Standard_Type)& Type
0077 = NULL);
0078
0079
0080
0081
0082 Standard_EXPORT virtual VrmlData_ErrorStatus
0083 Read (VrmlData_InBuffer& theBuffer) = 0;
0084
0085
0086
0087
0088 Standard_EXPORT virtual VrmlData_ErrorStatus
0089 Write (const char * thePrefix) const;
0090
0091
0092
0093
0094 Standard_EXPORT virtual Standard_Boolean
0095 IsDefault () const;
0096
0097
0098
0099
0100 Standard_EXPORT VrmlData_ErrorStatus
0101 WriteClosing () const;
0102
0103
0104
0105
0106
0107
0108
0109
0110 Standard_EXPORT virtual Handle(VrmlData_Node)
0111 Clone (const Handle(VrmlData_Node)&)const;
0112
0113
0114
0115
0116 Standard_EXPORT static VrmlData_ErrorStatus
0117 ReadBoolean (VrmlData_InBuffer& theBuffer,
0118 Standard_Boolean& theResult);
0119
0120
0121
0122
0123 Standard_EXPORT static VrmlData_ErrorStatus
0124 ReadString (VrmlData_InBuffer& theBuffer,
0125 TCollection_AsciiString& theRes);
0126
0127
0128
0129
0130 Standard_EXPORT static VrmlData_ErrorStatus
0131 ReadMultiString
0132 (VrmlData_InBuffer& theBuffer,
0133 NCollection_List<TCollection_AsciiString>& theRes);
0134
0135
0136
0137
0138 Standard_EXPORT static VrmlData_ErrorStatus
0139 ReadInteger (VrmlData_InBuffer& theBuffer,
0140 long& theResult);
0141
0142 static inline Standard_Boolean OK (const VrmlData_ErrorStatus theStat)
0143 { return theStat == VrmlData_StatusOK; }
0144
0145 static inline Standard_Boolean OK (VrmlData_ErrorStatus& outStat,
0146 const VrmlData_ErrorStatus theStat)
0147 { return (outStat = theStat) == VrmlData_StatusOK; }
0148
0149
0150
0151
0152 static inline Standard_Integer GlobalIndent ()
0153 { return 2; }
0154
0155 protected:
0156
0157
0158
0159
0160
0161 Standard_EXPORT VrmlData_Node (const VrmlData_Scene& theScene,
0162 const char * theName);
0163
0164
0165
0166
0167
0168
0169 Standard_EXPORT static VrmlData_ErrorStatus
0170 readBrace (VrmlData_InBuffer& theBuffer);
0171
0172 private:
0173
0174
0175
0176
0177
0178
0179 Standard_EXPORT void setName (const char * theName,
0180 const char * theSuffix = 0L);
0181
0182 private:
0183
0184
0185 const VrmlData_Scene * myScene;
0186 const char * myName;
0187 #ifdef OCCT_DEBUG
0188 Standard_Integer myLineCount;
0189 #endif
0190
0191 friend class VrmlData_Group;
0192 friend class VrmlData_Scene;
0193
0194 public:
0195
0196 DEFINE_STANDARD_RTTIEXT(VrmlData_Node,Standard_Transient)
0197 };
0198
0199
0200 DEFINE_STANDARD_HANDLE (VrmlData_Node, Standard_Transient)
0201
0202
0203 Standard_EXPORT Standard_Boolean IsEqual(const Handle(VrmlData_Node)& theOne,
0204 const Handle(VrmlData_Node)& theTwo);
0205
0206 namespace std
0207 {
0208 template <>
0209 struct hash<Handle(VrmlData_Node)>
0210 {
0211 size_t operator()(const Handle(VrmlData_Node)& theNode) const
0212 {
0213 if (!theNode->Name())
0214 {
0215 return 1;
0216 }
0217 return Standard_CStringHasher{}(theNode->Name());
0218 }
0219 };
0220
0221 template<>
0222 struct equal_to<Handle(VrmlData_Node)>
0223 {
0224 bool operator()(const Handle(VrmlData_Node)& theNode1,
0225 const Handle(VrmlData_Node)& theNode2) const noexcept
0226 {
0227 return IsEqual(theNode1, theNode2);
0228 }
0229 };
0230 }
0231
0232 #endif