summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/Config_Handlers/XMLSchema
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/DAnCE/Config_Handlers/XMLSchema')
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.hpp77
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.ipp10
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.tpp11
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.hpp22
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.ipp7
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.tpp98
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.hpp670
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.ipp8
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.tpp9
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.hpp159
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.ipp10
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.tpp10
-rw-r--r--modules/CIAO/DAnCE/Config_Handlers/XMLSchema/id_map.hpp138
13 files changed, 1229 insertions, 0 deletions
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.hpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.hpp
new file mode 100644
index 00000000000..24fa7a9eb6e
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.hpp
@@ -0,0 +1,77 @@
+// file : XMLSchema/Traversal.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef XMLSCHEMA_TRAVERSAL_HPP
+#define XMLSCHEMA_TRAVERSAL_HPP
+
+#include <XSCRT/Traversal.hpp>
+#include <XMLSchema/Types.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> >
+ {
+ };
+
+ template <typename C>
+ struct anyURI : Traverser <XMLSchema::anyURI<C> >
+ {
+ };
+ }
+}
+
+#include <XMLSchema/Traversal.ipp>
+#include <XMLSchema/Traversal.tpp>
+
+#endif // XMLSCHEMA_TRAVERSAL_HPP
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.ipp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.ipp
new file mode 100644
index 00000000000..a5c614182a3
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.ipp
@@ -0,0 +1,10 @@
+// file : XMLSchema/Traversal.ipp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+ namespace Traversal
+ {
+ }
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.tpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.tpp
new file mode 100644
index 00000000000..d79c13630fb
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Traversal.tpp
@@ -0,0 +1,11 @@
+// file : XMLSchema/Traversal.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+ namespace Traversal
+ {
+
+ }
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.hpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.hpp
new file mode 100644
index 00000000000..e4fa52dbb9c
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.hpp
@@ -0,0 +1,22 @@
+// file : XMLSchema/TypeInfo.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef XMLSCHEMA_TYPE_INFO_HPP
+#define XMLSCHEMA_TYPE_INFO_HPP
+
+#include <XSCRT/ExtendedTypeInfo.hpp>
+
+namespace XMLSchema
+{
+ template <typename C>
+ struct TypeInfoInitializer
+ {
+ TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap&);
+ };
+}
+
+#include <XMLSchema/TypeInfo.ipp>
+#include <XMLSchema/TypeInfo.tpp>
+
+#endif // XMLSCHEMA_TYPE_INFO_HPP
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.ipp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.ipp
new file mode 100644
index 00000000000..5b9422f38c8
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.ipp
@@ -0,0 +1,7 @@
+// file : XMLSchema/TypeInfo.ipp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.tpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.tpp
new file mode 100644
index 00000000000..918197937b7
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/TypeInfo.tpp
@@ -0,0 +1,98 @@
+// file : XMLSchema/TypeInfo.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+ //@@ VC6
+ //
+ template<typename T>
+ void
+ add_info (XSCRT::ExtendedTypeInfoMap& map, T*)
+ {
+ using XSCRT::TypeId;
+ using XSCRT::ExtendedTypeInfo;
+
+ TypeId id (typeid (T));
+ ExtendedTypeInfo info (id);
+
+ info.add_base (ExtendedTypeInfo::Access::public_,
+ false,
+ typeid (XSCRT::Type));
+
+ map.insert (std::make_pair (id, info));
+ }
+
+
+ template <typename C>
+ inline
+ TypeInfoInitializer<C>::
+ TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap& map)
+ {
+ using XSCRT::TypeId;
+ using XSCRT::ExtendedTypeInfo;
+
+ // XSCRT::Type
+ //
+ {
+ TypeId id (typeid (XSCRT::Type));
+ map.insert (std::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<QName<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 (std::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 (std::make_pair (id, info));
+ }
+ }
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.hpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.hpp
new file mode 100644
index 00000000000..9f4ea91f3c4
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.hpp
@@ -0,0 +1,670 @@
+// file : XMLSchema/Types.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef XMLSCHEMA_TYPES_HPP
+#define XMLSCHEMA_TYPES_HPP
+
+#include <string>
+#include "XSCRT/Elements.hpp"
+
+#include "ace/Basic_Types.h"
+/**
+ * @@ HACK: VC7
+ *
+ * Disabled the warning about using this in the base member initialization section.
+ * Our use in this file is fine.
+ */
+#ifdef _MSC_VER
+# pragma warning ( disable: 4355 )
+#endif
+namespace XMLSchema
+{
+ typedef XSCRT::FundamentalType<ACE_INT8> byte;
+ typedef XSCRT::FundamentalType<ACE_UINT8> unsignedByte;
+
+ typedef XSCRT::FundamentalType<ACE_INT16> short_;
+ typedef XSCRT::FundamentalType<ACE_UINT16> unsignedShort;
+
+ typedef XSCRT::FundamentalType<ACE_INT32> int_;
+ typedef XSCRT::FundamentalType<ACE_UINT32> unsignedInt;
+
+ typedef XSCRT::FundamentalType<ACE_INT64> long_;
+ typedef XSCRT::FundamentalType<ACE_UINT64> unsignedLong;
+
+ //@@ 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:
+ // typedef ACE_Refcounted_Auto_Ptr < string, ACE_Null_Mutex > _ptr;
+
+ //@@ 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>
+ class QName: public Name<C>
+ {
+ protected:
+ typedef typename Name<C>::Base__ Base__;
+
+ public:
+ QName()
+ {
+ }
+
+ QName(XSCRT::XML::Element<C> const& e)
+ : Name<C> (e)
+ {
+ }
+
+ QName(XSCRT::XML::Attribute<C> const& a)
+ : Name<C> (a)
+ {
+ }
+
+ QName(Base__ const& x)
+ : Name<C> (x)
+ {
+ }
+
+ QName (C const* x)
+ : Name<C> (x)
+ {
+ }
+
+ QName&
+ 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 ~IdentityProvider (void)
+ {
+ }
+
+ 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 (NCName<C>::container () != this && !empty ())
+ {
+ //std::wcerr << "registering " << container ()
+ // << " as '" << *this
+ // << "' on " << container () << std::endl;
+ NCName<C>::container ()->register_id (id_provider_,
+ NCName<C>::container ());
+ }
+ }
+
+ void
+ unregister_id ()
+ {
+ if (NCName<C>::container () != this && !empty ())
+ {
+ //std::wcerr << "un-registering " << container ()
+ // << " as '" << *this
+ // << "' on " << container () << std::endl;
+ NCName<C>::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:
+ typedef C CDR_Type__;
+ 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)
+ : XMLSchema::IDREF_Base (),
+ 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_;
+ };
+
+ template <typename C>
+ class anyURI : public XSCRT::Type, public basic_string <C>
+ {
+ protected:
+ typedef basic_string <C> Base__ ;
+
+ public:
+ // Trait for marshaling string
+ typedef C CDR_Type__;
+
+ //@@ VC6 does not inject XSCRT::Type into the scope so I have
+ // to qualify it all the time.
+ //
+
+ anyURI (void)
+ {
+ }
+
+ anyURI (XSCRT::XML::Element<C> const& e)
+ : Base__ (e.value ())
+ {
+ }
+
+ anyURI (XSCRT::XML::Attribute<C> const& a)
+ : Base__ (a.value ())
+ {
+ }
+
+ anyURI (Base__ const& x)
+ : Base__ (x)
+ {
+ }
+
+ anyURI (C const * x)
+ : Base__ (x)
+ {
+ }
+
+ anyURI (const anyURI& s)
+ : Base__ (s)
+ {
+
+ }
+
+ anyURI & operator= (Base__ const& x)
+ {
+ static_cast <Base__ &> (*this) = x;
+ return *this;
+ }
+ };
+}
+
+#include "XMLSchema/Types.ipp"
+#include "XMLSchema/Types.tpp"
+
+#endif // XMLSCHEMA_TYPES_HPP
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.ipp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.ipp
new file mode 100644
index 00000000000..6b749260f55
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.ipp
@@ -0,0 +1,8 @@
+// file : XMLSchema/Types.ipp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.tpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.tpp
new file mode 100644
index 00000000000..4a8bddcf597
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Types.tpp
@@ -0,0 +1,9 @@
+// file : XMLSchema/Types.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+
+}
+
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.hpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.hpp
new file mode 100644
index 00000000000..4a0c1603efa
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.hpp
@@ -0,0 +1,159 @@
+// file : XMLSchema/Writer.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef XMLSCHEMA_WRITER_HPP
+#define XMLSCHEMA_WRITER_HPP
+
+#include <sstream>
+
+#include <XSCRT/Writer.hpp>
+
+#include <XMLSchema/Types.hpp>
+#include <XMLSchema/Traversal.hpp>
+
+#include <iostream>
+
+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:
+ virtual void
+ traverse (T &t)
+ {
+ Traversal::Traverser<T>::traverse (t);
+ }
+
+ FundamentalType ()
+ {
+ }
+ };
+
+ template<typename C>
+ struct FundamentalType <XSCRT::FundamentalType<bool>, C> :
+ Traversal::Traverser<XSCRT::FundamentalType<bool> >,
+ 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 (XSCRT::FundamentalType<bool> const &o)
+ {
+ using namespace XSCRT::XML;
+
+ std::basic_ostringstream<C> os;
+
+ if (o)
+ {
+ os << "true";
+ }
+ else
+ {
+ os << "false";
+ }
+
+ if (Attribute<C>* a = attr_ ())
+ {
+ a->value (os.str ());
+ }
+ else
+ {
+ top_().value (os.str ());
+ }
+ }
+
+ protected:
+ virtual void
+ traverse (XSCRT::FundamentalType<bool> &t)
+ {
+ Traversal::Traverser<XSCRT::FundamentalType<bool> >::traverse (t);
+ }
+
+ 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)
+ {
+ }
+
+ virtual void
+ traverse (
+ typename Traversal::Traverser<XMLSchema::IDREF<C> >::Type const& o)
+ {
+ using namespace XSCRT::XML;
+
+ if (Attribute<C>* a = XSCRT::Writer<C>::attr_ ())
+ {
+ a->value (o.id ());
+ }
+ else
+ {
+ XSCRT::Writer<C>::top_().value (o.id ());
+ }
+ }
+
+ protected:
+
+ virtual void
+ traverse (typename Traversal::Traverser<XMLSchema::IDREF<C> >::Type &o)
+ {
+ Traversal::Traverser<XMLSchema::IDREF<C> >::traverse (o);
+ }
+
+ IDREF ()
+ {
+ }
+ };
+ }
+}
+
+#include <XMLSchema/Writer.ipp>
+#include <XMLSchema/Writer.tpp>
+
+#endif // XMLSCHEMA_WRITER_HPP
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.ipp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.ipp
new file mode 100644
index 00000000000..2b7c9a4b939
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.ipp
@@ -0,0 +1,10 @@
+// file : XMLSchema/Writer.ipp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+ namespace Writer
+ {
+ }
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.tpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.tpp
new file mode 100644
index 00000000000..6c57de04d81
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/Writer.tpp
@@ -0,0 +1,10 @@
+// file : XMLSchema/Writer.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace XMLSchema
+{
+ namespace Writer
+ {
+ }
+}
diff --git a/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/id_map.hpp b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/id_map.hpp
new file mode 100644
index 00000000000..a2843d44693
--- /dev/null
+++ b/modules/CIAO/DAnCE/Config_Handlers/XMLSchema/id_map.hpp
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+// $Id$
+
+//=============================================================================
+/**
+ * @file id_map.hpp
+ *
+ * This file contains the ID_Map class which has the responsibility of linking
+ * XML IDREF objects to their XML ID counterparts. In the output files, this
+ * means that a <IDREF name>_ptr() will return a pointer to the identified
+ * object.
+ *
+ * Exception NULL_PTR_Entry is thrown when a program attempts to add a NULL_PTR
+ * to either the id_map or idref_map.
+ *
+ * Exception Unresolved_IDREF is thrown if an element in an XML document attempts
+ * to reference an ID that does not exist.
+ *
+ * @author Jason R. Cody <jason.r.cody@vanderbilt.edu; jason.r.cody@gmail.com>
+ */
+//=============================================================================
+
+#ifndef _ID_MAP_H
+#define _ID_MAP_H
+
+//ID_Map makes use of the Types::idref_ data member to set it to the appropriate
+//object created during parsing
+#include "XMLSchema/Types.hpp"
+
+//The ID_Map is a Thread Specific Storage element.
+#include "ace/TSS_T.h"
+#include "ace/ace_wchar.h"
+
+ /**
+ * @class ID_Map
+ *
+ * @brief A class that handles the mapping of IDREF objects to objects with the
+ * respective ID.
+ */
+ class ID_Map
+ {
+ public:
+
+ //Trait to allow for ease of thread specific storage.
+ typedef ACE_TSS<ID_Map> TSS_ID_Map;
+ typedef std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*>::iterator id_iterator;
+ typedef std::multimap<std::basic_string<ACE_TCHAR>, XSCRT::Type*>::iterator idref_iterator;
+ typedef std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*> ID_MAP;
+ typedef std::multimap<std::basic_string<ACE_TCHAR>, XSCRT::Type*> IDREF_MAP;
+
+
+ //Exception Classes
+ //NULL_PTR_Entry thrown when a NULL PTR is added to the
+ //ID_Map
+ class NULL_PTR_Entry {};
+
+ //Unresolved_IDREF thrown when there are IDREF's in the
+ //XML document.
+ class Unresolved_IDREF {};
+
+ //Only a default constructor and destructor are needed
+ //Constructor
+ ID_Map ()
+ {
+ }
+
+ //Destructor
+ ~ID_Map ()
+ {
+ }
+
+ //Add an ID to the ID map
+ void add_id (std::basic_string<ACE_TCHAR> id, XSCRT::Type *obj_ref)
+ {
+ if (obj_ref)
+ {
+ this->id_map_.insert (ID_MAP::value_type(id, obj_ref));
+ }
+ else
+ {
+ throw NULL_PTR_Entry();
+ }
+ return;
+ }
+
+ //Add an IDREF to the IDREF map
+ void add_idref (std::basic_string<ACE_TCHAR> idref, XSCRT::Type *obj_ref)
+ {
+ if (obj_ref)
+ {
+ this->idref_map_.insert (IDREF_MAP::value_type(idref, obj_ref));
+ }
+ else
+ {
+ throw NULL_PTR_Entry();
+ }
+ return;
+ }
+
+ //Sets the referencing elements XSCRT::Type::idref_ to point to the
+ //referenced element.
+ //Note: The pointer is of type "XSCRT::Type*"
+ void resolve_idref ( void )
+ {
+ //Declare iterators to navigate the maps
+ ID_Map::id_iterator id_iterator;
+ ID_Map::idref_iterator idref_iterator;
+
+ for (idref_iterator = this->idref_map_.begin();
+ idref_iterator != this->idref_map_.end();
+ ++idref_iterator)
+ {
+ //Find the ID that matches the IDREF element
+ id_iterator = this->id_map_.find(idref_iterator->first);
+ if (id_iterator != this->id_map_.end())
+ {
+ //Add the IDREF identifier and the reference to the
+ //identified object
+ std::basic_string<ACE_TCHAR> temp_id = id_iterator->first;
+ idref_iterator->second->set_idref(temp_id, id_iterator->second);
+ }
+ else
+ {
+ //throw Unresolved_IDREF();
+ }
+ }
+ }
+
+ private:
+ //id_map_: maps the ID string to the element with the
+ // ID attribute
+ //idref_map_: multimap that maps the IDREF string to the
+ // element with the IDREF attribute
+ ID_MAP id_map_;
+ IDREF_MAP idref_map_;
+ };
+
+#endif /* _ID_MAP_HPP */