fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / WRL / OSGVRMLPrototypeHandler.h
blobe8e35d1a900bb94f7cbeaca13ad501c6ead3b12c
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGVRMLPROTOTYPEHANDLER_H_
40 #define _OSGVRMLPROTOTYPEHANDLER_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGBaseTypes.h"
46 #include "OSGBaseFunctions.h"
48 #include <stack>
50 #include "OSGVRMLNodeHelper.h"
52 #include <string>
54 #include "OSGDeprecatedCPP.h"
57 OSG_BEGIN_NAMESPACE
59 /*! \brief VRML97 Loader prototype handler
60 \ingroup GrpFileIOWRLObj
61 \ingroup GrpLibOSGFileIO
64 template <class BaseT>
65 class VRMLNodePrototypeHandler : public BaseT
67 /*========================== PRIVATE ================================*/
68 private:
71 typedef VRMLNodePrototypeHandler<BaseT> Self;
73 /*========================== PUBLIC =================================*/
74 public :
76 /*---------------------------------------------------------------------*/
77 /*! \name Constructors */
78 /*! \{ */
80 VRMLNodePrototypeHandler(void);
82 /*! \} */
83 /*---------------------------------------------------------------------*/
84 /*! \name Destructor */
85 /*! \{ */
87 virtual ~VRMLNodePrototypeHandler(void);
89 /*! \} */
90 /*---------------------------------------------------------------------*/
91 /*! \name Skel replacements */
92 /*! \{ */
94 virtual void beginProto (const Char8 *szProtoname);
95 virtual void endProtoInterface ( void);
96 virtual void endProto ( void);
98 virtual void beginEventInDecl (const Char8 *szEventType,
99 const UInt32 uiFieldTypeId,
100 const Char8 *szEventName);
102 virtual void beginEventOutDecl (const Char8 *szEventType,
103 const UInt32 uiFieldTypeId,
104 const Char8 *szEventName);
106 virtual void beginFieldDecl (const Char8 *szFieldType,
107 const UInt32 uiFieldTypeId,
108 const Char8 *szFieldName);
110 virtual void endFieldDecl ( void);
112 virtual void beginExposedFieldDecl (const Char8 *szFieldType,
113 const UInt32 uiFieldTypeId,
114 const Char8 *szFieldName);
116 virtual void endExposedFieldDecl ( void);
118 /*! \} */
119 /*---------------------------------------------------------------------*/
120 /*! \name Dump */
121 /*! \{ */
123 /*! \} */
124 /*========================= PROTECTED ===============================*/
126 protected:
128 typedef BaseT Inherited;
130 #if defined(_LIBCPP_VERSION)
131 typedef
132 OSG_STDEXTENSION_NAMESPACE::hash_map<
133 std::string,
134 VRMLNodeHelper *> NameHelperMap;
136 #else
137 # if !defined(WIN32)
138 /*! \nohierarchy
140 struct string_hash
142 size_t operator()(const std::string &s) const
144 return OSG_STDEXTENSION_NAMESPACE::__stl_hash_string(s.c_str());
147 # endif
149 # ifdef OSG_STL_HAS_HASH_MAP
150 # ifdef OSG_USE_HASH_COMPARE
151 typedef
152 OSG_STDEXTENSION_NAMESPACE::hash_map<
153 const Char8 *,
154 VRMLNodeHelper *,
155 HashCmpString > NameHelperMap;
156 # else
157 typedef
158 OSG_STDEXTENSION_NAMESPACE::hash_map<
159 const std::string,
160 VRMLNodeHelper *,
161 string_hash > NameHelperMap;
162 # endif
163 # else
164 typedef
165 std::map<const std::string,
166 VRMLNodeHelper * > NameHelperMap;
167 # endif
168 #endif
170 /*---------------------------------------------------------------------*/
171 /*! \name Member */
172 /*! \{ */
174 /** The current helper that we are actively adding fields too and
175 building up. */
177 VRMLNodeHelper *_pCurrentHelper;
179 /** Map from proto name to the helper to handle that proto type. */
180 NameHelperMap _mNodeHelperHash;
183 VRMLNodeHelper *findNodeHelper (const Char8 *szNodeTypename);
185 virtual void preStandardProtos ( void);
186 virtual void postStandardProtos( void);
188 /*! \} */
189 /*========================== PRIVATE ================================*/
190 private:
192 /*!\brief prohibit default function (move to 'public' if needed) */
193 VRMLNodePrototypeHandler(const VRMLNodePrototypeHandler &source);
194 /*!\brief prohibit default function (move to 'public' if needed) */
195 void operator =(const VRMLNodePrototypeHandler &source);
198 OSG_END_NAMESPACE
200 #include "OSGVRMLPrototypeHandler.inl"
202 #endif /* _OSGVRMLPROTOTYPEHANDLER_H_ */