HoverRace  2.0
TrackSpecParser.h
Go to the documentation of this file.
1 // TrackSpecParser.h
2 // Text file parser helper
3 //
4 // Copyright (c) 1995-1998 - Richard Langlois and Grokksoft Inc.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 //
22 
23 #pragma once
24 
25 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
26 # ifdef MR_ENGINE
27 # define MR_DllDeclare __declspec( dllexport )
28 # else
29 # define MR_DllDeclare __declspec( dllimport )
30 # endif
31 #else
32 # define MR_DllDeclare
33 #endif
34 
35 namespace HoverRace {
36 namespace MazeCompiler {
37 
38 class MR_DllDeclare TrackSpecParser : boost::noncopyable
39 {
40  protected:
41  std::istream ∈
42 
43  char mLineBuffer[150];
44  char mReturnBuffer[30];
45  char *mParsePtr;
47 
48  bool ReadNewLine();
49  const char *InternalGetNextClass();
50 
51  public:
52  TrackSpecParser(std::istream &in);
53  ~TrackSpecParser();
54 
55  void Reset();
56 
57  const char *GetNextClass(const char *pClassType = NULL);
58  // If the line doesn't begin by an attrib, you should use GetNextLine
59  const char *GetNextAttrib(const char *pAttrib = NULL);
60  bool GetNextLine();
61  const char *GetNextStrParam(const char *pDefaultValue = NULL);
62  double GetNextNumParam(double DefaultValue = 0.0);
63  const char *GetParams();
64 
65  int GetErrorLine() const;
66 
67 };
68 
69 } // namespace MazeCompiler
70 } // namespace HoverRace
71 
72 #undef MR_DllDeclare
Definition: TrackSpecParser.h:38
int mLineNumber
Definition: TrackSpecParser.h:46
char * mParsePtr
Definition: TrackSpecParser.h:45
std::istream & in
Definition: TrackSpecParser.h:41
#define MR_DllDeclare
Definition: TrackSpecParser.h:32
Definition: Announcement.h:24