00001 // Copyright (C) 2004 Xavier Décoret <Xavier.Decoret@imag.fr> 00002 00003 // This program is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU General Public License 00005 // as published by the Free Software Foundation; either 00006 // version 2 of the License, or (at your option) any later 00007 // version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 00018 // Things that gets included in Lexer.hpp and Parser.hpp 00019 00020 #ifndef XDKBIB_PARSEDBIBFILE_H 00021 #define XDKBIB_PARSEDBIBFILE_H 00022 00023 #include "file.h" 00024 00025 #include <antlr/TokenStreamSelector.hpp> 00026 #include <string> 00027 #include <deque> 00028 #include <map> 00029 #include <stdexcept> 00030 #include <algorithm> 00031 00032 #if HAVE_CONFIG_H 00033 #include <config.h> 00034 #endif 00035 00036 typedef enum { Strict=0, Warning=1, Accept=4 } Compliance; 00037 00038 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00039 // Interface of ParsedBibFile 00040 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00041 class ParsedBibFile 00042 { 00043 public: 00044 ParsedBibFile(xdkbib::File* file, 00045 antlr::TokenStreamSelector* selector_, 00046 Compliance quote); 00047 virtual ~ParsedBibFile(); 00048 00049 virtual void issueWarning(const std::string&, 00050 const std::string&,unsigned int); 00051 00052 xdkbib::File* file() const; 00053 00054 inline antlr::TokenStreamSelector* selector() const; 00055 00056 inline Compliance quoteCompliance() const; 00057 void setQuoteCompliance(Compliance c); 00058 00059 const std::string& currentComment() const; 00060 void addToCurrentComment(const std::string&); 00061 void clearCurrentComment(); 00062 private: 00063 xdkbib::File* file_; 00064 antlr::TokenStreamSelector* selector_; 00065 Compliance quoteCompliance_; 00066 std::string comment_; 00067 }; 00068 //************************************************************ 00069 //Implementation of ParsedBibFile 00070 //************************************************************ 00071 inline xdkbib::File* 00072 ParsedBibFile::file() const 00073 { 00074 return file_; 00075 } 00076 inline antlr::TokenStreamSelector* 00077 ParsedBibFile::selector() const 00078 { 00079 return selector_; 00080 } 00081 inline Compliance 00082 ParsedBibFile::quoteCompliance() const 00083 { 00084 return quoteCompliance_; 00085 } 00086 00087 #endif // XDKBIB_PARSEDBIBFILE_H