summaryrefslogtreecommitdiff
path: root/zenXml
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2018-06-30 12:43:08 +0200
committerDaniel Wilhelm <shieldwed@outlook.com>2018-06-30 12:43:08 +0200
commita98326eb2954ac1e79f5eac28dbeab3ec15e047f (patch)
treebb16257a1894b488e365851273735ec13a9442ef /zenXml
parent10.0 (diff)
downloadFreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.gz
FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.bz2
FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.zip
10.1
Diffstat (limited to 'zenXml')
-rwxr-xr-xzenXml/zenxml/cvrt_struc.h50
-rwxr-xr-xzenXml/zenxml/cvrt_text.h10
-rwxr-xr-xzenXml/zenxml/dom.h15
3 files changed, 39 insertions, 36 deletions
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 <typename T>
-struct IsStlContainer :
- StaticBool<
- impl_2384343::HasMemberType_value_type <T>::value&&
- impl_2384343::HasMemberType_iterator <T>::value&&
- impl_2384343::HasMemberType_const_iterator<T>::value&&
- impl_2384343::HasMember_begin <T>::value&&
- impl_2384343::HasMember_end <T>::value&&
- impl_2384343::HasMember_insert <T>::value> {};
+using IsStlContainer = std::bool_constant<
+ impl_2384343::HasMemberType_value_type <T>::value &&
+ impl_2384343::HasMemberType_iterator <T>::value &&
+ impl_2384343::HasMemberType_const_iterator<T>::value &&
+ impl_2384343::HasMember_begin <T>::value &&
+ impl_2384343::HasMember_end <T>::value &&
+ impl_2384343::HasMember_insert <T>::value>;
namespace impl_2384343
@@ -76,29 +75,28 @@ ZEN_INIT_DETECT_MEMBER(second) //
}
template <typename T>
-struct IsStlPair :
- StaticBool<
- impl_2384343::HasMemberType_first_type <T>::value&&
- impl_2384343::HasMemberType_second_type<T>::value&&
- impl_2384343::HasMember_first <T>::value&&
- impl_2384343::HasMember_second <T>::value> {};
+using IsStlPair = std::bool_constant<
+ impl_2384343::HasMemberType_first_type <T>::value &&
+ impl_2384343::HasMemberType_second_type<T>::value &&
+ impl_2384343::HasMember_first <T>::value &&
+ impl_2384343::HasMember_second <T>::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 <class T>
-struct GetValueType : StaticEnum<ValueType,
- GetTextType<T>::value != TEXT_TYPE_OTHER ? VALUE_TYPE_OTHER : //some string classes are also STL containers, so check this first
- IsStlContainer<T>::value ? VALUE_TYPE_STL_CONTAINER :
- IsStlPair<T>::value ? VALUE_TYPE_STL_PAIR :
- VALUE_TYPE_OTHER> {};
+using GetValueType = std::integral_constant<ValueType,
+ GetTextType <T>::value != TEXT_TYPE_OTHER ? ValueType::OTHER : //some string classes are also STL containers, so check this first
+ IsStlContainer<T>::value ? ValueType::STL_CONTAINER :
+ IsStlPair <T>::value ? ValueType::STL_PAIR :
+ ValueType::OTHER>;
template <class T, ValueType type>
@@ -113,7 +111,7 @@ struct ConvertElement;
//partial specialization: handle conversion for all STL-container types!
template <class T>
-struct ConvertElement<T, VALUE_TYPE_STL_CONTAINER>
+struct ConvertElement<T, ValueType::STL_CONTAINER>
{
void writeStruc(const T& value, XmlElement& output) const
{
@@ -145,7 +143,7 @@ struct ConvertElement<T, VALUE_TYPE_STL_CONTAINER>
//partial specialization: handle conversion for std::pair
template <class T>
-struct ConvertElement<T, VALUE_TYPE_STL_PAIR>
+struct ConvertElement<T, ValueType::STL_PAIR>
{
void writeStruc(const T& value, XmlElement& output) const
{
@@ -173,7 +171,7 @@ struct ConvertElement<T, VALUE_TYPE_STL_PAIR>
//partial specialization: not a pure structured type, try text conversion (thereby respect user specializations of writeText()/readText())
template <class T>
-struct ConvertElement<T, VALUE_TYPE_OTHER>
+struct ConvertElement<T, ValueType::OTHER>
{
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 <class T>
-struct GetTextType : StaticEnum<TextType,
- IsSameType<T, bool>::value ? TEXT_TYPE_BOOL :
- IsStringLike<T>::value ? TEXT_TYPE_STRING : //string before number to correctly handle char/wchar_t -> this was an issue with Loki only!
- IsArithmetic<T>::value ? TEXT_TYPE_NUMBER : //
+struct GetTextType : std::integral_constant<TextType,
+ std::is_same_v<T, bool> ? TEXT_TYPE_BOOL :
+ IsStringLikeV<T> ? TEXT_TYPE_STRING : //string before number to correctly handle char/wchar_t -> this was an issue with Loki only!
+ IsArithmetic<T>::value ? TEXT_TYPE_NUMBER : //
TEXT_TYPE_OTHER> {};
//######################################################################################
@@ -186,7 +186,7 @@ template <class T>
struct ConvertText<T, TEXT_TYPE_OTHER>
{
//###########################################################################################################################################
- 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 <string>
#include <list>
#include <map>
-#include <zen/fixed_list.h>
#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<std::input_iterator_tag, T>, 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<FixedList<XmlElement>::iterator, XmlElement, AccessListElement>;
- using ChildIterConst = PtrIter<FixedList<XmlElement>::const_iterator, const XmlElement, AccessListElement>;
+ using ChildIter = PtrIter<std::list<XmlElement>::iterator, XmlElement, AccessListElement>;
+ using ChildIterConst = PtrIter<std::list<XmlElement>::const_iterator, const XmlElement, AccessListElement>;
///Access all child elements sequentially via STL iterators.
/**
@@ -257,7 +262,7 @@ private:
std::list<Attribute> attributes_; //attributes in order of creation
std::map<std::string, std::list<Attribute>::iterator> attributesSorted_; //alternate view: sorted by attribute name
- FixedList<XmlElement> childElements_; //child elements in order of creation
+ std::list<XmlElement> childElements_; //child elements in order of creation
std::multimap<std::string, XmlElement*> childElementsSorted_; //alternate view: sorted by element name
XmlElement* parent_ = nullptr;
};
bgstack15