diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2021-09-25 10:26:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-25 10:26:30 +0200 |
commit | a59431844a4b19bec5cbdd0d292378b35fd98358 (patch) | |
tree | f741ead9f31a4ba08df4291bb811abde62fde987 /ACE | |
parent | 701d5ca07e1f03b1e6be364f4070cbd84d532562 (diff) | |
parent | f77bcabd4c6dd4decccec38b330d76c92049e295 (diff) | |
download | ATCD-a59431844a4b19bec5cbdd0d292378b35fd98358.tar.gz |
Merge pull request #1669 from jwillemsen/jwi-xmlcleanup2
Removed XML_Typedefs, declares a hidden global static, anyone using X…
Diffstat (limited to 'ACE')
-rw-r--r-- | ACE/ace/XML_Utils/XML.mpc | 2 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XMLSchema/Traversal.hpp | 2 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XMLSchema/TypeInfo.tpp | 1 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XMLSchema/Types.hpp | 40 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XMLSchema/Writer.hpp | 12 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XMLSchema/id_map.hpp | 207 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XML_Typedefs.cpp | 6 | ||||
-rw-r--r-- | ACE/ace/XML_Utils/XML_Typedefs.h | 30 |
8 files changed, 114 insertions, 186 deletions
diff --git a/ACE/ace/XML_Utils/XML.mpc b/ACE/ace/XML_Utils/XML.mpc index 6e791865445..3daad29e58e 100644 --- a/ACE/ace/XML_Utils/XML.mpc +++ b/ACE/ace/XML_Utils/XML.mpc @@ -23,7 +23,6 @@ project (ACE_XML_Utils) : install, acelib, xerces, ace_output { XML_Error_Handler.h XercesString.h XML_Schema_Resolver.h - XML_Typedefs.h XML_Helper.h XMLSchema XSCRT @@ -33,7 +32,6 @@ project (ACE_XML_Utils) : install, acelib, xerces, ace_output { XML_Error_Handler.cpp XercesString.cpp XML_Schema_Resolver.cpp - XML_Typedefs.cpp } Pkgconfig_Files { diff --git a/ACE/ace/XML_Utils/XMLSchema/Traversal.hpp b/ACE/ace/XML_Utils/XMLSchema/Traversal.hpp index 3fc320640ac..6e819df9423 100644 --- a/ACE/ace/XML_Utils/XMLSchema/Traversal.hpp +++ b/ACE/ace/XML_Utils/XMLSchema/Traversal.hpp @@ -11,8 +11,6 @@ namespace XMLSchema namespace Traversal { // Automatic traversal of IDREFs. - // - // struct IDREF : XSCRT::Traversal::Traverser<XMLSchema::IDREF_Base, XSCRT::Type> { diff --git a/ACE/ace/XML_Utils/XMLSchema/TypeInfo.tpp b/ACE/ace/XML_Utils/XMLSchema/TypeInfo.tpp index b431c99f68a..1379afefd74 100644 --- a/ACE/ace/XML_Utils/XMLSchema/TypeInfo.tpp +++ b/ACE/ace/XML_Utils/XMLSchema/TypeInfo.tpp @@ -4,7 +4,6 @@ namespace XMLSchema { //@@ VC6 - // template<typename T> void add_info (XSCRT::ExtendedTypeInfoMap& map, T*) diff --git a/ACE/ace/XML_Utils/XMLSchema/Types.hpp b/ACE/ace/XML_Utils/XMLSchema/Types.hpp index 966c588fd3e..298d90564e9 100644 --- a/ACE/ace/XML_Utils/XMLSchema/Types.hpp +++ b/ACE/ace/XML_Utils/XMLSchema/Types.hpp @@ -59,11 +59,7 @@ namespace XMLSchema public: //@@ VC6 does not inject XSCRT::Type into the scope so I have // to qualify it all the time. - // - - string () - { - } + string () = default; string (XSCRT::XML::Element<C> const& e) : Base__ (e.value ()) @@ -101,9 +97,7 @@ namespace XMLSchema typedef typename string<C>::Base__ Base__; public: - normalizedString () - { - } + normalizedString () = default; normalizedString (XSCRT::XML::Element<C> const& e) : string<C> (e) @@ -141,9 +135,7 @@ namespace XMLSchema typedef typename normalizedString<C>::Base__ Base__; public: - token () - { - } + token () = default; token (XSCRT::XML::Element<C> const& e) : normalizedString<C> (e) @@ -181,9 +173,7 @@ namespace XMLSchema typedef typename token<C>::Base__ Base__; public: - NMTOKEN () - { - } + NMTOKEN () = default; NMTOKEN (XSCRT::XML::Element<C> const& e) : token<C> (e) @@ -220,9 +210,7 @@ namespace XMLSchema typedef typename token<C>::Base__ Base__; public: - Name() - { - } + Name() = default; Name(XSCRT::XML::Element<C> const& e) : token<C> (e) @@ -260,9 +248,7 @@ namespace XMLSchema typedef typename Name<C>::Base__ Base__; public: - NCName() - { - } + NCName() = default; NCName(XSCRT::XML::Element<C> const& e) : Name<C> (e) @@ -299,9 +285,7 @@ namespace XMLSchema typedef typename Name<C>::Base__ Base__; public: - QName() - { - } + QName() = default; QName(XSCRT::XML::Element<C> const& e) : Name<C> (e) @@ -339,9 +323,7 @@ namespace XMLSchema { } - virtual ~IdentityProvider (void) - { - } + virtual ~IdentityProvider () = default; virtual bool before (XSCRT::IdentityProvider const& y) const @@ -474,11 +456,9 @@ namespace XMLSchema struct IDREF_Base : public XSCRT::Type { - virtual XSCRT::Type const* - get () const = 0; + virtual XSCRT::Type const* get () const = 0; - virtual XSCRT::Type* - get () = 0; + virtual XSCRT::Type* get () = 0; }; template <typename C> diff --git a/ACE/ace/XML_Utils/XMLSchema/Writer.hpp b/ACE/ace/XML_Utils/XMLSchema/Writer.hpp index 5a12ce2ff2a..c7d5f1e3900 100644 --- a/ACE/ace/XML_Utils/XMLSchema/Writer.hpp +++ b/ACE/ace/XML_Utils/XMLSchema/Writer.hpp @@ -54,9 +54,7 @@ namespace XMLSchema Traversal::Traverser<T>::traverse (t); } - FundamentalType () - { - } + FundamentalType () = default; }; template<typename C> @@ -105,9 +103,7 @@ namespace XMLSchema Traversal::Traverser<XSCRT::FundamentalType<bool> >::traverse (t); } - FundamentalType () - { - } + FundamentalType () = default; }; @@ -144,9 +140,7 @@ namespace XMLSchema Traversal::Traverser<XMLSchema::IDREF<C> >::traverse (o); } - IDREF () - { - } + IDREF () = default; }; } } diff --git a/ACE/ace/XML_Utils/XMLSchema/id_map.hpp b/ACE/ace/XML_Utils/XMLSchema/id_map.hpp index 559d461665f..47cc4038348 100644 --- a/ACE/ace/XML_Utils/XMLSchema/id_map.hpp +++ b/ACE/ace/XML_Utils/XMLSchema/id_map.hpp @@ -29,133 +29,128 @@ #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 - { +/** +* @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 { public: + explicit Unresolved_IDREF(const std::basic_string<ACE_TCHAR> &message) : message(message) + {} + ~Unresolved_IDREF(){} + std::basic_string<ACE_TCHAR> get_message ( void ) + { + return message; + } + private: + std::basic_string<ACE_TCHAR> message; + }; + + //Only a default constructor and destructor are needed + //Constructor + ID_Map () = default; - //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 { - public: - explicit Unresolved_IDREF(const std::basic_string<ACE_TCHAR> &message) : message(message) - {} - ~Unresolved_IDREF(){} - std::basic_string<ACE_TCHAR> get_message ( void ) - { - return message; - } - private: - std::basic_string<ACE_TCHAR> message; - }; - - //Only a default constructor and destructor are needed - //Constructor - ID_Map () + //Destructor + ~ID_Map () = default; + + // Add an ID to the ID map + void add_id (const std::basic_string<ACE_TCHAR>& id, XSCRT::Type *obj_ref) + { + if (obj_ref) { + this->id_map_.insert (ID_MAP::value_type(id, obj_ref)); } - - //Destructor - ~ID_Map () + else { + throw NULL_PTR_Entry(); } + } - // Add an ID to the ID map - void add_id (const std::basic_string<ACE_TCHAR>& id, XSCRT::Type *obj_ref) + // Add an IDREF to the IDREF map + void add_idref (const std::basic_string<ACE_TCHAR>& idref, XSCRT::Type *obj_ref) + { + if (obj_ref) { - if (obj_ref) + this->idref_map_.insert (IDREF_MAP::value_type(idref, obj_ref)); + } + else + { + throw NULL_PTR_Entry(); + } + } + + void resolve_single_idref (const std::basic_string<ACE_TCHAR>& idref, ::XSCRT::Type * element) + { + ID_Map::id_iterator id_iterator = this->id_map_.find(idref); + if (id_iterator != this->id_map_.end()) { - this->id_map_.insert (ID_MAP::value_type(id, obj_ref)); + element->set_idref(idref, id_iterator->second); } else { - throw NULL_PTR_Entry(); + throw Unresolved_IDREF(idref); } - } + } - // Add an IDREF to the IDREF map - void add_idref (const std::basic_string<ACE_TCHAR>& idref, XSCRT::Type *obj_ref) + //Sets the referencing elements XSCRT::Type::idref_ to point to the + //referenced element. + //Note: The pointer is of type "XSCRT::Type*" + void resolve_idref () + { + // Declare iterators to navigate the maps + for (ID_Map::idref_iterator idref_iterator = this->idref_map_.begin(); + idref_iterator != this->idref_map_.end(); + ++idref_iterator) { - if (obj_ref) + //Find the ID that matches the IDREF element + ID_Map::id_iterator id_iterator = this->id_map_.find(idref_iterator->first); + if (id_iterator != this->id_map_.end()) { - this->idref_map_.insert (IDREF_MAP::value_type(idref, obj_ref)); + // 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 NULL_PTR_Entry(); - } - } - - void resolve_single_idref (const std::basic_string<ACE_TCHAR>& idref, ::XSCRT::Type * element) - { - ID_Map::id_iterator id_iterator = this->id_map_.find(idref); - if (id_iterator != this->id_map_.end()) - { - element->set_idref(idref, id_iterator->second); - } - else - { - throw Unresolved_IDREF(idref); - } - } - - //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 - for (ID_Map::idref_iterator idref_iterator = this->idref_map_.begin(); - idref_iterator != this->idref_map_.end(); - ++idref_iterator) - { - //Find the ID that matches the IDREF element - ID_Map::id_iterator 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(idref_iterator->first); - } + throw Unresolved_IDREF(idref_iterator->first); } } + } - void reset (void) - { - id_map_.clear (); - idref_map_.clear (); - } - - private: - /// Maps the ID string to the element with the - /// ID attribute - ID_MAP id_map_; - /// Multimap that maps the IDREF string to the - /// element with the IDREF attribute - IDREF_MAP idref_map_; - }; + void reset () + { + id_map_.clear (); + idref_map_.clear (); + } + +private: + /// Maps the ID string to the element with the + /// ID attribute + ID_MAP id_map_; + /// Multimap that maps the IDREF string to the + /// element with the IDREF attribute + IDREF_MAP idref_map_; +}; #endif /* _ID_MAP_HPP */ diff --git a/ACE/ace/XML_Utils/XML_Typedefs.cpp b/ACE/ace/XML_Utils/XML_Typedefs.cpp deleted file mode 100644 index 3385a4b384a..00000000000 --- a/ACE/ace/XML_Utils/XML_Typedefs.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "XML_Typedefs.h" - -namespace XML -{ - XML_Typedef::HELPER XML_Typedef::XML_HELPER; -} diff --git a/ACE/ace/XML_Utils/XML_Typedefs.h b/ACE/ace/XML_Utils/XML_Typedefs.h deleted file mode 100644 index f235bfa62ae..00000000000 --- a/ACE/ace/XML_Utils/XML_Typedefs.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file XML_Typedefs.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Typedefs from the XML Utilities. - */ -#ifndef XML_TYPEDEFS_H -#define XML_TYPEDEFS_H - -#include "XML_Utils_Export.h" -#include "XML_Helper.h" -#include "XML_Schema_Resolver.h" -#include "XML_Error_Handler.h" - -namespace XML -{ - class XML_Utils_Export XML_Typedef - { - public: - typedef ::XML::Environment_Resolver PATH_RESOLVER; - typedef ::XML::XML_Schema_Resolver< ::XML::Environment_Resolver> XML_RESOLVER; - typedef ::XML::XML_Error_Handler ERROR_HANDLER; - typedef ::XML::XML_Helper<XML_RESOLVER, ERROR_HANDLER> HELPER; - - public: - static HELPER XML_HELPER; - }; -} - -#endif /* XML_TYPEDEFS_H */ |