From a98326eb2954ac1e79f5eac28dbeab3ec15e047f Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Sat, 30 Jun 2018 12:43:08 +0200 Subject: 10.1 --- zenXml/zenxml/cvrt_struc.h | 50 ++++++++++++++++++++++------------------------ zenXml/zenxml/cvrt_text.h | 10 +++++----- zenXml/zenxml/dom.h | 15 +++++++++----- 3 files changed, 39 insertions(+), 36 deletions(-) (limited to 'zenXml') diff --git a/zenXml/zenxml/cvrt_struc.h b/zenXml/zenxml/cvrt_struc.h index 3a18ea73..11795107 100755 --- a/zenXml/zenxml/cvrt_struc.h +++ b/zenXml/zenxml/cvrt_struc.h @@ -56,14 +56,13 @@ ZEN_INIT_DETECT_MEMBER(insert) // } template -struct IsStlContainer : - StaticBool< - impl_2384343::HasMemberType_value_type ::value&& - impl_2384343::HasMemberType_iterator ::value&& - impl_2384343::HasMemberType_const_iterator::value&& - impl_2384343::HasMember_begin ::value&& - impl_2384343::HasMember_end ::value&& - impl_2384343::HasMember_insert ::value> {}; +using IsStlContainer = std::bool_constant< + impl_2384343::HasMemberType_value_type ::value && + impl_2384343::HasMemberType_iterator ::value && + impl_2384343::HasMemberType_const_iterator::value && + impl_2384343::HasMember_begin ::value && + impl_2384343::HasMember_end ::value && + impl_2384343::HasMember_insert ::value>; namespace impl_2384343 @@ -76,29 +75,28 @@ ZEN_INIT_DETECT_MEMBER(second) // } template -struct IsStlPair : - StaticBool< - impl_2384343::HasMemberType_first_type ::value&& - impl_2384343::HasMemberType_second_type::value&& - impl_2384343::HasMember_first ::value&& - impl_2384343::HasMember_second ::value> {}; +using IsStlPair = std::bool_constant< + impl_2384343::HasMemberType_first_type ::value && + impl_2384343::HasMemberType_second_type::value && + impl_2384343::HasMember_first ::value && + impl_2384343::HasMember_second ::value>; //###################################################################################### //Conversion from arbitrary types to an XML element -enum ValueType +enum class ValueType { - VALUE_TYPE_STL_CONTAINER, - VALUE_TYPE_STL_PAIR, - VALUE_TYPE_OTHER, + STL_CONTAINER, + STL_PAIR, + OTHER, }; template -struct GetValueType : StaticEnum::value != TEXT_TYPE_OTHER ? VALUE_TYPE_OTHER : //some string classes are also STL containers, so check this first - IsStlContainer::value ? VALUE_TYPE_STL_CONTAINER : - IsStlPair::value ? VALUE_TYPE_STL_PAIR : - VALUE_TYPE_OTHER> {}; +using GetValueType = std::integral_constant::value != TEXT_TYPE_OTHER ? ValueType::OTHER : //some string classes are also STL containers, so check this first + IsStlContainer::value ? ValueType::STL_CONTAINER : + IsStlPair ::value ? ValueType::STL_PAIR : + ValueType::OTHER>; template @@ -113,7 +111,7 @@ struct ConvertElement; //partial specialization: handle conversion for all STL-container types! template -struct ConvertElement +struct ConvertElement { void writeStruc(const T& value, XmlElement& output) const { @@ -145,7 +143,7 @@ struct ConvertElement //partial specialization: handle conversion for std::pair template -struct ConvertElement +struct ConvertElement { void writeStruc(const T& value, XmlElement& output) const { @@ -173,7 +171,7 @@ struct ConvertElement //partial specialization: not a pure structured type, try text conversion (thereby respect user specializations of writeText()/readText()) template -struct ConvertElement +struct ConvertElement { void writeStruc(const T& value, XmlElement& output) const { diff --git a/zenXml/zenxml/cvrt_text.h b/zenXml/zenxml/cvrt_text.h index 17444861..32a961b2 100755 --- a/zenXml/zenxml/cvrt_text.h +++ b/zenXml/zenxml/cvrt_text.h @@ -112,10 +112,10 @@ enum TextType }; template -struct GetTextType : StaticEnum::value ? TEXT_TYPE_BOOL : - IsStringLike::value ? TEXT_TYPE_STRING : //string before number to correctly handle char/wchar_t -> this was an issue with Loki only! - IsArithmetic::value ? TEXT_TYPE_NUMBER : // +struct GetTextType : std::integral_constant ? TEXT_TYPE_BOOL : + IsStringLikeV ? TEXT_TYPE_STRING : //string before number to correctly handle char/wchar_t -> this was an issue with Loki only! + IsArithmetic::value ? TEXT_TYPE_NUMBER : // TEXT_TYPE_OTHER> {}; //###################################################################################### @@ -186,7 +186,7 @@ template struct ConvertText { //########################################################################################################################################### - static_assert(sizeof(T) == -1, ""); + static_assert(sizeof(T) == -1); /* ATTENTION: The data type T is yet unknown to the zen::Xml framework! diff --git a/zenXml/zenxml/dom.h b/zenXml/zenxml/dom.h index 15700ee2..566af330 100755 --- a/zenXml/zenxml/dom.h +++ b/zenXml/zenxml/dom.h @@ -10,7 +10,6 @@ #include #include #include -#include #include "cvrt_text.h" //"readText/writeText" @@ -144,9 +143,15 @@ public: template < class IterTy, //underlying iterator type class T, //target object type class AccessPolicy > //access policy: see AccessPtrMap - class PtrIter : public std::iterator, private AccessPolicy //get rid of shared_ptr indirection + class PtrIter : private AccessPolicy //get rid of shared_ptr indirection { public: + using iterator_category = std::input_iterator_tag; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = T*; + using reference = T&; + PtrIter(IterTy it) : it_(it) {} PtrIter(const PtrIter& other) : it_(other.it_) {} PtrIter& operator++() { ++it_; return *this; } @@ -191,8 +196,8 @@ public: T& objectRef(const IterTy& it) const { return *it; } }; - using ChildIter = PtrIter::iterator, XmlElement, AccessListElement>; - using ChildIterConst = PtrIter::const_iterator, const XmlElement, AccessListElement>; + using ChildIter = PtrIter::iterator, XmlElement, AccessListElement>; + using ChildIterConst = PtrIter::const_iterator, const XmlElement, AccessListElement>; ///Access all child elements sequentially via STL iterators. /** @@ -257,7 +262,7 @@ private: std::list attributes_; //attributes in order of creation std::map::iterator> attributesSorted_; //alternate view: sorted by attribute name - FixedList childElements_; //child elements in order of creation + std::list childElements_; //child elements in order of creation std::multimap childElementsSorted_; //alternate view: sorted by element name XmlElement* parent_ = nullptr; }; -- cgit