VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
trpage_print.h
Go to the documentation of this file.
1 /* ************************
2  Copyright Terrain Experts Inc.
3  Terrain Experts Inc (TERREX) reserves all rights to this source code
4  unless otherwise specified in writing by the President of TERREX.
5  This copyright may be updated in the future, in which case that version
6  supercedes this one.
7  -------------------
8  Terrex Experts Inc.
9  4400 East Broadway #314
10  Tucson, AZ 85711
11  info@terrex.com
12  Tel: (520) 323-7990
13  ************************
14  */
15 
16 #ifndef trpage_print_h_
17 #define trpage_print_h_
18 
21 #include <stack>
22 
23 /* Print Buffer for TerraPage. Subclasses of this object
24  are used to print out to stdout or disk (or whatever).
25  You won't create one of these directly, instead you'll create
26  something which inherits from it.
27  */
29 {
30 public:
31  trpgPrintBuffer(void);
32  virtual ~trpgPrintBuffer(void) { };
33 
35  virtual bool isValid(void) { return true; }
36 
38  virtual bool prnLine(const char *str=NULL)=0;
39 
41  virtual void IncreaseIndent(int amount=1);
43  virtual void DecreaseIndent(int amount=1);
44 protected:
45  void updateIndent(void);
46  int curIndent;
47  char indentStr[200];
48 };
49 
50 /* File print buffer for TerraPage. The file print buffer writes
51  debugging output to a file.
52 */
54 public:
56  trpgFilePrintBuffer(FILE *);
57  trpgFilePrintBuffer(char *);
58  ~trpgFilePrintBuffer(void);
59 
61  bool isValid(void) { return valid; };
62 
64  bool prnLine(const char *str = NULL);
65 protected:
66  bool valid;
67  bool isMine;
68  FILE *fp;
69 };
70 
71 /* The Print Graph Parser is a scene graph parser that
72  prints out the scene graph as it goes. It's simpler
73  than the scene example in trpage_scene.cpp since it
74  isn't trying to build up a working scene graph.
75 */
77 {
78 public:
80  virtual ~trpgPrintGraphParser(void) { };
81 
83  void Reset();
84 
86  unsigned int GetNbChildrenRef() const;
89  const trpgChildRef* GetChildRef(unsigned int idx) const;
90 
91  /* The read helper class is the callback for all the various
92  token (node) types. Normally we would use a number of
93  these, probably one per token. However, since we're just
94  printing we can use a switch statement instead.
95  */
96  class ReadHelper : public trpgr_Callback
97  {
98  public:
105  typedef std::vector<trpgChildRef> ChildRefList;
106 
107  ReadHelper(trpgPrintGraphParser *inPG,trpgPrintBuffer *inBuf): pBuf(inBuf), parse(inPG) {}
108  ~ReadHelper() { Reset();}
109 
110  void *Parse(trpgToken,trpgReadBuffer &buf);
111  void Reset();
113  unsigned int GetNbChildrenRef() const;
116  const trpgChildRef* GetChildRef(unsigned int idx) const;
117  protected:
120 
121  private:
122 
124  };
125 
127  trpgr_Archive *GetArchive() {return archive; };
128  trpgrImageHelper *GetImageHelp() {return imageHelp; };
129 
130 protected:
131  bool StartChildren(void *);
132  bool EndChildren(void *);
133 
137 
139 
140 };
141 
143 
144 #define TRPGPRN_ALL -1
145 #define TRPGPRN_HEADER (1<<0)
146 #define TRPGPRN_BODY (1<<1)
147 TX_CPPDECL bool trpgPrintArchive(char *filename,trpgPrintBuffer &pBuf,int flags=TRPGPRN_ALL);
149 
150 #endif

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)