source: GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParserXerces.h @ 2176

Revision 2176, 4.7 KB checked in by mattausch, 17 years ago (diff)

removed using namespace std from .h

RevLine 
[2115]1#ifndef _OBJECTS_PARSER_XERCES__H
2#define _OBJECTS_PARSER_XERCES__H
[2113]3
4// ---------------------------------------------------------------------------
5//  Includes
6// ---------------------------------------------------------------------------
7#include <xercesc/sax/HandlerBase.hpp>
8#include "Mesh.h"
9#include "BoundingBoxConverter.h"
10
11
12namespace GtpVisibilityPreprocessor {
13
14XERCES_CPP_NAMESPACE_USE
15XERCES_CPP_NAMESPACE_BEGIN
16class AttributeList;
17XERCES_CPP_NAMESPACE_END
18
[2115]19
[2113]20class BvhNode;
21class BvHierarchy;
22
23
[2114]24class ObjectsParseHandlers: public HandlerBase
[2113]25{
26public:
27
[2119]28        friend class BvHierarchy;
29
[2115]30        // -----------------------------------------------------------------------
31        //  Constructors and Destructor
32        // -----------------------------------------------------------------------
[2113]33
[2115]34        ObjectsParseHandlers(ObjectContainer &pvsObjects,
35                                                 const ObjectContainer &preprocessorObjects);
[2113]36
[2115]37        ~ObjectsParseHandlers();
[2113]38
39
[2115]40        // -----------------------------------------------------------------------
41        //  Getter methods
42        // -----------------------------------------------------------------------
[2113]43
[2115]44        unsigned int GetElementCount()
45        {
46                return mElementCount;
47        }
[2113]48
[2115]49        unsigned int GetAttrCount()
50        {
51                return mAttrCount;
52        }
[2113]53
[2115]54        unsigned int GetCharacterCount()
55        {
56                return mCharacterCount;
57        }
[2113]58
[2115]59        unsigned int GetSpaceCount()
60        {
61                return mSpaceCount;
62        }
[2113]63
64
[2115]65        // -----------------------------------------------------------------------
66        //  Handlers for the SAX DocumentHandler interface
67        // -----------------------------------------------------------------------
[2113]68
[2115]69        void endElement(const XMLCh* const name);
70        void startElement(const XMLCh* const name, AttributeList& attributes);
71        void characters(const XMLCh* const chars, const unsigned int length);
72        void ignorableWhitespace(const XMLCh* const chars, const unsigned int length);
73        void resetDocument();
[2113]74
[2115]75        void StartObjectSpaceHierarchyElement(const std::string &element,
76                                                                                  AttributeList& attributes);
[2113]77
[2115]78        /////////////////////////
[2113]79
[2115]80        int mUniqueObjectId;
[2113]81
[2115]82        vector<BvhLeaf *> mBvhLeaves;
83
84        const ObjectContainer &mPreprocessorObjects;
85        ObjectContainer &mPvsObjects;
86
87        /// current state of the parser
88        bool mIsObjectSpaceHierarchy;
89
90        enum {BVH};
91
92        ////////////
93        //-- Handlers for X3D
94
95        void StartBvhLeaf(AttributeList& attributes);
[2176]96        void StartBvhElement(std::string element, AttributeList& attributes);
[2115]97
98        void EndObjectSpaceHierarchy();
99
100        void StartBvhLeafObjects(ObjectContainer &objects, const char *ptr);
101
102        // -----------------------------------------------------------------------
103        //  Handlers for the SAX ErrorHandler interface
104        // -----------------------------------------------------------------------
105
106        void warning(const SAXParseException& exc);
107        void error(const SAXParseException& exc);
108        void fatalError(const SAXParseException& exc);
109
110
[2113]111private:
[2115]112        // -----------------------------------------------------------------------
113        //  Private data members
114        //
115        //  fAttrCount
116        //  fCharacterCount
117        //  fElementCount
118        //  fSpaceCount
119        //      These are just counters that are run upwards based on the input
120        //      from the document handlers.
121        // -----------------------------------------------------------------------
122        unsigned int    mAttrCount;
123        unsigned int    mCharacterCount;
124        unsigned int    mElementCount;
125        unsigned int    mSpaceCount;
[2113]126};
127
128// ---------------------------------------------------------------------------
129//  This is a simple class that lets us do easy (though not terribly efficient)
130//  trancoding of XMLCh data to local code page for display.
131// ---------------------------------------------------------------------------
132class StrX
133{
134public :
[2115]135        // -----------------------------------------------------------------------
136        //  Constructors and Destructor
137        // -----------------------------------------------------------------------
138        StrX(const XMLCh* const toTranscode)
139        {
140                // Call the private transcoding method
141                mLocalForm = XMLString::transcode(toTranscode);
142        }
143
144        ~StrX()
145        {
146                XMLString::release(&mLocalForm);
147        }
148
149        // -----------------------------------------------------------------------
150        //  Getter methods
151        // -----------------------------------------------------------------------
152        const char* LocalForm() const
153        {
154                return mLocalForm;
155        }
156
[2113]157private :
[2115]158        // -----------------------------------------------------------------------
159        //  Private data members
160        //
161        //  fLocalForm
162        //      This is the local code page form of the string.
163        // -----------------------------------------------------------------------
164        char*   mLocalForm;
[2113]165};
166
167inline XERCES_STD_QUALIFIER ostream&
168operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
169{
[2115]170        target << toDump.LocalForm();
171        return target;
[2113]172}
173}
174
175#endif
Note: See TracBrowser for help on using the repository browser.