parsing.hh
Go to the documentation of this file.
00001 #ifndef PARSING_H
00002 #define PARSING_H
00003 
00004 #include <sstream>
00005 #include <string>
00006 
00007 namespace Parsing
00008 {
00009     using Typelib::ImportError;
00010     class MalformedXML : public ImportError
00011     {
00012     public:
00013         MalformedXML(const std::string& file = "") 
00014             : ImportError(file, "malformed XML") {}
00015     };
00016 
00017     class UnexpectedElement : public ImportError
00018     {
00019         std::string m_found, m_expected;
00020     public:
00021         UnexpectedElement(const std::string& found_, const std::string expected_, const std::string& file = "")
00022             : ImportError(file, "unexpected element " + found_ + ", was expecting " + expected_)
00023             , m_found(found_), m_expected(expected_) { }
00024         ~UnexpectedElement() throw() {}
00025 
00026         std::string found() const    { return m_found; }
00027         std::string expected() const { return m_expected; }
00028     };
00029 
00030     class BadRootElement : public ImportError
00031     {
00032         std::string m_found, m_expected;
00033     public:
00034         BadRootElement(const std::string& found_, const std::string expected_, const std::string& file = "")
00035             : ImportError(file, "this document is not a Typelib type library: found " + found_ + " instead of " + expected_)
00036             , m_found(found_), m_expected(expected_) {}
00037         ~BadRootElement() throw() {}
00038 
00039         std::string found() const    { return m_found; }
00040         std::string expected() const { return m_expected; }
00041     };
00042 
00043     class MissingAttribute : public ImportError
00044     {
00045         std::string m_attribute;
00046     public:
00047         MissingAttribute(const std::string& attribute, const std::string& file = "")
00048             : ImportError(file, "missing attribute " + attribute), m_attribute(attribute) {}
00049         ~MissingAttribute() throw() {}
00050     };
00051 };
00052 
00053 #endif
00054 


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 18:49:22