diff options
| author | Thomas Schmucker <ts@its1.de> | 2025-03-09 22:26:25 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2025-03-09 22:26:25 +0100 |
| commit | 0cf833840b19e603f480dead5ca211f947503f9b (patch) | |
| tree | 9b146c5644e1bb93ed0307275a6930bffe11d0ad /include/xml.hpp | |
| download | expat++-0cf833840b19e603f480dead5ca211f947503f9b.tar.gz expat++-0cf833840b19e603f480dead5ca211f947503f9b.tar.bz2 expat++-0cf833840b19e603f480dead5ca211f947503f9b.zip | |
Initial commit
Diffstat (limited to 'include/xml.hpp')
| -rw-r--r-- | include/xml.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/xml.hpp b/include/xml.hpp new file mode 100644 index 0000000..cc593a3 --- /dev/null +++ b/include/xml.hpp | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #ifndef XML_HPP_INCLUDED | ||
| 2 | #define XML_HPP_INCLUDED | ||
| 3 | |||
| 4 | // Standard C++ | ||
| 5 | #include <iostream> | ||
| 6 | #include <string> | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | class XML { | ||
| 10 | public: | ||
| 11 | void parse(std::istream& in); | ||
| 12 | |||
| 13 | protected: | ||
| 14 | virtual void handle_start(const std::string& name, const std::vector<std::pair<std::string, std::string>>& attr) = 0; | ||
| 15 | virtual void handle_end(const std::string& name) = 0; | ||
| 16 | virtual void handle_cdata_start() {} | ||
| 17 | virtual void handle_cdata_end() {} | ||
| 18 | virtual void handle_data(const std::vector<char>&) {} | ||
| 19 | |||
| 20 | private: | ||
| 21 | static void tag_start(void* me, const char* name, const char* attr[]); | ||
| 22 | static void tag_end(void* me, const char* name); | ||
| 23 | static void cdata_start(void* me); | ||
| 24 | static void cdata_end(void* me); | ||
| 25 | static void data(void* me, const char* dat, int len); | ||
| 26 | }; | ||
| 27 | |||
| 28 | #endif | ||
