TSPLIB
src/ValidateSAX2ContentHandler.hpp
Go to the documentation of this file.
00001 
00011 #ifndef _ValidateSAX2ContentHandler_HPP_
00012 #define _ValidateSAX2ContentHandler_HPP_
00013 
00014 #include <xercesc/sax2/ContentHandler.hpp>
00015 
00016 #include <ios>
00017 #include <vector>
00018 #include <set>
00019 
00020 using namespace xercesc;
00021 
00022 XERCES_CPP_NAMESPACE_USE
00023 
00024 
00025 class SAX2ContentHandler : public ContentHandler {
00026 private:
00030         bool failed;
00031 
00039         bool isUndirected;
00040 
00044         std::string name;
00045 
00049         std::string source;
00050 
00054         std::string description;
00055 
00059         std::streamsize doublePrecision;
00060 
00065         std::streamsize ignoredDigits;
00066 
00070         double doubleZero;
00071 
00075         bool firstVertex;
00076 
00080         std::vector<std::vector<double> >::size_type numberOfParsedVertices;
00081 
00085         std::set<std::vector<double>::size_type> edgesDefinedInTheFirstVertex;
00086 
00090         std::vector<double> costsOfEdgesDefinedInTheFirstVertex;
00091 
00095         std::vector<std::vector<double> >::size_type n;
00096 
00100         std::vector<std::vector<bool> > parsedEntries;
00101 
00109         std::vector<std::vector<double> > adjacencyMatrix;
00110 
00114         std::string buffer;
00115 
00119         double cost;
00120 
00125         SAX2ContentHandler(const SAX2ContentHandler &sAX2ContentHandler);
00126 
00132         SAX2ContentHandler &operator=(const SAX2ContentHandler &sAX2ContentHandler);
00133 
00137         void init();
00138 
00139 public:
00143         SAX2ContentHandler();
00144 
00148     ~SAX2ContentHandler();
00149 
00158     inline bool getFailed() const {
00159         return (failed);
00160     }
00161 
00166         inline std::string getName() const {
00167                 return (name);
00168         }
00169 
00174         inline std::string getSource() const {
00175                 return (source);
00176         }
00177 
00182         inline std::string getDescription() const {
00183                 return (description);
00184         }
00185 
00190         inline std::streamsize getDoublePrecision() const {
00191                 return (doublePrecision);
00192         }
00193 
00202         inline std::streamsize getIgnoredDigits() const {
00203                 return (ignoredDigits);
00204         }
00205 
00210         inline double getDoubleZero() const {
00211                 return (doubleZero);
00212         }
00213 
00220         inline std::vector<std::vector<double> > getAdjacencyMatrix() {
00221                 return (adjacencyMatrix);
00222         }
00223 
00230         void setDocumentLocator(const Locator *const locator);
00231 
00236         void resetDocument();
00237 
00241         void startDocument();
00242 
00246         void endDocument();
00247 
00254         void startPrefixMapping(const XMLCh *const prefix, const XMLCh *const uri);
00255 
00260         void endPrefixMapping(const XMLCh *const prefix);
00261 
00266         void skippedEntity(const XMLCh *const name);
00267 
00275         void startElement(
00276                         const XMLCh *const uri,
00277                 const XMLCh *const localname,
00278                 const XMLCh *const qname,
00279                 const Attributes &attributes);
00280 
00287         void endElement(
00288                         const XMLCh *const uri,
00289                         const XMLCh *const localname,
00290                         const XMLCh *const qname);
00291 
00297         void characters(const XMLCh *const chars, const XMLSize_t length);
00298 
00305         void ignorableWhitespace(const XMLCh *const chars, const XMLSize_t length);
00306 
00313         void processingInstruction(const XMLCh *const target, const XMLCh *const data);
00314 };
00315 
00316 
00317 #endif
 All Classes Files Functions Variables Friends Defines