From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/xml/qualified-name.hxx | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 libxsd/xsd/cxx/xml/qualified-name.hxx (limited to 'libxsd/xsd/cxx/xml/qualified-name.hxx') diff --git a/libxsd/xsd/cxx/xml/qualified-name.hxx b/libxsd/xsd/cxx/xml/qualified-name.hxx new file mode 100644 index 0000000..4c4dcd4 --- /dev/null +++ b/libxsd/xsd/cxx/xml/qualified-name.hxx @@ -0,0 +1,84 @@ +// file : xsd/cxx/xml/qualified-name.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_XML_QUALIFIED_NAME_HXX +#define XSD_CXX_XML_QUALIFIED_NAME_HXX + +#include + +namespace xsd +{ + namespace cxx + { + namespace xml + { + template + struct qualified_name + { + qualified_name (const C* name, + const C* namespace_) + : name_ (name), namespace__ (namespace_) + { + } + + qualified_name (const std::basic_string& name, + const std::basic_string& namespace_) + : name_ (name), namespace__ (namespace_) + { + } + + qualified_name (const C* name) + : name_ (name) + { + } + + qualified_name (const std::basic_string& name) + : name_ (name) + { + } + + const std::basic_string& + name () const + { + return name_; + } + + const std::basic_string& + namespace_ () const + { + return namespace__; + } + + private: + std::basic_string name_; + std::basic_string namespace__; + }; + + template + inline bool + operator== (const qualified_name& x, const qualified_name& y) + { + return x.name () == y.name () && x.namespace_ () == y.namespace_ (); + } + + template + inline bool + operator!= (const qualified_name& x, const qualified_name& y) + { + return !(x == y); + } + + template + inline bool + operator< (const qualified_name& x, const qualified_name& y) + { + int r (x.name ().compare (y.name ())); + return (r < 0) || (r == 0 && x.namespace_ () < y.namespace_ ()); + } + } + } +} + +#endif // XSD_CXX_XML_QUALIFIED_NAME_HXX -- cgit v1.1