From 4fec7e73201ed50e4a4157cb1ea1f1c63566dd89 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 28 Feb 2016 16:49:17 +0200 Subject: Menu customization --- web/xhtml-fragment | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 web/xhtml-fragment (limited to 'web/xhtml-fragment') diff --git a/web/xhtml-fragment b/web/xhtml-fragment new file mode 100644 index 0000000..a0964b0 --- /dev/null +++ b/web/xhtml-fragment @@ -0,0 +1,48 @@ +// file : web/xhtml-fragment -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef WEB_XHTML_FRAGMENT +#define WEB_XHTML_FRAGMENT + +#include +#include +#include // pair + +#include +#include + +namespace web +{ + namespace xhtml + { + // A parsed (via xml::parser) XHTML fragment that can later be serialized + // to xml::serializer. + // + class fragment + { + public: + fragment () = default; + + // Parse string as XHTML document fragment. The fragment should be + // complete, in the sense that all elements should have closing tags. + // Elements and attributes are considered to be in the namespace of the + // entire XHTML document, so no namespace should be specified for them. + // Do not validate against XHTML vocabulary. Can throw xml::parsing + // exception. + // + fragment (const std::string& xhtml, const std::string& input_name); + + void + operator() (xml::serializer&) const; + + bool + empty () const {return events_.empty ();} + + private: + std::vector> events_; + }; + } +} + +#endif // WEB_XHTML_FRAGMENT -- cgit v1.1