diff options
author | bala <balanatarajan@users.noreply.github.com> | 2005-01-18 21:23:52 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2005-01-18 21:23:52 +0000 |
commit | de24e0221ba73d4ca0c1e00786394760ea6c370b (patch) | |
tree | dd83051a9e62c7c3f40a98a7a5a0cb530bf752b1 | |
parent | e43d41599ab7fa3f72fcd0fb223b0929ae554485 (diff) | |
download | ATCD-de24e0221ba73d4ca0c1e00786394760ea6c370b.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.hpp | 614 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.ipp | 7 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.tpp | 7 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.hpp | 182 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.ipp | 130 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.hpp | 521 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.ipp | 222 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.tpp | 7 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.hpp | 275 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.ipp | 7 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.tpp | 195 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Writer.hpp | 81 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.hpp | 740 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.ipp | 103 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.tpp | 8 |
15 files changed, 0 insertions, 3099 deletions
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.hpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.hpp deleted file mode 100644 index e8727e00afb..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.hpp +++ /dev/null @@ -1,614 +0,0 @@ -// file : XSCRT/Elements.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef XSCRT_ELEMENTS_HPP -#define XSCRT_ELEMENTS_HPP - -#include <map> -#include <string> -#include <sstream> -// #include <iostream> //@@ tmp - -#include <XSCRT/Parser.hpp> - -#if defined (_MSC_VER) && (_MSC_VER < 1300) - -// Stuff for broken VC6. Don't like what you see - use better compiler! -// - -inline -std::wistream& -operator>> (std::wistream& is, __int64& v) -{ - long t; - is >> t; - v = t; - return is; -} - -inline -std::wistream& -operator>> (std::wistream& is, unsigned __int64& v) -{ - unsigned long t; - is >> t; - v = t; - return is; -} - -inline -std::wostream& -operator<< (std::wostream& os, __int64 const& v) -{ - os << long (v); - return os; -} - -inline -std::wostream& -operator<< (std::wostream& os, unsigned __int64 const& v) -{ - os << unsigned long (v); - return os; -} - -#endif - -namespace XSCRT -{ - struct IdentityProvider - { - virtual bool - before (IdentityProvider const&) const = 0; - }; - - class Type - { - public: - virtual - ~Type () - { - } - - protected: - Type () - : container_ (0) - { - } - - template <typename C> - Type (XML::Element<C> const&) - : container_ (0) - { - } - - template <typename C> - Type (XML::Attribute<C> const&) - : container_ (0) - { - } - - Type (Type const&) - : container_ (0) - { - } - - Type& - operator= (Type const&) - { - //@@ I don't need this. - //if (map_.get ()) map_->clear (); // Flush the map. - return *this; - } - - public: - Type const* - container () const - { - return container_ ? container_ : this; - } - - Type* - container () - { - return container_ ? container_ : this; - } - - - Type const* - root () const - { - Type const* r = container (); - - //@@ VC6 can't handle this inside the loop. - // - Type const* c = r->container (); - - for (; c != r; c = c->container ()) r = c; - - return r; - } - - Type* - root () - { - Type* r = container (); - - for (Type* c = r->container (); c != r; c = c->container ()) r = c; - - return r; - } - - //@@ - //protected: - - public: - virtual void - container (Type* c) - { - if (container_ == c) return; - - // Revoke registrations from our old container. - // - if (container_ != 0 && map_.get ()) - { - for (Map_::iterator i (map_->begin ()); i != map_->end (); ++i) - { - //std::wcerr << "revoking " << i->second - // << " to " << container_ << std::endl; - - container_->unregister_id (*(i->first)); - } - } - - // Copy registrations to our new container. - // - if (c != 0 && map_.get ()) - { - for (Map_::iterator i (map_->begin ()); i != map_->end (); ++i) - { - //std::wcerr << "copying " << i->second - // << " to " << c << std::endl; - - c->register_id (*(i->first), i->second); - } - } - - container_ = c; - } - - //@@ - //protected: - - public: - void - register_id (IdentityProvider const& id, Type* t) - { - if (map_.get () == 0) - { - map_ = std::auto_ptr<Map_> (new Map_); - } - - if (!map_->insert ( - std::pair<IdentityProvider const*, Type*> (&id, t)).second) - { - throw 1; - } - - if (container () != this) container ()->register_id (id, t); - } - - void - unregister_id (IdentityProvider const& id) - { - if (map_.get ()) - { - Map_::iterator it (map_->find (&id)); - - if (it != map_->end ()) - { - map_->erase (it); - - if (container () != this) container ()->unregister_id (id); - - return; - } - } - - throw 1; - } - - Type* - lookup_id (IdentityProvider const& id) const - { - if (map_.get ()) - { - Map_::const_iterator it (map_->find (&id)); - - if (it != map_->end ()) - { - return it->second; - } - } - - return 0; - } - - - private: - Type* container_; - - struct IdentityComparator - { - bool operator () (IdentityProvider const* x, - IdentityProvider const* y) const - { - return x->before (*y); - } - }; - - typedef - std::map<IdentityProvider const*, Type*, IdentityComparator> - Map_; - - std::auto_ptr<Map_> map_; - }; - - // Fundamental types template. - // - // - template <typename X> - class FundamentalType : public Type - { - public: - FundamentalType () - { - } - - template<typename C> - FundamentalType (XML::Element<C> const& e) - { - std::basic_stringstream<C> s; - s << e.value (); - s >> x_; - } - - template<typename C> - FundamentalType (XML::Attribute<C> const& a) - { - std::basic_stringstream<C> s; - s << a.value (); - s >> x_; - } - - FundamentalType (X const& x) - : x_ (x) - { - } - - FundamentalType& - operator= (X const& x) - { - x_ = x; - return *this; - } - - public: - operator X const& () const - { - return x_; - } - - operator X& () - { - return x_; - } - - protected: - X x_; - }; - -#if (!defined (_MSC_VER) || (_MSC_VER >= 1300)) && \ - (__GNUC__ > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ > 2))) - - - // Stuff for normal compilers. - // - - // Specialization for `signed char' - // - // - template<> - template<typename C> - inline - FundamentalType<signed char>:: - FundamentalType (XML::Element<C> const& e) - { - std::basic_stringstream<C> s; - s << e.value (); - - short t; - s >> t; - - x_ = static_cast<signed char> (t); - } - - template<> - template<typename C> - inline - FundamentalType<signed char>:: - FundamentalType (XML::Attribute<C> const& a) - { - std::basic_stringstream<C> s; - s << a.value (); - - short t; - s >> t; - - x_ = static_cast<signed char> (t); - } - - // Specialization for `unsigned char' - // - // - template<> - template<typename C> - inline - FundamentalType<unsigned char>:: - FundamentalType (XML::Element<C> const& e) - { - std::basic_stringstream<C> s; - s << e.value (); - - unsigned short t; - s >> t; - - x_ = static_cast<unsigned char> (t); - } - - template<> - template<typename C> - inline - FundamentalType<unsigned char>:: - FundamentalType (XML::Attribute<C> const& a) - { - std::basic_stringstream<C> s; - s << a.value (); - - unsigned short t; - s >> t; - - x_ = static_cast<unsigned char> (t); - } - -#else - - // Stuff for broken VC6 & gcc < 3.3. Don't like what you see - use better - // compiler! - // - - // Specialization for signed char. - // - template <> - class FundamentalType<signed char> : public Type - { - public: - FundamentalType () - { - } - - template<typename C> - FundamentalType (XML::Element<C> const& e) - { - std::basic_stringstream<C> s; - s << e.value (); - - short t; - s >> t; - - x_ = static_cast<signed char> (t); - } - - template<typename C> - FundamentalType (XML::Attribute<C> const& a) - { - std::basic_stringstream<C> s; - s << a.value (); - - short t; - s >> t; - - x_ = static_cast<signed char> (t); - } - - FundamentalType (signed char const& x) - : x_ (x) - { - } - - FundamentalType& - operator= (signed char const& x) - { - x_ = x; - return *this; - } - - public: - operator signed char const& () const - { - return x_; - } - - operator signed char& () - { - return x_; - } - - protected: - signed char x_; - }; - - // Specialization for unsigned char. - // - template <> - class FundamentalType<unsigned char> : public Type - { - public: - FundamentalType () - { - } - - template<typename C> - FundamentalType (XML::Element<C> const& e) - { - std::basic_stringstream<C> s; - s << e.value (); - - unsigned short t; - s >> t; - - x_ = static_cast<unsigned char> (t); - } - - template<typename C> - FundamentalType (XML::Attribute<C> const& a) - { - std::basic_stringstream<C> s; - s << a.value (); - - unsigned short t; - s >> t; - - x_ = static_cast<unsigned char> (t); - } - - FundamentalType (unsigned char const& x) - : x_ (x) - { - } - - FundamentalType& - operator= (unsigned char const& x) - { - x_ = x; - return *this; - } - - public: - operator unsigned char const& () const - { - return x_; - } - - operator unsigned char& () - { - return x_; - } - - protected: - unsigned char x_; - }; - -#endif - - - // Specialization for bool. - // - // - -#if !defined (_MSC_VER) || (_MSC_VER >= 1300) - - template<> - template<> - inline - FundamentalType<bool>:: - FundamentalType (XML::Element<char> const& e) - { - x_ = (e.value () == "true") || (e.value () == "1"); - } - - template<> - template<> - inline - FundamentalType<bool>:: - FundamentalType (XML::Element<wchar_t> const& e) - { - x_ = (e.value () == L"true") || (e.value () == L"1"); - } - - template<> - template<> - inline - FundamentalType<bool>:: - FundamentalType (XML::Attribute<char> const& a) - { - x_ = (a.value () == "true") || (a.value () == "1"); - } - - template<> - template<> - inline - FundamentalType<bool>:: - FundamentalType (XML::Attribute<wchar_t> const& a) - { - x_ = (a.value () == L"true") || (a.value () == L"1"); - } - -#else - - template <> - class FundamentalType<bool> : public Type - { - public: - FundamentalType () - { - } - - template<typename C> - FundamentalType (XML::Element<C> const& e) - { - x_ = (e.value ()[0] == 't') || (e.value ()[0] == '1'); - } - - template<typename C> - FundamentalType (XML::Attribute<C> const& a) - { - x_ = (a.value ()[0] == 't') || (a.value ()[0] == '1'); - } - - FundamentalType (bool const& x) - : x_ (x) - { - } - - FundamentalType& - operator= (bool const& x) - { - x_ = x; - return *this; - } - - public: - operator bool const& () const - { - return x_; - } - - operator bool& () - { - return x_; - } - - protected: - bool x_; - }; - -#endif - -} - -#include <XSCRT/Elements.ipp> -#include <XSCRT/Elements.tpp> - -#endif // XSCRT_ELEMENTS_HPP diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.ipp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.ipp deleted file mode 100644 index 414f03eb031..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.ipp +++ /dev/null @@ -1,7 +0,0 @@ -// file : XSC/Elements.ipp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSC -{ -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.tpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.tpp deleted file mode 100644 index 7539a36d75f..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Elements.tpp +++ /dev/null @@ -1,7 +0,0 @@ -// file : XSC/Elements.tpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSC -{ -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.hpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.hpp deleted file mode 100644 index 51f1930eea9..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.hpp +++ /dev/null @@ -1,182 +0,0 @@ -// file : XSCRT/ExtendedTypeInfo.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef XSCRT_EXTENDED_TYPE_INFO_HPP -#define XSCRT_EXTENDED_TYPE_INFO_HPP - -#include <map> -#include <vector> -#include <typeinfo> - -namespace XSCRT -{ - // - // - // - class TypeId - { - public: - template<typename T> - TypeId (T const& t); - - TypeId (std::type_info const& tid); - - public: - bool - operator == (TypeId const& other) const; - - bool - operator != (TypeId const& other) const; - - bool - operator < (TypeId const& other) const; - - /* - friend std::ostream& - operator << (std::ostream& os, TypeId const& t); - */ - - public: - char const* - name () const - { - return tid_->name (); - } - - private: - std::type_info const* tid_; - }; - - - // - // - // - class ExtendedTypeInfo - { - public: - - // - // - // - struct Access - { - enum Value - { - private_, - protected_, - public_ - }; - }; - - - // - // - // - class BaseInfo - { - public: - BaseInfo (Access::Value access, bool virtual_base, TypeId const& tid); - - public: - ExtendedTypeInfo const& - type_info () const; - - Access::Value - access () const; - - bool - virtual_base () const; - - private: - TypeId tid_; - mutable ExtendedTypeInfo const* ti_; - bool virtual_base_; - Access::Value access_; - }; - - private: - typedef - std::vector<BaseInfo> - BaseInfoList; - - public: - typedef - BaseInfoList::const_iterator - BaseIterator; - - public: - ExtendedTypeInfo (TypeId const& tid); - - TypeId - type_id () const; - - BaseIterator - begin_base () const; - - BaseIterator - end_base () const; - - void - add_base (Access::Value access, bool virtual_base, TypeId const& tid); - - private: - TypeId tid_; - BaseInfoList base_; - }; - - typedef - std::map<TypeId, ExtendedTypeInfo> - ExtendedTypeInfoMap; - - - ExtendedTypeInfoMap& - extended_type_info_map (); - - - class NotAvailable {}; - - - template<typename T> - ExtendedTypeInfo const& - extended_type_info (T const& t) - { - return extended_type_info (typeid (t)); - } - - template<typename T> - ExtendedTypeInfo const& - extended_type_info () - { - return extended_type_info (typeid (T)); - } - - //@@ Had to use function template specialization because VC6 - // cannot handle simply overloaded functions. - // - - template <> - inline - ExtendedTypeInfo const& - extended_type_info<TypeId> (TypeId const& tid) - { - ExtendedTypeInfoMap::const_iterator i ( - extended_type_info_map ().find (tid)); - - if (i == extended_type_info_map ().end ()) throw NotAvailable (); - - return i->second; - } - - template <> - inline - ExtendedTypeInfo const& - extended_type_info<std::type_info> (std::type_info const& tid) - { - return extended_type_info (TypeId (tid)); - } -} - -#include <XSCRT/ExtendedTypeInfo.ipp> - -#endif // XSCRT_EXTENDED_TYPE_INFO_HPP diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.ipp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.ipp deleted file mode 100644 index f94da0ede4d..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/ExtendedTypeInfo.ipp +++ /dev/null @@ -1,130 +0,0 @@ -// file : XSCRT/ExtendedTypeInfo.ipp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSCRT -{ - // TypeId - // - // - inline - TypeId:: - TypeId (std::type_info const& tid) - : tid_ (&tid) - { - } - - - inline - bool TypeId:: - operator == (TypeId const& other) const - { - return *tid_ == *other.tid_; - } - - inline - bool TypeId:: - operator != (TypeId const& other) const - { - return *tid_ != *other.tid_; - } - - inline - bool TypeId:: - operator < (TypeId const& other) const - { - return tid_->before (*other.tid_); - } - - - // ExtendedTypeInfo::BaseInfo - // - // - - inline - ExtendedTypeInfo::BaseInfo:: - BaseInfo (Access::Value access, bool virtual_base, TypeId const& tid) - : tid_ (tid), - ti_ (0), - virtual_base_ (virtual_base), - access_ (access) - { - } - - inline - ExtendedTypeInfo const& ExtendedTypeInfo::BaseInfo:: - type_info () const - { - if (ti_ == 0) ti_ = &(extended_type_info (tid_)); - - return *ti_; - } - - - inline - ExtendedTypeInfo::Access::Value ExtendedTypeInfo::BaseInfo:: - access () const - { - return access_; - } - - inline - bool ExtendedTypeInfo::BaseInfo:: - virtual_base () const - { - return virtual_base_; - } - - - // ExtendedTypeInfo - // - // - inline - ExtendedTypeInfo:: - ExtendedTypeInfo (TypeId const& tid) - : tid_ (tid) - { - } - - inline - TypeId ExtendedTypeInfo:: - type_id () const - { - return tid_; - } - - inline - ExtendedTypeInfo::BaseIterator ExtendedTypeInfo:: - begin_base () const - { - return base_.begin (); - } - - - inline - ExtendedTypeInfo::BaseIterator ExtendedTypeInfo:: - end_base () const - { - return base_.end (); - } - - inline - void ExtendedTypeInfo:: - add_base (Access::Value access, bool virtual_base, TypeId const& tid) - { - base_.push_back (BaseInfo (access, virtual_base, tid)); - } - - // ExtendedTypeInfoMap - // - // - - inline - ExtendedTypeInfoMap& - extended_type_info_map () - { - static ExtendedTypeInfoMap extended_type_info_map_; - - return extended_type_info_map_; - } -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.hpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.hpp deleted file mode 100644 index a5261f64ee3..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.hpp +++ /dev/null @@ -1,521 +0,0 @@ -// file : XSCRT/Parser.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef XSCRT_PARSER_HPP -#define XSCRT_PARSER_HPP - -#include <string> - -#include <xercesc/dom/DOM.hpp> -#include <xercesc/util/XMLString.hpp> - -//@@ tmp -#include <iostream> - - -//@@ VC6 -#if defined (_MSC_VER) && (_MSC_VER < 1300) -namespace std -{ - typedef ::size_t size_t; -} -#endif - -namespace XSCRT -{ - namespace XML - { - //@@ VC6 - // - template <typename C> - std::basic_string<C> - transcode (XMLCh const* s, C*); - - template <> - inline - std::basic_string<char> - transcode<char> (XMLCh const* s, char*) - { - if (s == 0) return std::basic_string<char> (); - - char* buf = xercesc::XMLString::transcode (s); - - std::basic_string<char> r (buf); - - xercesc::XMLString::release (&buf); - - return r; - } - - template <> - inline - std::basic_string<wchar_t> - transcode<wchar_t> (XMLCh const* s, wchar_t*) - { - if (s == 0) return std::basic_string<wchar_t> (); - - // std::wcerr << s << std::endl; - - std::basic_string<wchar_t> r (xercesc::XMLString::stringLen (s), L'0'); - - for (std::size_t i (0); *s != XMLCh (0); ++s, ++i) - { - r[i] = *s; - } - - return r; - } - - template <typename C> - XMLCh* - transcode (std::basic_string<C> const& s); - - template <> - inline - XMLCh* - transcode (std::basic_string<char> const& s) - { - return xercesc::XMLString::transcode (s.c_str ()); - } - - template <> - inline - XMLCh* - transcode (std::basic_string<wchar_t> const& s) - { - //@@ VC6 - std::size_t l = s.length (); - - //@@ VC6 - XMLCh* r = new XMLCh[l + 1]; - XMLCh* ir = r; - - for (std::size_t i (0); i < l; ++ir, ++i) - { - *ir = static_cast<XMLCh>(s[i]); - //std::wcerr << s[i] << "->" << *ir << std::endl; - } - - *ir = XMLCh (0); - - // std::wcerr << r << std::endl; - - return r; - } - - class XStr - { - public : - template <typename C> - XStr (std::basic_string<C> const& s) - : s_ (XSCRT::XML::transcode<C> (s)) - { - } - - template <typename C> - XStr (C const* s) - : s_ (XSCRT::XML::transcode<C> (s)) - { - } - - ~XStr () - { - delete[] s_; - } - - XMLCh const* - c_str () const - { - return s_; - } - - private : - XMLCh* s_; - }; - - template <typename C> - class Element; - - template <typename C> - std::basic_string<C> - ns_prefix (std::basic_string<C> const& ns, Element<C> const& e); - - template <typename C> - class Element - { - typedef std::basic_string<C> string_; - - public: - Element (xercesc::DOMElement const* e) - : e_ (0), - ce_ (e), - name_ (transcode<C> (e->getLocalName (), 0)), - namespace__ (transcode<C> (e->getNamespaceURI (), 0)) - { - } - - Element (xercesc::DOMElement* e) - : e_ (e), - ce_ (e), - name_ (transcode<C> (e->getLocalName (), 0)), - namespace__ (transcode<C> (e->getNamespaceURI (), 0)) - { - } - - Element (string_ const& name, Element& parent) - : e_ (0), - ce_ (0), - name_ (name) - { - xercesc::DOMDocument* doc ( - parent.dom_element ()->getOwnerDocument ()); - - e_ = doc->createElement (XStr (name).c_str ()); - - parent.dom_element ()->appendChild (e_); - - ce_ = e_; - } - - Element (string_ const& name, string_ const& ns, Element& parent) - : e_ (0), - ce_ (0), - name_ (name), - namespace__ (ns) - { - string_ prefix (ns_prefix (ns, parent)); - - xercesc::DOMDocument* doc ( - parent.dom_element ()->getOwnerDocument ()); - - e_ = doc->createElementNS ( - XStr (ns).c_str (), - XStr (prefix.empty () - ? name - : prefix + string_ (1, ':') + name).c_str ()); - - parent.dom_element ()->appendChild (e_); - - ce_ = e_; - } - - public: - string_ - name () const - { - return name_; - } - - string_ - namespace_ () const - { - return namespace__; - } - - public: - Element<C> - parent () const - { - return dynamic_cast<xercesc::DOMElement const*>(ce_->getParentNode ()); - } - - public: - string_ - value () const - { - return XML::transcode<C> (dom_element ()->getTextContent (), 0); - } - - void - value (string_ const& v) - { - xercesc::DOMText* text ( - dom_element ()->getOwnerDocument ()->createTextNode( - XStr (v).c_str ())); - - dom_element ()->appendChild (text); - } - - public: - string_ - operator[] (string_ const& s) const - { - //@@ VC6 - XMLCh* name = transcode (s); - XMLCh const* value = ce_->getAttribute (name); - delete[] name; - - return transcode<C> (value, 0); - } - - public: - xercesc::DOMElement const* - dom_element () const - { - return ce_; - } - - xercesc::DOMElement* - dom_element () - { - return e_; - } - - private: - xercesc::DOMElement* e_; - xercesc::DOMElement const* ce_; - - string_ name_; - string_ namespace__; - }; - - - template <typename C> - class Attribute - { - typedef std::basic_string<C> string_; - - public: - Attribute (xercesc::DOMAttr const* a) - : a_ (0), - ca_ (a), - name_ (transcode<C> (a->getLocalName (), 0)), - value_ (transcode<C> (a->getValue (), 0)) - { - } - - Attribute (xercesc::DOMAttr* a) - : a_ (a), - ca_ (a), - name_ (transcode<C> (a->getLocalName (), 0)), - value_ (transcode<C> (a->getValue (), 0)) - { - } - - Attribute (string_ const& name, - string_ const& v, - Element<C>& parent) - : a_ (0), - ca_ (0), - name_ (name), - value_ () - { - xercesc::DOMDocument* doc ( - parent.dom_element ()->getOwnerDocument ()); - - a_ = doc->createAttribute (XStr (name).c_str ()); - - value (v); - - parent.dom_element ()->setAttributeNode (a_); - - ca_ = a_; - } - - Attribute (string_ const& name, - string_ const& ns, - string_ const& v, - Element<C>& parent) - : a_ (0), - ca_ (0), - name_ (name), - value_ () - { - string_ prefix (ns_prefix (ns, parent)); - - xercesc::DOMDocument* doc ( - parent.dom_element ()->getOwnerDocument ()); - - a_ = doc->createAttributeNS ( - XStr (ns).c_str (), - XStr (prefix.empty () - ? name - : prefix + string_ (1, ':') + name).c_str ()); - - value (v); - - parent.dom_element ()->setAttributeNodeNS (a_); - - ca_ = a_; - } - - string_ - name () const - { - return name_; - } - - string_ - value () const - { - return value_; - } - - void - value (string_ const& v) - { - value_ = v; - a_->setValue (XStr (v).c_str ()); - } - - public: - xercesc::DOMAttr const* - dom_attribute () const - { - return ca_; - } - - xercesc::DOMAttr* - dom_attribute () - { - return a_; - } - - private: - - private: - xercesc::DOMAttr* a_; - xercesc::DOMAttr const* ca_; - - string_ name_; - string_ value_; - }; - - template <typename C> - std::basic_string<C> - prefix (std::basic_string<C> const& n) - { - std::size_t i (0); - while (i < n.length () && n[i] != ':') ++i; - - //std::wcerr << "prefix " << n << " " - // << std::wstring (n, i == n.length () ? i : 0, i) << std::endl; - - return std::basic_string<C> (n, i == n.length () ? i : 0, i); - } - - template <typename C> - std::basic_string<C> - uq_name (std::basic_string<C> const& n) - { - std::size_t i (0); - while (i < n.length () && n[i] != ':') ++i; - - return std::basic_string<C> (n.c_str () + (i == n.length () ? 0 : i + 1)); - } - - template <typename C> - std::basic_string<C> - ns_name (Element<C> const& e, std::basic_string<C> const& n) - { - //@@ VC6 - XMLCh* p = 0; - - std::basic_string<C> wp (prefix (n)); - - if (!wp.empty ()) p = transcode (wp); - - XMLCh const* xns = e.dom_element ()->lookupNamespaceURI (p); - std::basic_string<C> ns ( - xns ? transcode<C> (xns, 0) : std::basic_string<C> ()); - - delete[] p; - return ns; - - } - - template <typename C> - std::basic_string<C> - fq_name (Element<C> const& e, std::basic_string<C> const& n) - { - std::basic_string<C> ns (ns_name (e, n)); - std::basic_string<C> un (uq_name (n)); - - return ns.empty () ? un : (ns + C ('#') + un); - } - - class no_prefix {}; - - template <typename C> - std::basic_string<C> - ns_prefix (std::basic_string<C> const& ns, Element<C> const& e) - { - XStr xns (ns); - - XMLCh const* p ( - e.dom_element ()->lookupNamespacePrefix (xns.c_str (), false)); - - if (p == 0) - { - bool r (e.dom_element ()->isDefaultNamespace (xns.c_str ())); - - if (r) - { - return std::basic_string<C> (); - } - else - { - throw no_prefix (); - } - } - - return transcode<C> (p, 0); - } - } - - template <typename C> - class Parser - { - public: - Parser (XML::Element<C> const& e) - : e_ (e.dom_element ()->getChildNodes ()), ei_ (0), - a_ (e.dom_element ()->getAttributes ()), ai_ (0) - { - } - - bool - more_elements () const - { - return e_->getLength () > ei_; - } - - XML::Element<C> - next_element () - { - return XML::Element<C> ( - dynamic_cast<xercesc::DOMElement*> (e_->item (ei_++))); - } - - bool - more_attributes () const - { - return a_->getLength () > ai_; - } - - XML::Attribute<C> - next_attribute () - { - return XML::Attribute<C> ( - dynamic_cast<xercesc::DOMAttr*> (a_->item (ai_++))); - } - - private: - xercesc::DOMNodeList const* e_; - unsigned long ei_; - - xercesc::DOMNamedNodeMap const* a_; - unsigned long ai_; - - private: - Parser (Parser const&); - - void - operator= (Parser const&); - }; -} - -#include <XSCRT/Parser.ipp> -#include <XSCRT/Parser.tpp> - -#endif // XSCRT_PARSER_HPP diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.ipp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.ipp deleted file mode 100644 index cf317dd97ed..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.ipp +++ /dev/null @@ -1,222 +0,0 @@ -// file : XSCRT/Parser.ipp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSCRT -{ - /* - - //@@ recode to delegate to one function. - // - template<> - inline - std::wstring - parse<std::wstring> (XML::Element const& e, Parser&, std::wstring*) - { - return XML::transcode (e.dom_element ()->getTextContent ()); - } - - template<> - inline - std::wstring - parse<std::wstring> (XML::Attribute const& a, Parser&, std::wstring*) - { - return a.value (); - } - - template<> - inline - XMLSchema::byte - parse<XMLSchema::byte> (XML::Element const& e, Parser& p, XMLSchema::byte*) - { - wchar_t r; - std::wstringstream s; - s << parse<std::wstring> (e, p, 0); - s >> r; - - return static_cast<char>(r); - } - - template<> - inline - XMLSchema::byte - parse<XMLSchema::byte> (XML::Attribute const& a, Parser&, XMLSchema::byte*) - { - wchar_t r; - std::wstringstream s; - s << a.value (); - s >> r; - - return static_cast<char>(r); - } - - template<> - inline - XMLSchema::unsignedByte - parse<XMLSchema::unsignedByte> (XML::Element const& e, - Parser& p, - XMLSchema::unsignedByte*) - { - wchar_t r; - std::wstringstream s; - s << parse<std::wstring> (e, p, 0); - s >> r; - - return static_cast<unsigned char>(r); - } - - template<> - inline - XMLSchema::unsignedByte - parse<XMLSchema::unsignedByte> (XML::Attribute const& a, - Parser&, - XMLSchema::unsignedByte*) - { - wchar_t r; - std::wstringstream s; - s << a.value (); - s >> r; - - return static_cast<unsigned char>(r); - } - - template<> - inline - XMLSchema::unsignedLong - parse<XMLSchema::unsignedLong> (XML::Element const& e, - Parser& p, - XMLSchema::unsignedLong*) - { - unsigned long r; - std::wstringstream s; - s << parse<std::wstring> (e, p, 0); - s >> r; - - return r; - } - - template<> - inline - XMLSchema::unsignedLong - parse<XMLSchema::unsignedLong> (XML::Attribute const& a, - Parser&, - XMLSchema::unsignedLong*) - { - unsigned long r; - std::wstringstream s; - s << a.value (); - s >> r; - - return r; - } - - template<> - inline - XMLSchema::boolean - parse<XMLSchema::boolean> (XML::Element const& e, - Parser& p, - XMLSchema::boolean*) - { - return parse<std::wstring> (e, p, 0) == L"true"; - } - - template<> - inline - XMLSchema::boolean - parse<XMLSchema::boolean> (XML::Attribute const& a, - Parser&, - XMLSchema::boolean*) - { - return a.value () == L"true"; - } - - // ID - // - // - template<> - inline - XMLSchema::ID - parse<XMLSchema::ID> (std::wstring const& s, Parser&, XMLSchema::ID*) - { - return XMLSchema::ID (s); - } - - template<> - inline - XMLSchema::ID - parse<XMLSchema::ID> (XML::Element const& e, Parser& p, XMLSchema::ID*) - { - return parse<XMLSchema::ID> (parse<std::wstring> (e, p, 0), p, 0); - } - - template<> - inline - XMLSchema::ID - parse<XMLSchema::ID> (XML::Attribute const& a, Parser& p, XMLSchema::ID*) - { - return parse<XMLSchema::ID> (a.value (), p, 0); - } - - // IDREF - // - // - template<> - inline - XMLSchema::IDREF - parse<XMLSchema::IDREF> (std::wstring const& s, Parser&, XMLSchema::IDREF*) - { - return XMLSchema::IDREF (s); - } - - template<> - inline - XMLSchema::IDREF - parse<XMLSchema::IDREF> (XML::Element const& e, Parser& p, XMLSchema::IDREF*) - { - return parse<XMLSchema::IDREF> (parse<std::wstring> (e, p, 0), p, 0); - } - - template<> - inline - XMLSchema::IDREF - parse<XMLSchema::IDREF> (XML::Attribute const& a, - Parser& p, - XMLSchema::IDREF*) - { - return parse<XMLSchema::IDREF> (a.value (), p, 0); - } - - - // string - // - // - template<> - inline - XMLSchema::string - parse<XMLSchema::string> (std::wstring const& s, Parser&, XMLSchema::string*) - { - return s; - } - - template<> - inline - XMLSchema::string - parse<XMLSchema::string> (XML::Element const& e, - Parser& p, - XMLSchema::string*) - { - return parse<XMLSchema::string> (parse<std::wstring> (e, p, 0), p, 0); - } - - template<> - inline - XMLSchema::string - parse<XMLSchema::string> (XML::Attribute const& a, - Parser& p, - XMLSchema::string*) - { - return parse<XMLSchema::string> (a.value (), p, 0); - } - - */ -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.tpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.tpp deleted file mode 100644 index 75b9f48eb1f..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Parser.tpp +++ /dev/null @@ -1,7 +0,0 @@ -// file : XSCRT/Parser.tpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSCRT -{ -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.hpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.hpp deleted file mode 100644 index 0177dc6c120..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.hpp +++ /dev/null @@ -1,275 +0,0 @@ -// file : XSCRT/Traversal.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef XSCRT_TRAVERSAL_HPP -#define XSCRT_TRAVERSAL_HPP - -#include <map> -#include <set> -#include <vector> - -// #include <iostream> -// using std::wcerr; -// using std::endl; - -#include <XSCRT/ExtendedTypeInfo.hpp> - -namespace XSCRT -{ - namespace Traversal - { - // - // - // - template<typename B> - class TraverserBase - { - protected: - virtual - ~TraverserBase (); - - //@@ VC6 - public: - virtual void - trampoline (B& n) = 0; - - virtual void - trampoline (B const& n) = 0; - - /*@@ VC6 - template <typename X> - friend class DispatcherBase; - */ - }; - - - // - // - // - template <typename B> - class DispatcherBase - { - public: - virtual - ~DispatcherBase (); - - virtual void - dispatch (B& n); - - virtual void - dispatch (B const& n); - - void - map (TypeId id, TraverserBase<B>& t) - { - //wcerr << "map for " << id.name () << " to " << &t - // << " in " << &traversal_map_ << endl; - - //@@ VC6 - Traversers& traversers = traversal_map_[id]; - traversers.push_back (&t); - } - - public: - typedef - std::vector<TraverserBase<B>*> - Traversers; - - typedef - std::map<TypeId, Traversers> - TraversalMap; - - typedef - typename TraversalMap::const_iterator - Iterator; - - Iterator - begin () const - { - return traversal_map_.begin (); - } - - Iterator - end () const - { - return traversal_map_.end (); - } - - private: - struct TypeInfoComparator - { - bool - operator () (ExtendedTypeInfo const& x, - ExtendedTypeInfo const& y) const - { - return x.type_id () < y.type_id (); - } - }; - - typedef - std::map<ExtendedTypeInfo, unsigned long, TypeInfoComparator> - LevelMap; - - typedef - std::set<ExtendedTypeInfo, TypeInfoComparator> - TypeInfoSet; - - static unsigned long - compute_levels (ExtendedTypeInfo const& ti, - unsigned long cur, - LevelMap& map); - - static void - flatten_tree (ExtendedTypeInfo const& ti, TypeInfoSet& set); - - private: - TraversalMap traversal_map_; - }; - - - // - // - // - template <typename B> - class Dispatcher : public virtual DispatcherBase<B> - { - public: - Dispatcher () - : merge_ (true) - { - } - - void - traverser (DispatcherBase<B>& d) - { - for (typename DispatcherBase<B>::Iterator - i (d.begin ()), end (d.end ()); - i != end; ++i) - { - for (typename DispatcherBase<B>::Traversers::const_iterator - t (i->second.begin ()), end (i->second.end ()); - t != end; ++t) - { - dispatcher_.map (i->first, **t); - } - } - } - - public: - virtual void - dispatch (B& n) - { - merge (); - dispatcher_.dispatch (n); - } - - virtual void - dispatch (B const& n) - { - merge (); - dispatcher_.dispatch (n); - } - - using DispatcherBase<B>::begin; - using DispatcherBase<B>::end; - - private: - void - merge () - { - if (merge_) - { - for (typename DispatcherBase<B>::Iterator - i (begin ()), e (end ()); i != e; ++i) - { - for (typename DispatcherBase<B>::Traversers::const_iterator - t (i->second.begin ()), e (i->second.end ()); t != e; ++t) - { - dispatcher_.map (i->first, **t); - } - } - - merge_ = false; - } - } - - protected: - // DispatcherBase<B>& - // traverser () - // { - // return dispatcher_; - // } - - template <typename X, typename A, typename I> - void - iterate_and_dispatch (I begin, I end, X& x, void (X::*next)(A&), A& a) - { - for (; begin != end;) - { - dispatch (*begin); - - if (++begin != end) (x.*next) (a); - } - } - - private: - bool merge_; - DispatcherBase<B> dispatcher_; - }; - - - - // - // - // - template <typename T, typename B> - struct Traverser : TraverserBase<B>, virtual Dispatcher<B> - { - typedef - T - Type; - - Traverser () - { - map (typeid (Type), *this); - } - - virtual void - traverse (Type&) - { - abort (); - } - - virtual void - traverse (Type const&) - { - abort (); - } - - protected: - virtual void - trampoline (B& n) - { - //wcerr << "trampoline for " << &n << " to type " - // << typeid (Type).name () << endl; - - traverse (dynamic_cast<Type&> (n)); - } - - virtual void - trampoline (B const& n) - { - //wcerr << "trampoline for " << &n << " to type " - // << typeid (Type).name () << endl; - - traverse (dynamic_cast<Type const&> (n)); - } - }; - } -} - -#include <XSCRT/Traversal.ipp> -#include <XSCRT/Traversal.tpp> - -#endif // XSCRT_TRAVERSAL_HPP diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.ipp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.ipp deleted file mode 100644 index bc2a462334a..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.ipp +++ /dev/null @@ -1,7 +0,0 @@ -// file : XSCRT/Traversal.ixx -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSCRT -{ -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.tpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.tpp deleted file mode 100644 index b798178621b..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Traversal.tpp +++ /dev/null @@ -1,195 +0,0 @@ -// file : XSCRT/Traversal.txx -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSCRT -{ - namespace Traversal - { - // TraverserBase - // - // - - template<typename B> - TraverserBase<B>:: - ~TraverserBase () - { - } - - // DispatcherBase - // - // - - template <typename B> - DispatcherBase<B>:: - ~DispatcherBase () - { - } - - //@@ merge after dropping VC6 - // - // - template <typename B> - void DispatcherBase<B>:: - dispatch (B& n) - { - LevelMap levels; - - //@@ VC6 - ExtendedTypeInfo const& ti = extended_type_info (n); - - unsigned long max = compute_levels (ti, 0, levels); - - - //wcerr << "starting dispatch process for " - // << typeid (n).name () << " with " - // << max << " levels" << endl; - - for (unsigned long l = 0; l < max + 1; ++l) - { - TypeInfoSet dispatched; - - for (typename LevelMap::const_iterator - i (levels.begin ()), e (levels.end ()); - i != e; ++i) - { - if (i->second == l) - { - typename TraversalMap::const_iterator v ( - traversal_map_.find (i->first.type_id ())); - - if (v != traversal_map_.end ()) - { - //wcerr << "dispatching traversers for " - // << typeid (n).name () << " as " - // << i->first.type_id ().name () << endl; - - //@@ VC6 - Traversers const& traversers = v->second; - for (typename Traversers::const_iterator - ti (traversers.begin ()), te (traversers.end ()); - ti != te; ++ti) - { - (*ti)->trampoline (n); - } - - flatten_tree (i->first, dispatched); - } - } - } - - // Remove traversed types from the level map. - // - //@@ VC6 - { - for (typename TypeInfoSet::const_iterator i = dispatched.begin (); - i != dispatched.end (); - ++i) - { - levels.erase (*i); - } - } - } - } - - template <typename B> - void DispatcherBase<B>:: - dispatch (B const& n) - { - LevelMap levels; - - //@@ VC6 - ExtendedTypeInfo const& ti = extended_type_info (n); - - unsigned long max = compute_levels (ti, 0, levels); - - - //wcerr << "starting dispatch process for " - // << typeid (n).name () << " with " - // << max << " levels" << endl; - - //wcerr << "using " << &traversal_map_ << " traversal map" << endl; - - for (unsigned long l = 0; l < max + 1; ++l) - { - TypeInfoSet dispatched; - - for (typename LevelMap::const_iterator - i (levels.begin ()), e (levels.end ()); - i != e; ++i) - { - if (i->second == l) - { - typename TraversalMap::const_iterator v ( - traversal_map_.find (i->first.type_id ())); - - if (v != traversal_map_.end ()) - { - //wcerr << "dispatching traversers for " - // << typeid (n).name () << " as " - // << i->first.type_id ().name () << endl; - - //@@ VC6 - Traversers const& traversers = v->second; - for (typename Traversers::const_iterator - ti (traversers.begin ()), te (traversers.end ()); - ti != te; ++ti) - { - (*ti)->trampoline (n); - } - - flatten_tree (i->first, dispatched); - } - } - } - - // Remove traversed types from the level map. - // - //@@ VC6 - { - for (typename TypeInfoSet::const_iterator i = dispatched.begin (); - i != dispatched.end (); - ++i) - { - levels.erase (*i); - } - } - } - } - - template <typename B> - unsigned long DispatcherBase<B>:: - compute_levels (ExtendedTypeInfo const& ti, - unsigned long cur, - LevelMap& map) - { - unsigned long ret = cur; - - if (map.find (ti) == map.end () || map[ti] < cur) map[ti] = cur; - - for (ExtendedTypeInfo::BaseIterator i = ti.begin_base (); - i != ti.end_base (); - i++) - { - unsigned long t = compute_levels (i->type_info (), cur + 1, map); - if (t > ret) ret = t; - } - - return ret; - } - - template <typename B> - void DispatcherBase<B>:: - flatten_tree (ExtendedTypeInfo const& ti, TypeInfoSet& set) - { - set.insert (ti); - - for (ExtendedTypeInfo::BaseIterator i = ti.begin_base (); - i != ti.end_base (); - i++) - { - flatten_tree (i->type_info (), set); - } - } - } -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Writer.hpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Writer.hpp deleted file mode 100644 index c3610209976..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/Writer.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// file : XSCRT/Writer.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef XSCRT_WRITER_HPP -#define XSCRT_WRITER_HPP - -#include <stack> -#include <string> - -#include <XSCRT/Parser.hpp> //@@ for XML stuff - -namespace XSCRT -{ - template <typename C> - class Writer - { - public: - Writer (XML::Element<C>& e) - : attr__ (0) - { - push_ (e); - } - - protected: - // This c-tor should never be called. - // - Writer () - { - abort (); - } - - public: - void - push_ (XML::Element<C> const& e) - { - stack_.push (e); - } - - void - pop_ () - { - stack_.pop (); - } - - XML::Element<C>& - top_ () - { - return stack_.top (); - } - - public: - XML::Attribute<C>* - attr_ () - { - return attr__; - } - - void - attr_ (XML::Attribute<C>* a) - { - attr__ = a; - } - - private: - std::stack<XML::Element<C> > stack_; - - XML::Attribute<C>* attr__; - - private: - Writer (Writer const&); - - void - operator= (Writer const&); - }; -} - -//#include <XSCRT/Writer.ipp> -//#include <XSCRT/Writer.tpp> - -#endif // XSCRT_WRITER_HPP diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.hpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.hpp deleted file mode 100644 index d414ec0460e..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.hpp +++ /dev/null @@ -1,740 +0,0 @@ -// file : XSCRT/XMLSchema.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef XSCRT_XMLSCHEMA_HPP -#define XSCRT_XMLSCHEMA_HPP - -#include <string> -// #include <iostream> //@@ tmp - -#include <XSCRT/Elements.hpp> - -namespace XMLSchema -{ - typedef XSCRT::FundamentalType<signed char> byte; - typedef XSCRT::FundamentalType<unsigned char> unsignedByte; - - typedef XSCRT::FundamentalType<short> short_; - typedef XSCRT::FundamentalType<unsigned short> unsignedShort; - - typedef XSCRT::FundamentalType<int> int_; - typedef XSCRT::FundamentalType<unsigned int> unsignedInt; - - //@@ VC6 -#if defined (_MSC_VER) && (_MSC_VER < 1300) - - typedef XSCRT::FundamentalType<__int64> long_; - typedef XSCRT::FundamentalType<unsigned __int64> unsignedLong; - -#else - - typedef XSCRT::FundamentalType<long long> long_; - typedef XSCRT::FundamentalType<unsigned long long> unsignedLong; - -#endif - - //@@ It would be nice to use some arbitrary-length integer class. - // - typedef long_ decimal; - typedef decimal integer; - typedef integer nonPositiveInteger; - typedef integer nonNegativeInteger; - typedef nonNegativeInteger positiveInteger; - typedef nonPositiveInteger negativeInteger; - - - typedef XSCRT::FundamentalType<bool> boolean; - - typedef XSCRT::FundamentalType<float> float_; - typedef XSCRT::FundamentalType<double> double_; - - // Just to make GCC 3.3 and other broken compilers shutup. - // - using std::basic_string; - - - template <typename C> - class string : public XSCRT::Type, public basic_string<C> - { - protected: - typedef basic_string<C> Base__ ; - - public: - - //@@ VC6 does not inject XSCRT::Type into the scope so I have - // to qualify it all the time. - // - - string () - { - } - - string (XSCRT::XML::Element<C> const& e) - : Base__ (e.value ()) - { - } - - string (XSCRT::XML::Attribute<C> const& a) - : Base__ (a.value ()) - { - } - - string (Base__ const& x) - : Base__ (x) - { - } - - string (C const* x) - : Base__ (x) - { - } - - string& - operator= (Base__ const& x) - { - static_cast<Base__&> (*this) = x; - return *this; - } - }; - - - template <typename C> - class normalizedString : public string<C> - { - protected: - typedef typename string<C>::Base__ Base__; - - public: - normalizedString () - { - } - - normalizedString (XSCRT::XML::Element<C> const& e) - : string<C> (e) - { - } - - normalizedString (XSCRT::XML::Attribute<C> const& a) - : string<C> (a) - { - } - - normalizedString (Base__ const& x) - : string<C> (x) - { - } - - normalizedString (C const* x) - : string<C> (x) - { - } - - normalizedString& - operator= (Base__ const& x) - { - static_cast<Base__&> (*this) = x; - return *this; - } - }; - - - template <typename C> - class token : public normalizedString<C> - { - protected: - typedef typename normalizedString<C>::Base__ Base__; - - public: - token () - { - } - - token (XSCRT::XML::Element<C> const& e) - : normalizedString<C> (e) - { - } - - token (XSCRT::XML::Attribute<C> const& a) - : normalizedString<C> (a) - { - } - - token (Base__ const& x) - : normalizedString<C> (x) - { - } - - token (C const* x) - : normalizedString<C> (x) - { - } - - token& - operator= (Base__ const& x) - { - static_cast<Base__&> (*this) = x; - return *this; - } - }; - - - template <typename C> - class NMTOKEN : public token<C> - { - protected: - typedef typename token<C>::Base__ Base__; - - public: - NMTOKEN () - { - } - - NMTOKEN (XSCRT::XML::Element<C> const& e) - : token<C> (e) - { - } - - NMTOKEN (XSCRT::XML::Attribute<C> const& a) - : token<C> (a) - { - } - - NMTOKEN (Base__ const& x) - : token<C> (x) - { - } - - NMTOKEN (C const* x) - : token<C> (x) - { - } - - NMTOKEN& - operator= (Base__ const& x) - { - static_cast<Base__&> (*this) = x; - return *this; - } - }; - - template <typename C> - class Name: public token<C> - { - protected: - typedef typename token<C>::Base__ Base__; - - public: - Name() - { - } - - Name(XSCRT::XML::Element<C> const& e) - : token<C> (e) - { - } - - Name(XSCRT::XML::Attribute<C> const& a) - : token<C> (a) - { - } - - Name(Base__ const& x) - : token<C> (x) - { - } - - Name (C const* x) - : token<C> (x) - { - } - - Name& - operator= (Base__ const& x) - { - static_cast<Base__&> (*this) = x; - return *this; - } - }; - - - template <typename C> - class NCName: public Name<C> - { - protected: - typedef typename Name<C>::Base__ Base__; - - public: - NCName() - { - } - - NCName(XSCRT::XML::Element<C> const& e) - : Name<C> (e) - { - } - - NCName(XSCRT::XML::Attribute<C> const& a) - : Name<C> (a) - { - } - - NCName(Base__ const& x) - : Name<C> (x) - { - } - - NCName (C const* x) - : Name<C> (x) - { - } - - NCName& - operator= (Base__ const& x) - { - static_cast<Base__&> (*this) = x; - return *this; - } - }; - - template <typename C> - struct IdentityProvider : XSCRT::IdentityProvider - { - IdentityProvider (NCName<C> const& id) - : id_ (id) - { - } - - virtual bool - before (XSCRT::IdentityProvider const& y) const - { - return id_ < dynamic_cast<IdentityProvider const&> (y).id_; - } - - private: - NCName<C> const& id_; - - private: - IdentityProvider (IdentityProvider const&); - - IdentityProvider& - operator= (IdentityProvider const&); - }; - - - template <typename C> - class ID : public NCName<C> - { - protected: - typedef typename NCName<C>::Base__ Base__; - - public: - ~ID() - { - unregister_id (); - } - - ID () - : id_provider_ (*this) - { - } - - ID (XSCRT::XML::Element<C> const& e) - : NCName<C> (e), id_provider_ (*this) - { - } - - ID (XSCRT::XML::Attribute<C> const& a) - : NCName<C> (a), id_provider_ (*this) - { - } - - ID (ID const& x) - : NCName<C> (x), id_provider_ (*this) - { - } - - ID (Base__ const& x) - : NCName<C> (x), id_provider_ (*this) - { - } - - ID (C const* x) - : NCName<C> (x), id_provider_ (*this) - { - } - - ID& - operator= (Base__ const& x) - { - unregister_id (); - - static_cast<NCName<C>&>(*this) = x; - - register_id (); - - return *this; - } - - ID& - operator= (ID const& x) - { - unregister_id (); - - static_cast<NCName<C>&>(*this) = static_cast<NCName<C> const&>(x); - - register_id (); - - return *this; - } - - public: - using NCName<C>::container; - - virtual void - container (XSCRT::Type* c) - { - unregister_id (); - - NCName<C>::container (c); - - register_id (); - } - - private: - using NCName<C>::empty; - using NCName<C>::root; - - void - register_id () - { - if (container () != this && !empty ()) - { - //std::wcerr << "registering " << container () - // << " as '" << *this - // << "' on " << container () << std::endl; - container ()->register_id (id_provider_, container ()); - } - } - - void - unregister_id () - { - if (container () != this && !empty ()) - { - //std::wcerr << "un-registering " << container () - // << " as '" << *this - // << "' on " << container () << std::endl; - container ()->unregister_id (id_provider_); - } - } - - private: - IdentityProvider<C> id_provider_; - }; - - struct IDREF_Base : public XSCRT::Type - { - virtual XSCRT::Type const* - get () const = 0; - - virtual XSCRT::Type* - get () = 0; - }; - - template <typename C> - class IDREF : public IDREF_Base - { - public: - IDREF () - : id_provider_ (id_) - { - } - - IDREF (XSCRT::XML::Element<C> const& e) - : id_ (e), id_provider_ (id_) - { - } - - IDREF (XSCRT::XML::Attribute<C> const& a) - : id_ (a), id_provider_ (id_) - { - } - - IDREF (IDREF const& x) - : id_ (x.id_), id_provider_ (id_) - { - } - - IDREF (basic_string<C> const& id) - : id_ (id), id_provider_ (id_) - { - } - - IDREF (C const* id) - : id_ (id), id_provider_ (id_) - { - } - - IDREF& - operator= (IDREF const& x) - { - id_ = x.id_; - return *this; - } - - IDREF& - operator= (basic_string<C> const& x) - { - id_ = x; - return *this; - } - - public: - NCName<C> - id () const - { - return id_; - } - - public: - XSCRT::Type const* - operator-> () const - { - return get (); - } - - XSCRT::Type* - operator-> () - { - return get (); - } - - XSCRT::Type const& - operator* () const - { - return *(get ()); - } - - XSCRT::Type& - operator* () - { - return *(get ()); - } - - virtual XSCRT::Type const* - get () const - { - if (!id_.empty () && container () != this) - { - return root ()->lookup_id (id_provider_); - } - else - { - return 0; - } - } - - virtual XSCRT::Type* - get () - { - if (!id_.empty () && container () != this) - { - return root ()->lookup_id (id_provider_); - } - else - { - return 0; - } - } - - // conversion to bool - // - typedef void (IDREF::*bool_convertable)(); - - operator bool_convertable () const - { - return get () ? &IDREF::true_ : 0; - } - - private: - void true_ () - { - } - - private: - NCName<C> id_; - IdentityProvider<C> id_provider_; - }; -} - -// Traversal -// -// - -#include <XSCRT/Traversal.hpp> - -namespace XMLSchema -{ - namespace Traversal - { - // Automatic traversal of IDREFs. - // - struct IDREF : - XSCRT::Traversal::Traverser<XMLSchema::IDREF_Base, XSCRT::Type> - { - virtual void - traverse (XMLSchema::IDREF_Base& r) - { - if (r.get ()) dispatch (*(r.get ())); - } - - virtual void - traverse (XMLSchema::IDREF_Base const& r) - { - if (r.get ()) dispatch (*(r.get ())); - } - }; - - - template <typename T> - struct Traverser : XSCRT::Traversal::Traverser<T, XSCRT::Type> - { - }; - - typedef Traverser<byte> byte; - typedef Traverser<unsignedByte> unsignedByte; - - typedef Traverser<short_> short_; - typedef Traverser<unsignedShort> unsignedShort; - - typedef Traverser<int_> int_; - typedef Traverser<unsignedInt> unsignedInt; - - typedef Traverser<long_> long_; - typedef Traverser<unsignedLong> unsignedLong; - - typedef Traverser<boolean> boolean; - - typedef Traverser<float_> float_; - typedef Traverser<double_> double_; - - template <typename C> - struct string : Traverser<XMLSchema::string<C> > - { - }; - - template <typename C> - struct ID : Traverser<XMLSchema::ID<C> > - { - }; - } -} - - -// ExtendedTypeInfo for XML Schema types -// -// -#include <XSCRT/ExtendedTypeInfo.hpp> - -namespace XMLSchema -{ - template <typename C> - struct TypeInfoInitializer - { - TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap&); - }; -} - -// Writer -// -// -#if !defined (_MSC_VER) || (_MSC_VER >= 1300) - -#include <XSCRT/Writer.hpp> - -namespace XMLSchema -{ - namespace Writer - { - template <typename T, typename C> - struct FundamentalType : Traversal::Traverser<T>, - virtual XSCRT::Writer<C> - { - FundamentalType (XSCRT::XML::Element<C>& e) - : XSCRT::Writer<C> (e) - { - } - - using XSCRT::Writer<C>::top_; - using XSCRT::Writer<C>::attr_; - - virtual void - traverse (T const& o) - { - using namespace XSCRT::XML; - - std::basic_ostringstream<C> os; - - os << o; - - if (Attribute<C>* a = attr_ ()) - { - a->value (os.str ()); - } - else - { - top_().value (os.str ()); - } - } - - protected: - FundamentalType () - { - } - }; - - - template <typename C> - struct IDREF : Traversal::Traverser<XMLSchema::IDREF<C> >, - virtual XSCRT::Writer<C> - { - IDREF (XSCRT::XML::Element<C>& e) - : XSCRT::Writer<C> (e) - { - } - - using XSCRT::Writer<C>::top_; - using XSCRT::Writer<C>::attr_; - - virtual void - traverse ( - typename Traversal::Traverser<XMLSchema::IDREF<C> >::Type const& o) - { - using namespace XSCRT::XML; - - if (Attribute<C>* a = attr_ ()) - { - a->value (o.id ()); - } - else - { - top_().value (o.id ()); - } - } - - protected: - IDREF () - { - } - }; - } -} - -#endif - - -#include <XSCRT/XMLSchema.ipp> -#include <XSCRT/XMLSchema.tpp> - -#endif // XSCRT_XMLSCHEMA_HPP diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.ipp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.ipp deleted file mode 100644 index 10400057f07..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.ipp +++ /dev/null @@ -1,103 +0,0 @@ -// file : XSCRT/XMLSchema.ipp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - - -// ExtendedTypeInfo for XML Schema types -// -// -namespace XMLSchema -{ - //@@ VC6 - // - template<typename T> - void - add_info (XSCRT::ExtendedTypeInfoMap& map, T*) - { - using XSCRT::TypeId; - using XSCRT::ExtendedTypeInfo; - using std::make_pair; - - TypeId id (typeid (T)); - ExtendedTypeInfo info (id); - - info.add_base (ExtendedTypeInfo::Access::public_, - false, - typeid (XSCRT::Type)); - - map.insert (make_pair (id, info)); - } - - - template <typename C> - inline - TypeInfoInitializer<C>:: - TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap& map) - { - using XSCRT::TypeId; - using XSCRT::ExtendedTypeInfo; - using std::make_pair; - - // XSCRT::Type - // - { - TypeId id (typeid (XSCRT::Type)); - map.insert (make_pair (id, ExtendedTypeInfo (id))); - } - - //@@ VC6 - - add_info<byte> (map, 0); - add_info<unsignedByte> (map, 0); - - add_info<short_> (map, 0); - add_info<unsignedShort> (map, 0); - - add_info<int_> (map, 0); - add_info<unsignedInt> (map, 0); - - add_info<long_> (map, 0); - add_info<unsignedLong> (map, 0); - - add_info<boolean> (map, 0); - - add_info<float_> (map, 0);; - add_info<double_> (map, 0); - - add_info<string<C> > (map, 0); - - add_info<normalizedString<C> > (map, 0); - add_info<token<C> > (map, 0); - add_info<NMTOKEN<C> > (map, 0); - add_info<Name<C> > (map, 0); - add_info<NCName<C> > (map, 0); - - add_info<ID<C> > (map, 0); - - // IDREF_Base - // - { - TypeId id (typeid (IDREF_Base)); - ExtendedTypeInfo info (id); - - info.add_base (ExtendedTypeInfo::Access::public_, - false, - typeid (XSCRT::Type)); - - map.insert (make_pair (id, info)); - } - - // IDREF - // - { - TypeId id (typeid (IDREF<C>)); - ExtendedTypeInfo info (id); - - info.add_base (ExtendedTypeInfo::Access::public_, - false, - typeid (IDREF_Base)); - - map.insert (make_pair (id, info)); - } - } -} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.tpp b/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.tpp deleted file mode 100644 index bf638802ea6..00000000000 --- a/TAO/CIAO/DAnCE/Config_Handlers/XSCRT/XMLSchema.tpp +++ /dev/null @@ -1,8 +0,0 @@ -// file : XSCRT/XMLSchema.tpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -namespace XSCRT -{ -} - |