OSrLReader.cpp
Go to the documentation of this file.
1 /* $Id: OSrLReader.cpp 5286 2017-12-08 13:58:31Z stefan $ */
17 #include "OSrLReader.h"
18 #include "OSOutput.h"
19 
20 
21 
22 
23 void yygetOSResult( const char *ch, OSResult* m_osresult, OSrLParserData *m_parserData, OSgLParserData *osglData, OSnLParserData *osnlData) throw(ErrorClass);
24 int osrllex_init(void** ptr_yy_globals);
25 int osrllex_destroy (void* scanner );
26 void osrlset_extra (OSrLParserData* parserData , void* yyscanner );
27 
28 
30 {
31 #ifndef NDEBUG
32  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrL_parser, ENUM_OUTPUT_LEVEL_trace, "new OSrLParserData()");
33 #endif
35 #ifndef NDEBUG
36  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrL_parser, ENUM_OUTPUT_LEVEL_trace, "new OSgLParserData()");
37 #endif
38  m_osglData = new OSgLParserData();
39 #ifndef NDEBUG
40  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrL_parser, ENUM_OUTPUT_LEVEL_trace, "new OSnLParserData()");
41 #endif
42  m_osnlData = new OSnLParserData();
43 #ifndef NDEBUG
45 #endif
46  m_osresult = new OSResult();
47  // initialize the lexer and set yyextra
48 #ifndef NDEBUG
49  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrL_parser, ENUM_OUTPUT_LEVEL_trace, "initialize the lexer");
50 #endif
53 #ifndef NDEBUG
55 #endif
56 }
57 
59 {
60  // delete the osresult object
61 #ifndef NDEBUG
62  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrL_parser, ENUM_OUTPUT_LEVEL_trace, "delete m_osresult");
63 #endif
64  if(m_osresult != NULL) delete m_osresult;
65  m_osresult = NULL;
66 
67  // now delete the scanner that was initialized
68 #ifndef NDEBUG
70 #endif
72 
73  // finally delete parser data
74 #ifndef NDEBUG
75  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrL_parser, ENUM_OUTPUT_LEVEL_trace, "delete parser data");
76 #endif
77  if( m_parserData != NULL) delete m_parserData;
78  m_parserData = NULL;
79 
80 #ifndef NDEBUG
82 #endif
83  if( m_osglData != NULL) delete m_osglData;
84  m_osglData = NULL;
85 
86 #ifndef NDEBUG
88 #endif
89  if( m_osnlData != NULL) delete m_osnlData;
90  m_osnlData = NULL;
91 
92 #ifndef NDEBUG
94 #endif
95 }
96 
97 OSResult* OSrLReader::readOSrL(const std::string& posrl)
98 #if __cplusplus < 201100
99  throw(ErrorClass)
100 #endif
101 {
102  if (posrl.length() > 0)
103  {
104  const char *ch = posrl.c_str();
105  yygetOSResult( ch, m_osresult, m_parserData, m_osglData, m_osnlData);
106  }
107  return m_osresult;
108 }
const OSSmartPtr< OSOutput > osoutput
Definition: OSOutput.cpp:39
OSResult * m_osresult
m_osresult is the OSResult object returned by the OSrLReader
Definition: OSrLReader.h:77
#define scanner
OSResult * readOSrL(const std::string &posrl)
Get an OSResult object from an OSrL string.
Definition: OSrLReader.cpp:97
The Result Class.
Definition: OSResult.h:2548
void osrlset_extra(OSrLParserData *parserData, void *yyscanner)
int osrllex_destroy(void *scanner)
OSnLParserData * osnlData
OSgLParserData * osglData
OSiLParserData * parserData
OSnLParserData * m_osnlData
m_osnlData is the object used in the parser to temporarily store data from the OSnL schema elements...
Definition: OSrLReader.h:92
OSgLParserData * m_osglData
m_osglData is the object used in the parser to temporarily store data from the OSgL schema elements...
Definition: OSrLReader.h:87
void * scanner
scanner is used to store data in a reentrant lexer we use this to pass an OSrLParserData object to th...
OSrLParserData * m_parserData
m_parserData is the object used in the parser to temporarily store data from the OSrL schema elements...
Definition: OSrLReader.h:82
int osrllex_init(void **ptr_yy_globals)
~OSrLReader()
OSrL class destructor.
Definition: OSrLReader.cpp:58
void yygetOSResult(const char *ch, OSResult *m_osresult, OSrLParserData *m_parserData, OSgLParserData *osglData, OSnLParserData *osnlData)
The OSgLParserData Class.
used for throwing exceptions.
Definition: OSErrorClass.h:31
The OSnLParserData Class.
The OSrLParserData Class.
OSrLReader()
OSrL class constructor.
Definition: OSrLReader.cpp:29