FeatureParser.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 #ifndef __FEATUREPARSER_H_02122004_1810__
00007 #define __FEATUREPARSER_H_02122004_1810__
00008 
00009 #include <iostream>
00010 #include <string>
00011 #include <map>
00012 #include "MolChemicalFeatureDef.h"
00013 
00014 namespace RDKit{
00015   //! \brief class used to indicate errors in parsing feature definition
00016   //!   files.
00017   class FeatureFileParseException : public std::exception {
00018   public:
00019     FeatureFileParseException(unsigned int lineNo,std::string line,std::string msg) :
00020       d_lineNo(lineNo), d_line(line), d_msg(msg) {};
00021     unsigned int lineNo () const { return d_lineNo; };
00022     std::string line () const { return d_line; };
00023     std::string message () const { return d_msg; };
00024     ~FeatureFileParseException () throw () {};
00025   private:
00026     unsigned int d_lineNo;
00027     std::string d_line,d_msg;
00028   };
00029   
00030   int parseFeatureData(const std::string &defnText,
00031                        MolChemicalFeatureDef::CollectionType &featDefs);
00032   int parseFeatureData(std::istream &istream,
00033                        MolChemicalFeatureDef::CollectionType &featDefs);
00034   int parseFeatureFile(const std::string &fileName,
00035                        MolChemicalFeatureDef::CollectionType &featDefs);
00036 
00037 
00038   namespace Local {
00039     // these functions are exposed only so they can be tested
00040     void parseAtomType(const std::string &inLine,
00041                        std::map<std::string,std::string> &atomTypeDefs,
00042                        const unsigned int &lineNo);
00043     MolChemicalFeatureDef *parseFeatureDef(std::istream &inStream,
00044                                         const std::string &inLine,
00045                                         unsigned int &lineNo,
00046                                         const std::map<std::string,std::string> &atomTypeDefs);
00047   }
00048 } // end of namespace RDKit
00049 #endif

Generated on Sat May 24 08:36:32 2008 for RDCode by  doxygen 1.5.3