Hauptseite | Liste aller Namensbereiche | Klassenhierarchie | Übersicht | Auflistung der Dateien | Elemente eines Namensbereiches | Datenstruktur-Elemente | Datei-Elemente

UnitParser.cpp

gehe zur Dokumentation dieser Datei
00001 // Copyright (C) 2004 Bernhard Assmann <bernie@tuxomania.net>
00002 //  
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //  
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //  
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 //  
00017 
00018 #include "psfa/UnitParser.hpp"
00019 #include "psfa/Sax2Parser.hpp"
00020 #include "psfa/UnitSax2ContentHandler.hpp"
00021 #include "psfa/UnitSax2ErrorHandler.hpp"
00022 #include "psfa/Config.hpp"
00023 
00024 
00025 
00026 psfa::UnitParser::UnitParser( const std::string pool )
00027   : pool_( pool )
00028 {
00029   
00030 }
00031 
00032 
00033     
00034 psfa::UnitParser::~UnitParser() 
00035 {
00036    
00037 }
00038 
00039 
00040 void
00041 psfa::UnitParser::parse( const std::vector< std::string >& files,
00042           std::vector< IndexData_SP >& data,
00043           std::vector< std::string >& errorFiles )
00044 {
00045   using std::string;
00046   typedef std::vector< string > sVec;
00047 
00048   xercesc::SAX2XMLReader* parser = Sax2Parser::getSax2Parser();
00049   UnitSax2ContentHandler cH( pool_, data );
00050   UnitSax2ErrorHandler eH;
00051   parser->setContentHandler( &cH );
00052   parser->setErrorHandler(   &eH );
00053 
00054   Config* conf = Config::getConfig();
00055   string path = conf->getConfigValue( pool_, "root" );
00056   
00057   int error = 0;
00058   sVec::const_iterator i;
00059   sVec::const_iterator iEnd = files.end();
00060   for( i = files.begin(); i != iEnd; ++i ) {
00061     string filePath = path + "/" + *i;
00062     cH.setFileName( *i );
00063     parser->parse( filePath.c_str() );
00064     error = parser->getErrorCount();
00065     if( error > 0 ) {
00066       errorFiles.push_back( *i );
00067     }
00068   }
00069   return;
00070 }

Erzeugt am Mon Jul 12 11:45:04 2004 für PSFA von doxygen 1.3.4