VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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)
149 
150 #endif
TX_CPPDECL bool trpgPrintArchive(char *filename, trpgPrintBuffer &pBuf, int flags=TRPGPRN_ALL)
virtual bool isValid(void)
Check if print buffer is valid.
Definition: trpage_print.h:35
int curIndent
Definition: trpage_print.h:46
Definition: trpage_read.h:256
bool valid
Definition: trpage_print.h:66
#define TRPGPRN_ALL
Print utitility for while archive.
Definition: trpage_print.h:144
ReadHelper(trpgPrintGraphParser *inPG, trpgPrintBuffer *inBuf)
Definition: trpage_print.h:107
virtual ~trpgPrintGraphParser(void)
Definition: trpage_print.h:80
#define DT_DLL_osgdb_vrftxp
Contains DLL export macros.
Definition: osgdb_vrftxpDefines.h:25
trpgPrintGraphParser * parse
Definition: trpage_print.h:119
Definition: trpage_print.h:53
trpgrImageHelper * imageHelp
Definition: trpage_print.h:136
bool isValid(void)
Check if file print buffer is valid (i.e. if file was opened)
Definition: trpage_print.h:61
std::vector< trpgChildRef > ChildRefList
typedef std::vector&lt;const trpgChildRef&gt; ChildRefList; The const in the template parameter was removed b...
Definition: trpage_print.h:105
virtual ~trpgPrintBuffer(void)
Definition: trpage_print.h:32
trpgr_Archive * archive
Definition: trpage_print.h:135
trpgrImageHelper * GetImageHelp()
Definition: trpage_print.h:128
~ReadHelper()
Definition: trpage_print.h:108
voidpf void * buf
Definition: ioapi.h:39
Definition: trpage_print.h:96
virtual bool prnLine(const char *str=NULL)=0
The main print function. Subclasses must fill this in.
Definition: trpage_geom.h:2476
bool isMine
Definition: trpage_print.h:67
Definition: trpage_print.h:76
trpgPrintBuffer * pBuf
Definition: trpage_print.h:118
#define TX_CPPDECL
Exports a C++ function properly in a windows DLL.
Definition: trdll.h:71
ChildRefList childRefList
Definition: trpage_print.h:123
Definition: trpage_read.h:185
{secret}
Definition: trpage_read.h:32
ReadHelper * childRefCB
Definition: trpage_print.h:138
Definition: trpage_print.h:28
FILE * fp
Definition: trpage_print.h:68
trpgr_Archive * GetArchive()
Fetch the archive associated with this print.
Definition: trpage_print.h:127
virtual bool EndChildren(void *)
Definition: trpage_read.h:267
Definition: trpage_read.h:99
#define TX_EXDECL
Goes before &quot;class&quot; to handle DLL export in windows.
Definition: trdll.h:69
Definition: trpage_io.h:452
virtual bool StartChildren(void *)
Start defining children for the given object.
Definition: trpage_read.h:266
trpgPrintBuffer * printBuf
Definition: trpage_print.h:134
short trpgToken
16 bit token definition value. These are values such as TRPGTEXTABLE or TRPG_ATTACH, etc...
Definition: trpage_io.h:61

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)