source: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h @ 651

Revision 651, 5.0 KB checked in by mattausch, 19 years ago (diff)

exporting / loading full merge hierarchy

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