예제 #1
0
//-----------------------------------------------------------------------------
//
WaypointGeo::WaypointGeo( GeoReporter         *reportController,
                          const char          *filename )
 :  GeoController( reportController ),
    m_WaypointInterfaceItem()
{
    beginParsing();
    parse( filename );
    endParsing( GeoController::defaultNrMosaicCells );
}
예제 #2
0
		void parseFile(const std::string & fname) {
			std::ifstream f;
			f.exceptions(std::ifstream::failbit | std::ifstream::badbit);
			f.open(fname.c_str(), std::ifstream::in);
			f.exceptions(std::ifstream::badbit);
			startParsing();
			char buf[1024];
			try {
				while(!f.fail() && !f.eof()) {
					f.read(buf, sizeof(buf));
					submitData(buf, f.gcount());
				}
			} catch(...) {
				f.close();
				std::cout << "Exception around line " << XML_GetCurrentLineNumber(exp_parser) << "\n";
				endParsing();
				throw;
			}
			f.close();
			endParsing();
		}
예제 #3
0
		bool parseFile_more() {
			char buf[1024];
			if(incfile_finished) return false;
			if(incfile_f.fail() || incfile_f.eof()) {
				if(file_size) file_pos = file_size;
				endParsing();
				incfile_f.close();
				incfile_finished = true;
				return true;
			}
			if(file_size) file_pos = incfile_f.tellg();
			incfile_f.read(buf, sizeof(buf));
			submitData(buf, incfile_f.gcount());
			return true;
		}
예제 #4
0
/// reads the content of a single file
/// @param device the device to read from. The device NEEDS to be open!!
/// @return the language grammar or 0 on error
TextGrammar* TmLanguageParser::parse(QIODevice* device)
{
    TextGrammar* result=0;

    if( beginParsing(device) ) {
        QVariant plist = readNextPlistType( );
        result = createLanguage( plist );
    }

    if( !endParsing() ) {
        delete result;
        result = 0;
    }

    // returns the language
    return result;
}