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