From 9c673a435ce0072ebd69093fdf4ce3282868d42a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 17 Apr 2018 17:53:12 +0200 Subject: [PATCH] Use xsd for is-composing xml handling. --- src/CMakeLists.txt | 2 + .../chat-message/is-composing-message.cpp | 2 +- src/chat/notification/is-composing.cpp | 132 +-- src/chat/notification/is-composing.h | 6 +- src/xml/generate.py | 2 + src/xml/is-composing.cpp | 962 ++++++++++++++++++ src/xml/is-composing.h | 678 ++++++++++++ src/xml/is-composing.xsd | 18 + 8 files changed, 1693 insertions(+), 109 deletions(-) create mode 100644 src/xml/is-composing.cpp create mode 100644 src/xml/is-composing.h create mode 100644 src/xml/is-composing.xsd diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f5617ed65..90bb71e2d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -165,6 +165,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES variant/variant.h xml/conference-info.h xml/imdn.h + xml/is-composing.h xml/linphone-imdn.h xml/resource-lists.h xml/xml.h @@ -289,6 +290,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES variant/variant.cpp xml/conference-info.cpp xml/imdn.cpp + xml/is-composing.cpp xml/linphone-imdn.cpp xml/resource-lists.cpp xml/xml.cpp diff --git a/src/chat/chat-message/is-composing-message.cpp b/src/chat/chat-message/is-composing-message.cpp index 13177e92e..9797e9e9e 100644 --- a/src/chat/chat-message/is-composing-message.cpp +++ b/src/chat/chat-message/is-composing-message.cpp @@ -37,7 +37,7 @@ IsComposingMessage::IsComposingMessage ( L_D(); Content *content = new Content(); content->setContentType(ContentType::ImIsComposing); - content->setBody(isComposingHandler.marshal(isComposing)); + content->setBody(isComposingHandler.createXml(isComposing)); addContent(content); d->addSalCustomHeader(PriorityHeader::HeaderName, PriorityHeader::NonUrgent); d->addSalCustomHeader("Expires", "0"); diff --git a/src/chat/notification/is-composing.cpp b/src/chat/notification/is-composing.cpp index c567bd3b8..e6e6c70ae 100644 --- a/src/chat/notification/is-composing.cpp +++ b/src/chat/notification/is-composing.cpp @@ -24,6 +24,7 @@ #include "chat/chat-room/chat-room-p.h" #include "chat/notification/is-composing.h" #include "logger/logger.h" +#include "xml/is-composing.h" // ============================================================================= @@ -42,10 +43,6 @@ struct IsRemoteComposingData { // ----------------------------------------------------------------------------- -const string IsComposing::isComposingPrefix = "/xsi:isComposing"; - -// ----------------------------------------------------------------------------- - IsComposing::IsComposing (LinphoneCore *core, IsComposingListener *listener) : core(core), listener(listener) {} @@ -55,66 +52,34 @@ IsComposing::~IsComposing () { // ----------------------------------------------------------------------------- -string IsComposing::marshal (bool isComposing) { - string content; +string IsComposing::createXml (bool isComposing) { + Xsd::IsComposing::IsComposing node(isComposing ? "active" : "idle"); + if (isComposing) + node.setRefresh(static_cast(lp_config_get_int(core->config, "sip", "composing_refresh_timeout", defaultRefreshTimeout))); - xmlBufferPtr buf = xmlBufferCreate(); - if (!buf) { - lError() << "Error creating the XML buffer"; - return content; - } - xmlTextWriterPtr writer = xmlNewTextWriterMemory(buf, 0); - if (!writer) { - lError() << "Error creating the XML writer"; - return content; - } - - int err = xmlTextWriterStartDocument(writer, "1.0", "UTF-8", nullptr); - if (err >= 0) { - err = xmlTextWriterStartElementNS(writer, nullptr, (const xmlChar *)"isComposing", - (const xmlChar *)"urn:ietf:params:xml:ns:im-iscomposing"); - } - if (err >= 0) { - err = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)"xmlns", (const xmlChar *)"xsi", nullptr, - (const xmlChar *)"http://www.w3.org/2001/XMLSchema-instance"); - } - if (err >= 0) { - err = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)"xsi", (const xmlChar *)"schemaLocation", nullptr, - (const xmlChar *)"urn:ietf:params:xml:ns:im-composing iscomposing.xsd"); - } - if (err >= 0) { - err = xmlTextWriterWriteElement(writer, (const xmlChar *)"state", - isComposing ? (const xmlChar *)"active" : (const xmlChar *)"idle"); - } - if ((err >= 0) && isComposing) { - int refreshTimeout = lp_config_get_int(core->config, "sip", "composing_refresh_timeout", defaultRefreshTimeout); - err = xmlTextWriterWriteElement(writer, (const xmlChar *)"refresh", (const xmlChar *)Utils::toString(refreshTimeout).c_str()); - } - if (err >= 0) { - /* Close the "isComposing" element. */ - err = xmlTextWriterEndElement(writer); - } - if (err >= 0) { - err = xmlTextWriterEndDocument(writer); - } - if (err > 0) { - /* xmlTextWriterEndDocument returns the size of the content. */ - content = (char *)buf->content; - } - xmlFreeTextWriter(writer); - xmlBufferFree(buf); - return content; + stringstream ss; + Xsd::XmlSchema::NamespaceInfomap map; + map[""].name = "urn:ietf:params:xml:ns:im-iscomposing"; + Xsd::IsComposing::serializeIsComposing(ss, node, map); + return ss.str(); } void IsComposing::parse (const Address &remoteAddr, const string &text) { - xmlparsing_context_t *xmlCtx = linphone_xmlparsing_context_new(); - xmlSetGenericErrorFunc(xmlCtx, linphone_xmlparsing_genericxml_error); - xmlCtx->doc = xmlReadDoc((const unsigned char *)text.c_str(), 0, nullptr, 0); - if (xmlCtx->doc) - parse(xmlCtx, remoteAddr); - else - lWarning() << "Wrongly formatted presence XML: " << xmlCtx->errorBuffer; - linphone_xmlparsing_context_destroy(xmlCtx); + istringstream data(text); + unique_ptr node(Xsd::IsComposing::parseIsComposing(data, Xsd::XmlSchema::Flags::dont_validate)); + if (!node) + return; + + if (node->getState() == "active") { + unsigned long long refresh = 0; + if (node->getRefresh().present()) + refresh = node->getRefresh().get(); + startRemoteRefreshTimer(remoteAddr.asStringUriOnly(), refresh); + listener->onIsRemoteComposingStateChanged(remoteAddr, true); + } else if (node->getState() == "idle") { + stopRemoteRefreshTimer(remoteAddr.asStringUriOnly()); + listener->onIsRemoteComposingStateChanged(remoteAddr, false); + } } void IsComposing::startIdleTimer () { @@ -186,47 +151,6 @@ unsigned int IsComposing::getRemoteRefreshTimerDuration () { return remoteRefreshTimerDuration < 0 ? 0 : static_cast(remoteRefreshTimerDuration); } -void IsComposing::parse (xmlparsing_context_t *xmlCtx, const Address &remoteAddr) { - char xpathStr[MAX_XPATH_LENGTH]; - char *stateStr = nullptr; - char *refreshStr = nullptr; - int i; - bool state = false; - - if (linphone_create_xml_xpath_context(xmlCtx) < 0) - return; - - xmlXPathRegisterNs(xmlCtx->xpath_ctx, (const xmlChar *)"xsi", (const xmlChar *)"urn:ietf:params:xml:ns:im-iscomposing"); - xmlXPathObjectPtr isComposingObject = linphone_get_xml_xpath_object_for_node_list(xmlCtx, isComposingPrefix.c_str()); - if (isComposingObject) { - if (isComposingObject->nodesetval) { - for (i = 1; i <= isComposingObject->nodesetval->nodeNr; i++) { - snprintf(xpathStr, sizeof(xpathStr), "%s[%i]/xsi:state", isComposingPrefix.c_str(), i); - stateStr = linphone_get_xml_text_content(xmlCtx, xpathStr); - if (!stateStr) - continue; - snprintf(xpathStr, sizeof(xpathStr), "%s[%i]/xsi:refresh", isComposingPrefix.c_str(), i); - refreshStr = linphone_get_xml_text_content(xmlCtx, xpathStr); - } - } - xmlXPathFreeObject(isComposingObject); - } - - if (stateStr) { - if (strcmp(stateStr, "active") == 0) { - state = true; - startRemoteRefreshTimer(remoteAddr.asStringUriOnly(), refreshStr); - } else { - stopRemoteRefreshTimer(remoteAddr.asStringUriOnly()); - } - - listener->onIsRemoteComposingStateChanged(remoteAddr, state); - linphone_free_xml_text_content(stateStr); - } - if (refreshStr) - linphone_free_xml_text_content(refreshStr); -} - int IsComposing::idleTimerExpired () { stopRefreshTimer(); stopIdleTimer(); @@ -245,10 +169,10 @@ int IsComposing::remoteRefreshTimerExpired (const string &uri) { return BELLE_SIP_STOP; } -void IsComposing::startRemoteRefreshTimer (const string &uri, const char *refreshStr) { +void IsComposing::startRemoteRefreshTimer (const string &uri, unsigned long long refresh) { unsigned int duration = getRemoteRefreshTimerDuration(); - if (refreshStr) - duration = static_cast(Utils::stoi(refreshStr)); + if (refresh != 0) + duration = static_cast(refresh); auto it = remoteRefreshTimers.find(uri); if (it == remoteRefreshTimers.end()) { IsRemoteComposingData *data = new IsRemoteComposingData(this, uri); diff --git a/src/chat/notification/is-composing.h b/src/chat/notification/is-composing.h index 5722537d5..b556dffef 100644 --- a/src/chat/notification/is-composing.h +++ b/src/chat/notification/is-composing.h @@ -38,7 +38,7 @@ public: IsComposing (LinphoneCore *core, IsComposingListener *listener); ~IsComposing (); - std::string marshal (bool isComposing); + std::string createXml (bool isComposing); void parse (const Address &remoteAddr, const std::string &content); void startIdleTimer (); void startRefreshTimer (); @@ -51,11 +51,10 @@ private: unsigned int getIdleTimerDuration (); unsigned int getRefreshTimerDuration (); unsigned int getRemoteRefreshTimerDuration (); - void parse (xmlparsing_context_t *xmlCtx, const Address &remoteAddr); int idleTimerExpired (); int refreshTimerExpired (); int remoteRefreshTimerExpired (const std::string &uri); - void startRemoteRefreshTimer (const std::string &uri, const char *refreshStr); + void startRemoteRefreshTimer (const std::string &uri, unsigned long long refresh); void stopAllRemoteRefreshTimers (); std::unordered_map::iterator stopRemoteRefreshTimer (const std::unordered_map::const_iterator it); @@ -67,7 +66,6 @@ private: static const int defaultIdleTimeout = 15; static const int defaultRefreshTimeout = 60; static const int defaultRemoteRefreshTimeout = 120; - static const std::string isComposingPrefix; LinphoneCore *core = nullptr; IsComposingListener *listener = nullptr; diff --git a/src/xml/generate.py b/src/xml/generate.py index c2fb8075a..60c2f73d0 100755 --- a/src/xml/generate.py +++ b/src/xml/generate.py @@ -93,6 +93,7 @@ def generate(name): "--namespace-map", "http://www.w3.org/2001/XMLSchema=LinphonePrivate::Xsd::XmlSchema", "--namespace-map", "urn:ietf:params:xml:ns:conference-info=LinphonePrivate::Xsd::ConferenceInfo", "--namespace-map", "urn:ietf:params:xml:ns:imdn=LinphonePrivate::Xsd::Imdn", + "--namespace-map", "urn:ietf:params:xml:ns:im-iscomposing=LinphonePrivate::Xsd::IsComposing", "--namespace-map", "http://www.linphone.org/xsds/imdn.xsd=LinphonePrivate::Xsd::LinphoneImdn", "--namespace-map", "urn:ietf:params:xml:ns:resource-lists=LinphonePrivate::Xsd::ResourceLists", source_file @@ -105,6 +106,7 @@ def main(argv = None): generate("xml") generate("conference-info") generate("imdn") + generate("is-composing") generate("linphone-imdn") generate("resource-lists") diff --git a/src/xml/is-composing.cpp b/src/xml/is-composing.cpp new file mode 100644 index 000000000..24002401b --- /dev/null +++ b/src/xml/is-composing.cpp @@ -0,0 +1,962 @@ +// Copyright (c) 2005-2014 Code Synthesis Tools CC +// +// This program was generated by CodeSynthesis XSD, an XML Schema to +// C++ data binding compiler. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// +// In addition, as a special exception, Code Synthesis Tools CC gives +// permission to link this program with the Xerces-C++ library (or with +// modified versions of Xerces-C++ that use the same license as Xerces-C++), +// and distribute linked combinations including the two. You must obey +// the GNU General Public License version 2 in all respects for all of +// the code used other than Xerces-C++. If you modify this copy of the +// program, you may extend this exception to your version of the program, +// but you are not obligated to do so. If you do not wish to do so, delete +// this exception statement from your version. +// +// Furthermore, Code Synthesis Tools CC makes a special exception for +// the Free/Libre and Open Source Software (FLOSS) which is described +// in the accompanying FLOSSE file. +// + +// Begin prologue. +// +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wfloat-equal" +#endif +#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-override" +#endif +// +// End prologue. + +#include + +#include "is-composing.h" + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + // IsComposing + // + + const IsComposing::StateType& IsComposing:: + getState () const + { + return this->state_.get (); + } + + IsComposing::StateType& IsComposing:: + getState () + { + return this->state_.get (); + } + + void IsComposing:: + setState (const StateType& x) + { + this->state_.set (x); + } + + void IsComposing:: + setState (::std::unique_ptr< StateType > x) + { + this->state_.set (std::move (x)); + } + + ::std::unique_ptr< IsComposing::StateType > IsComposing:: + setDetachState () + { + return this->state_.detach (); + } + + const IsComposing::LastactiveOptional& IsComposing:: + getLastactive () const + { + return this->lastactive_; + } + + IsComposing::LastactiveOptional& IsComposing:: + getLastactive () + { + return this->lastactive_; + } + + void IsComposing:: + setLastactive (const LastactiveType& x) + { + this->lastactive_.set (x); + } + + void IsComposing:: + setLastactive (const LastactiveOptional& x) + { + this->lastactive_ = x; + } + + void IsComposing:: + setLastactive (::std::unique_ptr< LastactiveType > x) + { + this->lastactive_.set (std::move (x)); + } + + const IsComposing::ContenttypeOptional& IsComposing:: + getContenttype () const + { + return this->contenttype_; + } + + IsComposing::ContenttypeOptional& IsComposing:: + getContenttype () + { + return this->contenttype_; + } + + void IsComposing:: + setContenttype (const ContenttypeType& x) + { + this->contenttype_.set (x); + } + + void IsComposing:: + setContenttype (const ContenttypeOptional& x) + { + this->contenttype_ = x; + } + + void IsComposing:: + setContenttype (::std::unique_ptr< ContenttypeType > x) + { + this->contenttype_.set (std::move (x)); + } + + const IsComposing::RefreshOptional& IsComposing:: + getRefresh () const + { + return this->refresh_; + } + + IsComposing::RefreshOptional& IsComposing:: + getRefresh () + { + return this->refresh_; + } + + void IsComposing:: + setRefresh (const RefreshType& x) + { + this->refresh_.set (x); + } + + void IsComposing:: + setRefresh (const RefreshOptional& x) + { + this->refresh_ = x; + } + + const IsComposing::AnySequence& IsComposing:: + getAny () const + { + return this->any_; + } + + IsComposing::AnySequence& IsComposing:: + getAny () + { + return this->any_; + } + + void IsComposing:: + setAny (const AnySequence& s) + { + this->any_ = s; + } + + const ::xercesc::DOMDocument& IsComposing:: + getDomDocument () const + { + return *this->dom_document_; + } + + ::xercesc::DOMDocument& IsComposing:: + getDomDocument () + { + return *this->dom_document_; + } + } + } +} + +#include + +#include + +#include + +namespace _xsd +{ + static + const ::xsd::cxx::tree::type_factory_plate< 0, char > + type_factory_plate_init; +} + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + // IsComposing + // + + IsComposing:: + IsComposing (const StateType& state) + : ::LinphonePrivate::Xsd::XmlSchema::Type (), + dom_document_ (::xsd::cxx::xml::dom::create_document< char > ()), + state_ (state, this), + lastactive_ (this), + contenttype_ (this), + refresh_ (this), + any_ (this->getDomDocument ()) + { + } + + IsComposing:: + IsComposing (const IsComposing& x, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + ::LinphonePrivate::Xsd::XmlSchema::Container* c) + : ::LinphonePrivate::Xsd::XmlSchema::Type (x, f, c), + dom_document_ (::xsd::cxx::xml::dom::create_document< char > ()), + state_ (x.state_, f, this), + lastactive_ (x.lastactive_, f, this), + contenttype_ (x.contenttype_, f, this), + refresh_ (x.refresh_, f, this), + any_ (x.any_, this->getDomDocument ()) + { + } + + IsComposing:: + IsComposing (const ::xercesc::DOMElement& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + ::LinphonePrivate::Xsd::XmlSchema::Container* c) + : ::LinphonePrivate::Xsd::XmlSchema::Type (e, f | ::LinphonePrivate::Xsd::XmlSchema::Flags::base, c), + dom_document_ (::xsd::cxx::xml::dom::create_document< char > ()), + state_ (this), + lastactive_ (this), + contenttype_ (this), + refresh_ (this), + any_ (this->getDomDocument ()) + { + if ((f & ::LinphonePrivate::Xsd::XmlSchema::Flags::base) == 0) + { + ::xsd::cxx::xml::dom::parser< char > p (e, true, false, false); + this->parse (p, f); + } + } + + void IsComposing:: + parse (::xsd::cxx::xml::dom::parser< char >& p, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + for (; p.more_content (); p.next_content (false)) + { + const ::xercesc::DOMElement& i (p.cur_element ()); + const ::xsd::cxx::xml::qualified_name< char > n ( + ::xsd::cxx::xml::dom::name< char > (i)); + + // state + // + if (n.name () == "state" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + ::std::unique_ptr< StateType > r ( + StateTraits::create (i, f, this)); + + if (!state_.present ()) + { + this->state_.set (::std::move (r)); + continue; + } + } + + // lastactive + // + if (n.name () == "lastactive" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + ::std::unique_ptr< LastactiveType > r ( + LastactiveTraits::create (i, f, this)); + + if (!this->lastactive_) + { + this->lastactive_.set (::std::move (r)); + continue; + } + } + + // contenttype + // + if (n.name () == "contenttype" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + ::std::unique_ptr< ContenttypeType > r ( + ContenttypeTraits::create (i, f, this)); + + if (!this->contenttype_) + { + this->contenttype_.set (::std::move (r)); + continue; + } + } + + // refresh + // + if (n.name () == "refresh" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + if (!this->refresh_) + { + this->refresh_.set (RefreshTraits::create (i, f, this)); + continue; + } + } + + // any + // + if ((!n.namespace_ ().empty () && n.namespace_ () != "urn:ietf:params:xml:ns:im-iscomposing")) + { + ::xercesc::DOMElement* r ( + static_cast< ::xercesc::DOMElement* > ( + this->getDomDocument ().importNode ( + const_cast< ::xercesc::DOMElement* > (&i), true))); + this->any_.push_back (r); + continue; + } + + break; + } + + if (!state_.present ()) + { + throw ::xsd::cxx::tree::expected_element< char > ( + "state", + "urn:ietf:params:xml:ns:im-iscomposing"); + } + } + + IsComposing* IsComposing:: + _clone (::LinphonePrivate::Xsd::XmlSchema::Flags f, + ::LinphonePrivate::Xsd::XmlSchema::Container* c) const + { + return new class IsComposing (*this, f, c); + } + + IsComposing& IsComposing:: + operator= (const IsComposing& x) + { + if (this != &x) + { + static_cast< ::LinphonePrivate::Xsd::XmlSchema::Type& > (*this) = x; + this->state_ = x.state_; + this->lastactive_ = x.lastactive_; + this->contenttype_ = x.contenttype_; + this->refresh_ = x.refresh_; + this->any_ = x.any_; + } + + return *this; + } + + IsComposing:: + ~IsComposing () + { + } + } + } +} + +#include + +#include + +namespace _xsd +{ + static + const ::xsd::cxx::tree::std_ostream_plate< 0, char > + std_ostream_plate_init; +} + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + ::std::ostream& + operator<< (::std::ostream& o, const IsComposing& i) + { + o << ::std::endl << "state: " << i.getState (); + if (i.getLastactive ()) + { + o << ::std::endl << "lastactive: " << *i.getLastactive (); + } + + if (i.getContenttype ()) + { + o << ::std::endl << "contenttype: " << *i.getContenttype (); + } + + if (i.getRefresh ()) + { + o << ::std::endl << "refresh: " << *i.getRefresh (); + } + + return o; + } + } + } +} + +#include +#include +#include + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::std::string& u, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0, + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0); + + ::xsd::cxx::tree::error_handler< char > h; + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::parse< char > ( + u, h, p, f)); + + h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > (); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::std::string& u, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0, + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0); + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::parse< char > ( + u, h, p, f)); + + if (!d.get ()) + throw ::xsd::cxx::tree::parsing< char > (); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::std::string& u, + ::xercesc::DOMErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::parse< char > ( + u, h, p, f)); + + if (!d.get ()) + throw ::xsd::cxx::tree::parsing< char > (); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0, + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0); + + ::xsd::cxx::xml::sax::std_input_source isrc (is); + return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, f, p); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0, + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0); + + ::xsd::cxx::xml::sax::std_input_source isrc (is); + return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + ::xercesc::DOMErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::sax::std_input_source isrc (is); + return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + const ::std::string& sid, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0, + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0); + + ::xsd::cxx::xml::sax::std_input_source isrc (is, sid); + return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, f, p); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + const ::std::string& sid, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0, + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0); + + ::xsd::cxx::xml::sax::std_input_source isrc (is, sid); + return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + const ::std::string& sid, + ::xercesc::DOMErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::xml::sax::std_input_source isrc (is, sid); + return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::xercesc::InputSource& i, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::xsd::cxx::tree::error_handler< char > h; + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::parse< char > ( + i, h, p, f)); + + h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > (); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::xercesc::InputSource& i, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::parse< char > ( + i, h, p, f)); + + if (!d.get ()) + throw ::xsd::cxx::tree::parsing< char > (); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::xercesc::InputSource& i, + ::xercesc::DOMErrorHandler& h, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::parse< char > ( + i, h, p, f)); + + if (!d.get ()) + throw ::xsd::cxx::tree::parsing< char > (); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::xercesc::DOMDocument& doc, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p) + { + if (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + static_cast< ::xercesc::DOMDocument* > (doc.cloneNode (true))); + + return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > ( + ::LinphonePrivate::Xsd::IsComposing::parseIsComposing ( + std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p)); + } + + const ::xercesc::DOMElement& e (*doc.getDocumentElement ()); + const ::xsd::cxx::xml::qualified_name< char > n ( + ::xsd::cxx::xml::dom::name< char > (e)); + + if (n.name () == "isComposing" && + n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > r ( + ::xsd::cxx::tree::traits< ::LinphonePrivate::Xsd::IsComposing::IsComposing, char >::create ( + e, f, 0)); + return r; + } + + throw ::xsd::cxx::tree::unexpected_element < char > ( + n.name (), + n.namespace_ (), + "isComposing", + "urn:ietf:params:xml:ns:im-iscomposing"); + } + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d, + ::LinphonePrivate::Xsd::XmlSchema::Flags f, + const ::LinphonePrivate::Xsd::XmlSchema::Properties&) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > c ( + ((f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) && + !(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom)) + ? static_cast< ::xercesc::DOMDocument* > (d->cloneNode (true)) + : 0); + + ::xercesc::DOMDocument& doc (c.get () ? *c : *d); + const ::xercesc::DOMElement& e (*doc.getDocumentElement ()); + + const ::xsd::cxx::xml::qualified_name< char > n ( + ::xsd::cxx::xml::dom::name< char > (e)); + + if (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) + doc.setUserData (::LinphonePrivate::Xsd::XmlSchema::dom::treeNodeKey, + (c.get () ? &c : &d), + 0); + + if (n.name () == "isComposing" && + n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > r ( + ::xsd::cxx::tree::traits< ::LinphonePrivate::Xsd::IsComposing::IsComposing, char >::create ( + e, f, 0)); + return r; + } + + throw ::xsd::cxx::tree::unexpected_element < char > ( + n.name (), + n.namespace_ (), + "isComposing", + "urn:ietf:params:xml:ns:im-iscomposing"); + } + } + } +} + +#include +#include +#include + +#include + +namespace _xsd +{ + static + const ::xsd::cxx::tree::type_serializer_plate< 0, char > + type_serializer_plate_init; +} + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + void + serializeIsComposing (::std::ostream& o, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + const ::std::string& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0); + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f)); + + ::xsd::cxx::tree::error_handler< char > h; + + ::xsd::cxx::xml::dom::ostream_format_target t (o); + if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f)) + { + h.throw_if_failed< ::xsd::cxx::tree::serialization< char > > (); + } + } + + void + serializeIsComposing (::std::ostream& o, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + const ::std::string& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::xsd::cxx::xml::auto_initializer i ( + (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0); + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f)); + ::xsd::cxx::xml::dom::ostream_format_target t (o); + if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f)) + { + throw ::xsd::cxx::tree::serialization< char > (); + } + } + + void + serializeIsComposing (::std::ostream& o, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + ::xercesc::DOMErrorHandler& h, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + const ::std::string& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f)); + ::xsd::cxx::xml::dom::ostream_format_target t (o); + if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f)) + { + throw ::xsd::cxx::tree::serialization< char > (); + } + } + + void + serializeIsComposing (::xercesc::XMLFormatTarget& t, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + const ::std::string& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f)); + + ::xsd::cxx::tree::error_handler< char > h; + + if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f)) + { + h.throw_if_failed< ::xsd::cxx::tree::serialization< char > > (); + } + } + + void + serializeIsComposing (::xercesc::XMLFormatTarget& t, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + const ::std::string& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f)); + if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f)) + { + throw ::xsd::cxx::tree::serialization< char > (); + } + } + + void + serializeIsComposing (::xercesc::XMLFormatTarget& t, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + ::xercesc::DOMErrorHandler& h, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + const ::std::string& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f)); + if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f)) + { + throw ::xsd::cxx::tree::serialization< char > (); + } + } + + void + serializeIsComposing (::xercesc::DOMDocument& d, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + ::LinphonePrivate::Xsd::XmlSchema::Flags) + { + ::xercesc::DOMElement& e (*d.getDocumentElement ()); + const ::xsd::cxx::xml::qualified_name< char > n ( + ::xsd::cxx::xml::dom::name< char > (e)); + + if (n.name () == "isComposing" && + n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing") + { + e << s; + } + else + { + throw ::xsd::cxx::tree::unexpected_element < char > ( + n.name (), + n.namespace_ (), + "isComposing", + "urn:ietf:params:xml:ns:im-iscomposing"); + } + } + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > + serializeIsComposing (const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m, + ::LinphonePrivate::Xsd::XmlSchema::Flags f) + { + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d ( + ::xsd::cxx::xml::dom::serialize< char > ( + "isComposing", + "urn:ietf:params:xml:ns:im-iscomposing", + m, f)); + + ::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (*d, s, f); + return d; + } + + void + operator<< (::xercesc::DOMElement& e, const IsComposing& i) + { + e << static_cast< const ::LinphonePrivate::Xsd::XmlSchema::Type& > (i); + + // state + // + { + ::xercesc::DOMElement& s ( + ::xsd::cxx::xml::dom::create_element ( + "state", + "urn:ietf:params:xml:ns:im-iscomposing", + e)); + + s << i.getState (); + } + + // lastactive + // + if (i.getLastactive ()) + { + ::xercesc::DOMElement& s ( + ::xsd::cxx::xml::dom::create_element ( + "lastactive", + "urn:ietf:params:xml:ns:im-iscomposing", + e)); + + s << *i.getLastactive (); + } + + // contenttype + // + if (i.getContenttype ()) + { + ::xercesc::DOMElement& s ( + ::xsd::cxx::xml::dom::create_element ( + "contenttype", + "urn:ietf:params:xml:ns:im-iscomposing", + e)); + + s << *i.getContenttype (); + } + + // refresh + // + if (i.getRefresh ()) + { + ::xercesc::DOMElement& s ( + ::xsd::cxx::xml::dom::create_element ( + "refresh", + "urn:ietf:params:xml:ns:im-iscomposing", + e)); + + s << *i.getRefresh (); + } + + // any + // + for (IsComposing::AnyConstIterator + b (i.getAny ().begin ()), n (i.getAny ().end ()); + b != n; ++b) + { + e.appendChild ( + e.getOwnerDocument ()->importNode ( + const_cast< ::xercesc::DOMElement* > (&(*b)), true)); + } + } + } + } +} + +#include + +// Begin epilogue. +// +#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) + #pragma GCC diagnostic pop +#endif +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif +// +// End epilogue. + diff --git a/src/xml/is-composing.h b/src/xml/is-composing.h new file mode 100644 index 000000000..1d7025245 --- /dev/null +++ b/src/xml/is-composing.h @@ -0,0 +1,678 @@ +// Copyright (c) 2005-2014 Code Synthesis Tools CC +// +// This program was generated by CodeSynthesis XSD, an XML Schema to +// C++ data binding compiler. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// +// In addition, as a special exception, Code Synthesis Tools CC gives +// permission to link this program with the Xerces-C++ library (or with +// modified versions of Xerces-C++ that use the same license as Xerces-C++), +// and distribute linked combinations including the two. You must obey +// the GNU General Public License version 2 in all respects for all of +// the code used other than Xerces-C++. If you modify this copy of the +// program, you may extend this exception to your version of the program, +// but you are not obligated to do so. If you do not wish to do so, delete +// this exception statement from your version. +// +// Furthermore, Code Synthesis Tools CC makes a special exception for +// the Free/Libre and Open Source Software (FLOSS) which is described +// in the accompanying FLOSSE file. +// + +#ifndef XML_IS_COMPOSING_H +#define XML_IS_COMPOSING_H + +#ifndef XSD_CXX11 +#define XSD_CXX11 +#endif + +#ifndef XSD_USE_CHAR +#define XSD_USE_CHAR +#endif + +#ifndef XSD_CXX_TREE_USE_CHAR +#define XSD_CXX_TREE_USE_CHAR +#endif + +// Begin prologue. +// +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wfloat-equal" +#endif +#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-override" +#endif +// +// End prologue. + +#include + +#if (XSD_INT_VERSION != 4000000L) +#error XSD runtime version mismatch +#endif + +#include + +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace XmlSchema + { + // anyType and anySimpleType. + // + typedef ::xsd::cxx::tree::type Type; + typedef ::xsd::cxx::tree::simple_type< char, Type > SimpleType; + typedef ::xsd::cxx::tree::type Container; + + // 8-bit + // + typedef signed char Byte; + typedef unsigned char UnsignedByte; + + // 16-bit + // + typedef short Short; + typedef unsigned short UnsignedShort; + + // 32-bit + // + typedef int Int; + typedef unsigned int UnsignedInt; + + // 64-bit + // + typedef long long Long; + typedef unsigned long long UnsignedLong; + + // Supposed to be arbitrary-length integral types. + // + typedef long long Integer; + typedef long long NonPositiveInteger; + typedef unsigned long long NonNegativeInteger; + typedef unsigned long long PositiveInteger; + typedef long long NegativeInteger; + + // Boolean. + // + typedef bool Boolean; + + // Floating-point types. + // + typedef float Float; + typedef double Double; + typedef double Decimal; + + // String types. + // + typedef ::xsd::cxx::tree::string< char, SimpleType > String; + typedef ::xsd::cxx::tree::normalized_string< char, String > NormalizedString; + typedef ::xsd::cxx::tree::token< char, NormalizedString > Token; + typedef ::xsd::cxx::tree::name< char, Token > Name; + typedef ::xsd::cxx::tree::nmtoken< char, Token > Nmtoken; + typedef ::xsd::cxx::tree::nmtokens< char, SimpleType, Nmtoken > Nmtokens; + typedef ::xsd::cxx::tree::ncname< char, Name > Ncname; + typedef ::xsd::cxx::tree::language< char, Token > Language; + + // ID/IDREF. + // + typedef ::xsd::cxx::tree::id< char, Ncname > Id; + typedef ::xsd::cxx::tree::idref< char, Ncname, Type > Idref; + typedef ::xsd::cxx::tree::idrefs< char, SimpleType, Idref > Idrefs; + + // URI. + // + typedef ::xsd::cxx::tree::uri< char, SimpleType > Uri; + + // Qualified name. + // + typedef ::xsd::cxx::tree::qname< char, SimpleType, Uri, Ncname > Qname; + + // Binary. + // + typedef ::xsd::cxx::tree::buffer< char > Buffer; + typedef ::xsd::cxx::tree::base64_binary< char, SimpleType > Base64Binary; + typedef ::xsd::cxx::tree::hex_binary< char, SimpleType > HexBinary; + + // Date/time. + // + typedef ::xsd::cxx::tree::time_zone TimeZone; + typedef ::xsd::cxx::tree::date< char, SimpleType > Date; + typedef ::xsd::cxx::tree::date_time< char, SimpleType > DateTime; + typedef ::xsd::cxx::tree::duration< char, SimpleType > Duration; + typedef ::xsd::cxx::tree::gday< char, SimpleType > Gday; + typedef ::xsd::cxx::tree::gmonth< char, SimpleType > Gmonth; + typedef ::xsd::cxx::tree::gmonth_day< char, SimpleType > GmonthDay; + typedef ::xsd::cxx::tree::gyear< char, SimpleType > Gyear; + typedef ::xsd::cxx::tree::gyear_month< char, SimpleType > GyearMonth; + typedef ::xsd::cxx::tree::time< char, SimpleType > Time; + + // Entity. + // + typedef ::xsd::cxx::tree::entity< char, Ncname > Entity; + typedef ::xsd::cxx::tree::entities< char, SimpleType, Entity > Entities; + + typedef ::xsd::cxx::tree::content_order ContentOrder; + // Namespace information and list stream. Used in + // serialization functions. + // + typedef ::xsd::cxx::xml::dom::namespace_info< char > NamespaceInfo; + typedef ::xsd::cxx::xml::dom::namespace_infomap< char > NamespaceInfomap; + typedef ::xsd::cxx::tree::list_stream< char > ListStream; + typedef ::xsd::cxx::tree::as_double< Double > AsDouble; + typedef ::xsd::cxx::tree::as_decimal< Decimal > AsDecimal; + typedef ::xsd::cxx::tree::facet Facet; + + // Flags and properties. + // + typedef ::xsd::cxx::tree::flags Flags; + typedef ::xsd::cxx::tree::properties< char > Properties; + + // Parsing/serialization diagnostics. + // + typedef ::xsd::cxx::tree::severity Severity; + typedef ::xsd::cxx::tree::error< char > Error; + typedef ::xsd::cxx::tree::diagnostics< char > Diagnostics; + + // Exceptions. + // + typedef ::xsd::cxx::tree::exception< char > Exception; + typedef ::xsd::cxx::tree::bounds< char > Bounds; + typedef ::xsd::cxx::tree::duplicate_id< char > DuplicateId; + typedef ::xsd::cxx::tree::parsing< char > Parsing; + typedef ::xsd::cxx::tree::expected_element< char > ExpectedElement; + typedef ::xsd::cxx::tree::unexpected_element< char > UnexpectedElement; + typedef ::xsd::cxx::tree::expected_attribute< char > ExpectedAttribute; + typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator; + typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent; + typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping; + typedef ::xsd::cxx::tree::no_type_info< char > NoTypeInfo; + typedef ::xsd::cxx::tree::not_derived< char > NotDerived; + typedef ::xsd::cxx::tree::serialization< char > Serialization; + + // Error handler callback interface. + // + typedef ::xsd::cxx::xml::error_handler< char > ErrorHandler; + + // DOM interaction. + // + namespace dom + { + // Automatic pointer for DOMDocument. + // + using ::xsd::cxx::xml::dom::unique_ptr; + +#ifndef XSD_CXX_TREE_TREE_NODE_KEY__LINPHONEPRIVATE__XSD__XMLSCHEMA +#define XSD_CXX_TREE_TREE_NODE_KEY__LINPHONEPRIVATE__XSD__XMLSCHEMA + // DOM user data key for back pointers to tree nodes. + // + const XMLCh* const treeNodeKey = ::xsd::cxx::tree::user_data_keys::node; +#endif + } + } + } +} + +// Forward declarations. +// +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + class IsComposing; + } + } +} + + +#include // ::std::unique_ptr +#include // std::numeric_limits +#include // std::binary_search +#include // std::move + +#include + +#include +#include +#include +#include + +#include + +#include + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + class IsComposing: public ::LinphonePrivate::Xsd::XmlSchema::Type + { + public: + // state + // + typedef ::LinphonePrivate::Xsd::XmlSchema::String StateType; + typedef ::xsd::cxx::tree::traits< StateType, char > StateTraits; + + const StateType& + getState () const; + + StateType& + getState (); + + void + setState (const StateType& x); + + void + setState (::std::unique_ptr< StateType > p); + + ::std::unique_ptr< StateType > + setDetachState (); + + // lastactive + // + typedef ::LinphonePrivate::Xsd::XmlSchema::DateTime LastactiveType; + typedef ::xsd::cxx::tree::optional< LastactiveType > LastactiveOptional; + typedef ::xsd::cxx::tree::traits< LastactiveType, char > LastactiveTraits; + + const LastactiveOptional& + getLastactive () const; + + LastactiveOptional& + getLastactive (); + + void + setLastactive (const LastactiveType& x); + + void + setLastactive (const LastactiveOptional& x); + + void + setLastactive (::std::unique_ptr< LastactiveType > p); + + // contenttype + // + typedef ::LinphonePrivate::Xsd::XmlSchema::String ContenttypeType; + typedef ::xsd::cxx::tree::optional< ContenttypeType > ContenttypeOptional; + typedef ::xsd::cxx::tree::traits< ContenttypeType, char > ContenttypeTraits; + + const ContenttypeOptional& + getContenttype () const; + + ContenttypeOptional& + getContenttype (); + + void + setContenttype (const ContenttypeType& x); + + void + setContenttype (const ContenttypeOptional& x); + + void + setContenttype (::std::unique_ptr< ContenttypeType > p); + + // refresh + // + typedef ::LinphonePrivate::Xsd::XmlSchema::PositiveInteger RefreshType; + typedef ::xsd::cxx::tree::optional< RefreshType > RefreshOptional; + typedef ::xsd::cxx::tree::traits< RefreshType, char > RefreshTraits; + + const RefreshOptional& + getRefresh () const; + + RefreshOptional& + getRefresh (); + + void + setRefresh (const RefreshType& x); + + void + setRefresh (const RefreshOptional& x); + + // any + // + typedef ::xsd::cxx::tree::element_sequence AnySequence; + typedef AnySequence::iterator AnyIterator; + typedef AnySequence::const_iterator AnyConstIterator; + + const AnySequence& + getAny () const; + + AnySequence& + getAny (); + + void + setAny (const AnySequence& s); + + // DOMDocument for wildcard content. + // + const ::xercesc::DOMDocument& + getDomDocument () const; + + ::xercesc::DOMDocument& + getDomDocument (); + + // Constructors. + // + IsComposing (const StateType&); + + IsComposing (const ::xercesc::DOMElement& e, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + ::LinphonePrivate::Xsd::XmlSchema::Container* c = 0); + + IsComposing (const IsComposing& x, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + ::LinphonePrivate::Xsd::XmlSchema::Container* c = 0); + + virtual IsComposing* + _clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + ::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const; + + IsComposing& + operator= (const IsComposing& x); + + virtual + ~IsComposing (); + + // Implementation. + // + protected: + void + parse (::xsd::cxx::xml::dom::parser< char >&, + ::LinphonePrivate::Xsd::XmlSchema::Flags); + + protected: + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > dom_document_; + + ::xsd::cxx::tree::one< StateType > state_; + LastactiveOptional lastactive_; + ContenttypeOptional contenttype_; + RefreshOptional refresh_; + AnySequence any_; + }; + } + } +} + +#include + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + ::std::ostream& + operator<< (::std::ostream&, const IsComposing&); + } + } +} + +#include + +#include +#include +#include + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + // Parse a URI or a local file. + // + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::std::string& uri, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::std::string& uri, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::std::string& uri, + ::xercesc::DOMErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + // Parse std::istream. + // + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + ::xercesc::DOMErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + const ::std::string& id, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + const ::std::string& id, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::std::istream& is, + const ::std::string& id, + ::xercesc::DOMErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + // Parse xercesc::InputSource. + // + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::xercesc::InputSource& is, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::xercesc::InputSource& is, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::xercesc::InputSource& is, + ::xercesc::DOMErrorHandler& eh, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + // Parse xercesc::DOMDocument. + // + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (const ::xercesc::DOMDocument& d, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + + ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > + parseIsComposing (::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0, + const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ()); + } + } +} + +#include + +#include +#include +#include + +#include + +namespace LinphonePrivate +{ + namespace Xsd + { + namespace IsComposing + { + // Serialize to std::ostream. + // + + void + serializeIsComposing (::std::ostream& os, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + const ::std::string& e = "UTF-8", + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + void + serializeIsComposing (::std::ostream& os, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + const ::std::string& e = "UTF-8", + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + void + serializeIsComposing (::std::ostream& os, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + ::xercesc::DOMErrorHandler& eh, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + const ::std::string& e = "UTF-8", + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + // Serialize to xercesc::XMLFormatTarget. + // + + void + serializeIsComposing (::xercesc::XMLFormatTarget& ft, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + const ::std::string& e = "UTF-8", + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + void + serializeIsComposing (::xercesc::XMLFormatTarget& ft, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + ::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + const ::std::string& e = "UTF-8", + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + void + serializeIsComposing (::xercesc::XMLFormatTarget& ft, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + ::xercesc::DOMErrorHandler& eh, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + const ::std::string& e = "UTF-8", + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + // Serialize to an existing xercesc::DOMDocument. + // + + void + serializeIsComposing (::xercesc::DOMDocument& d, + const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + // Serialize to a new xercesc::DOMDocument. + // + + ::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > + serializeIsComposing (const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x, + const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (), + ::LinphonePrivate::Xsd::XmlSchema::Flags f = 0); + + void + operator<< (::xercesc::DOMElement&, const IsComposing&); + } + } +} + +#include + +// Begin epilogue. +// +#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) + #pragma GCC diagnostic pop +#endif +#if __clang__ || __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif +// +// End epilogue. + +#endif // XML_IS_COMPOSING_H diff --git a/src/xml/is-composing.xsd b/src/xml/is-composing.xsd new file mode 100644 index 000000000..7cf4a8b70 --- /dev/null +++ b/src/xml/is-composing.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + +