00001 00017 #include "OSrLReader.h" 00018 00019 00020 00021 00022 void yygetOSResult( const char *ch, OSResult* m_osresult, OSrLParserData *m_parserData) throw(ErrorClass); 00023 int osrllex_init(void** ptr_yy_globals); 00024 int osrllex_destroy (void* scanner ); 00025 void osrlset_extra (OSrLParserData* parserData , void* yyscanner ); 00026 00027 00028 OSrLReader::OSrLReader( ) { 00029 m_parserData = new OSrLParserData(); 00030 m_osresult = new OSResult(); 00031 // initialize the lexer and set yyextra 00032 osrllex_init( &(m_parserData->scanner) ); 00033 osrlset_extra (m_parserData , m_parserData->scanner); 00034 } 00035 00036 OSrLReader::~OSrLReader(){ 00037 // delete the osresult object 00038 if(m_osresult != NULL) delete m_osresult; 00039 m_osresult = NULL; 00040 // now delete the scanner that was initialized 00041 osrllex_destroy(m_parserData->scanner ); 00042 // findally delete parser data 00043 if( m_parserData != NULL) delete m_parserData; 00044 m_parserData = NULL; 00045 00046 } 00047 00048 OSResult* OSrLReader::readOSrL(const std::string& posrl) throw(ErrorClass){ 00049 try{ 00050 const char *ch = posrl.c_str(); 00051 yygetOSResult( ch, m_osresult, m_parserData); 00052 return m_osresult; 00053 } 00054 catch(const ErrorClass& eclass){ 00055 throw ErrorClass( eclass.errormsg); 00056 } 00057 }