From 1e886ed00c8defc5db73ae2e8c3afd7506ec784d Mon Sep 17 00:00:00 2001 From: Myun2 Date: Tue, 20 Jul 2010 01:44:12 +0900 Subject: [PATCH] lexical, xml: Update --- roast/include/roast/lexical/parser_base.hpp | 10 +++++++++- roast/include/roast/lexical/string_parser_base.hpp | 10 ++++++---- .../include/roast/xml/roast_xml/roast_xml_parser.hpp | 19 +++++++++++++++++++ roast/test/lexical_test/parser_test.cpp | 4 ++-- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/roast/include/roast/lexical/parser_base.hpp b/roast/include/roast/lexical/parser_base.hpp index 555ebc73..802f3bd3 100644 --- a/roast/include/roast/lexical/parser_base.hpp +++ b/roast/include/roast/lexical/parser_base.hpp @@ -10,7 +10,7 @@ namespace roast { ////////////////////////////////////////////////////////// - template + template class parser_base { protected: @@ -20,6 +20,14 @@ namespace roast parser_base(const _Iterator& it) : m_it(it) {} void setup(const _Iterator& it){ m_it = it; } + + ///////////////////////////////////////////////////////////// + + bool analyze() + { + _Impl impl; + return impl.analyze(m_it); + } }; ////////////////////////////////////////////////////////// diff --git a/roast/include/roast/lexical/string_parser_base.hpp b/roast/include/roast/lexical/string_parser_base.hpp index 29c8ec04..6d92053d 100644 --- a/roast/include/roast/lexical/string_parser_base.hpp +++ b/roast/include/roast/lexical/string_parser_base.hpp @@ -12,10 +12,11 @@ namespace roast { ////////////////////////////////////////////////////////// - class string_parser_base : public parser_base + template + class string_parser_base : public parser_base { private: - typedef parser_base _Base; + typedef parser_base _Base; public: string_parser_base(){} string_parser_base(const char* s) : _Base( ccharbuf_iterator(s) ) {} @@ -24,10 +25,11 @@ namespace roast ////////////////////////////////////////////////////////// // WhiteSpace(Space,Tab,\r,\n) Sprit - class ws_sprit_parser_base : public string_parser_base + template + class ws_sprit_parser_base : public string_parser_base<_Impl> { private: - typedef string_parser_base _Base; + typedef string_parser_base<_Impl> _Base; public: ws_sprit_parser_base(){} ws_sprit_parser_base(const char* s) : _Base(s) {} diff --git a/roast/include/roast/xml/roast_xml/roast_xml_parser.hpp b/roast/include/roast/xml/roast_xml/roast_xml_parser.hpp index c51ac788..4cac827c 100644 --- a/roast/include/roast/xml/roast_xml/roast_xml_parser.hpp +++ b/roast/include/roast/xml/roast_xml/roast_xml_parser.hpp @@ -12,7 +12,26 @@ namespace roast { namespace roast_xml { + class parser_impl + { + public: + bool analyze(const char* s) + { + return true; + } + }; + //////////////////////////////////////////////////////////////// + + class parser : public lexical::ws_sprit_parser_base + { + private: + typedef lexical::ws_sprit_parser_base _Base; + public: + parser(){} + parser(const char* s) : _Base(s) {} + }; + //////////////////////////////////////////////////////////////// } } diff --git a/roast/test/lexical_test/parser_test.cpp b/roast/test/lexical_test/parser_test.cpp index 0d0827b6..a66978c7 100644 --- a/roast/test/lexical_test/parser_test.cpp +++ b/roast/test/lexical_test/parser_test.cpp @@ -1,13 +1,13 @@ #include "roast/lexical/parser_base.hpp" #//include "roast/xml/roast_dom_driver.hpp" -#include "roast/xml/roast_xml/roast_xml.hpp" +#include "roast/xml/roast_xml/roast_xml_parser.hpp" using namespace roast; using namespace roast::lexical; int main() { - ws_sprit_parser_base wss("aaa"); + roast_xml::parser wss("aaa"); return 0; } -- 2.11.0