mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-03 04:17:52 +08:00
remove c++11 codes
This commit is contained in:
parent
f1dff79f70
commit
e6da6177c5
@ -19,172 +19,244 @@ namespace acl
|
||||
{
|
||||
|
||||
///////////////////////////////////type_traits//////////////////////////
|
||||
// TEMPLATE CLASS _Is_number
|
||||
|
||||
|
||||
struct true_type
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
struct false_type
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct _Is_number : std::false_type
|
||||
struct remove_const
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned short> : std::true_type
|
||||
template<class T>
|
||||
struct remove_const<const T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template<class T>
|
||||
struct remove_volatile
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<signed short> : std::true_type
|
||||
template<class T>
|
||||
struct remove_volatile<volatile T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned int> : std::true_type
|
||||
template<class T>
|
||||
struct remove_cv
|
||||
{
|
||||
typedef typename remove_const<typename remove_volatile<T>::type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<signed int> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned long> : std::true_type
|
||||
//remove_pointer
|
||||
template<class T>
|
||||
struct remove_pointer
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<signed long> : std::true_type
|
||||
template<class T>
|
||||
struct remove_pointer<T *>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<long long> : std::true_type
|
||||
template<class T>
|
||||
struct remove_pointer<T *const>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned long long> : std::true_type
|
||||
template<class T>
|
||||
struct remove_pointer<T *volatile>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template<class T>
|
||||
struct remove_pointer<T *const volatile>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template<bool ,
|
||||
class T = void>
|
||||
struct enable_if
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_number : _Is_number<typename std::remove_cv
|
||||
<typename std::remove_pointer<T>::type>::type>
|
||||
struct enable_if<true, T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//_Is_number
|
||||
template<class T>
|
||||
struct _Is_number : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned short> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<signed short> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned int> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<signed int> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned long> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<signed long> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<long long> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_number<unsigned long long> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_number : _Is_number<typename remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
//string
|
||||
template<class T>
|
||||
struct _Is_string : std::false_type
|
||||
struct _Is_string : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_string<std::string> : std::true_type
|
||||
struct _Is_string<std::string> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_string<acl::string> : std::true_type
|
||||
struct _Is_string<acl::string> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_string : _Is_string<typename std::remove_cv
|
||||
<typename std::remove_pointer<T>::type>::type>
|
||||
struct is_string : _Is_string<typename remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
//double
|
||||
template<class T>
|
||||
struct _Is_double : std::false_type
|
||||
struct _Is_double : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_double<float> : std::true_type
|
||||
struct _Is_double<float> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_double<double> : std::true_type
|
||||
struct _Is_double<double> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_double<long double> : std::true_type
|
||||
struct _Is_double<long double> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_double : _Is_double<typename std::remove_pointer
|
||||
<typename std::remove_pointer<T>::type>::type>
|
||||
struct is_double : _Is_double<typename remove_const<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
//char ptr. c string in cpp
|
||||
template<class T>
|
||||
struct _Is_char_ptr : std::false_type
|
||||
struct _Is_char_ptr : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_char_ptr<char*> : std::true_type
|
||||
struct _Is_char_ptr<char*> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_char_ptr :_Is_char_ptr<typename std::remove_cv<T>::type>
|
||||
struct is_char_ptr :_Is_char_ptr<typename remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct _Is_bool : std::false_type
|
||||
struct _Is_bool : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_bool<bool> : std::true_type
|
||||
struct _Is_bool<bool> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_bool : _Is_bool<typename std::remove_cv
|
||||
<typename std::remove_pointer<T>::type>::type>
|
||||
struct is_bool : _Is_bool<typename remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
template<bool T>
|
||||
struct _Is_object
|
||||
:std::false_type
|
||||
:false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Is_object<true> : std::true_type
|
||||
struct _Is_object<true> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_object : _Is_object
|
||||
<!is_string<T>::value
|
||||
&& !std::is_floating_point<typename std::remove_pointer
|
||||
<typename std::remove_pointer<T>::type>::type>::value
|
||||
&& !is_number<T>::value
|
||||
&& !is_bool<T>::value
|
||||
&& !is_char_ptr<T>::value>
|
||||
struct is_object : _Is_object<
|
||||
!is_string<T>::value &&
|
||||
!is_double<T>::value &&
|
||||
!is_number<T>::value &&
|
||||
!is_bool<T>::value &&
|
||||
!is_char_ptr<T>::value>
|
||||
{
|
||||
};
|
||||
//
|
||||
template <class T>
|
||||
typename std::enable_if<!std::is_pointer<T>::value, bool>::type
|
||||
static inline check_nullptr(T&)
|
||||
static inline bool check_nullptr(T&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<!std::is_pointer<T>::value, bool>::type
|
||||
static inline check_nullptr(T *t)
|
||||
static inline bool check_nullptr(T *t)
|
||||
{
|
||||
if (t == nullptr)
|
||||
return true;
|
||||
@ -193,17 +265,15 @@ static inline check_nullptr(T *t)
|
||||
|
||||
//acl::string ,std::string
|
||||
template<class T>
|
||||
typename std::enable_if<is_string<T>::value
|
||||
&& !std::is_pointer<T>::value, const char *>::type
|
||||
typename enable_if<is_string<T>::value, const char *>::type
|
||||
static inline get_value(const T &value)
|
||||
{
|
||||
return value.c_str();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_string<T>::value
|
||||
&& std::is_pointer<T>::value, const char *>::type
|
||||
static inline get_value(const T &value)
|
||||
typename enable_if<is_string<T>::value, const char *>::type
|
||||
static inline get_value(const T *value)
|
||||
{
|
||||
return value->c_str();
|
||||
}
|
||||
@ -227,8 +297,7 @@ static inline bool get_value(const bool* value)
|
||||
|
||||
//number
|
||||
template <class T>
|
||||
typename std::enable_if<is_number<T>::value
|
||||
&& !std::is_pointer<T>::value, T>::type
|
||||
typename enable_if<is_number<T>::value, T>::type
|
||||
static inline get_value(const T t)
|
||||
{
|
||||
return t;
|
||||
@ -237,22 +306,21 @@ static inline get_value(const T t)
|
||||
// number pointor -> number
|
||||
// eg: int * -> int .
|
||||
template <class T>
|
||||
typename std::enable_if<is_number<T>::value && std::is_pointer<T>::value,
|
||||
typename std::remove_pointer<T>::type>::type
|
||||
static inline get_value(const T &t)
|
||||
typename enable_if<is_number<T>::value, T>::type
|
||||
static inline get_value(const T *t)
|
||||
{
|
||||
return *t;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value, T>::type
|
||||
typename enable_if<is_double<T>::value, T>::type
|
||||
static inline get_value(const T &t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value , T>::type
|
||||
typename enable_if<is_double<T>::value, T>::type
|
||||
static inline get_value(const T *t)
|
||||
{
|
||||
return *t;
|
||||
@ -260,7 +328,7 @@ static inline get_value(const T *t)
|
||||
|
||||
// obj
|
||||
template<class T>
|
||||
typename std::enable_if<is_object<T>::value , void>::type
|
||||
typename enable_if<is_object<T>::value, void>::type
|
||||
static inline add_item(acl::json &json, acl::json_node &node, const T &obj)
|
||||
{
|
||||
if (check_nullptr(obj))
|
||||
@ -270,7 +338,7 @@ static inline add_item(acl::json &json, acl::json_node &node, const T &obj)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_object<T>::value , void>::type
|
||||
typename enable_if<is_object<T>::value, void>::type
|
||||
static inline add_item(acl::json &json, acl::json_node &node, const T *obj)
|
||||
{
|
||||
if (check_nullptr(obj))
|
||||
@ -281,7 +349,7 @@ static inline add_item(acl::json &json, acl::json_node &node, const T *obj)
|
||||
|
||||
// number
|
||||
template<class T>
|
||||
typename std::enable_if<is_number<T>::value, void>::type
|
||||
typename enable_if<is_number<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
{
|
||||
if (check_nullptr(value))
|
||||
@ -291,7 +359,7 @@ static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_number<T>::value, void>::type
|
||||
typename enable_if<is_number<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T *value)
|
||||
{
|
||||
if (check_nullptr(value))
|
||||
@ -301,8 +369,7 @@ static inline add_item(acl::json &, acl::json_node &node, T *value)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_floating_point<
|
||||
typename std::remove_pointer<T>::type>::value, void>::type
|
||||
typename enable_if<is_double<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
{
|
||||
if (check_nullptr(value))
|
||||
@ -313,7 +380,7 @@ static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
|
||||
//bool
|
||||
template<class T>
|
||||
typename std::enable_if<is_bool<T>::value, void>::type
|
||||
typename enable_if<is_bool<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
{
|
||||
if (check_nullptr(value))
|
||||
@ -336,12 +403,12 @@ acl::json_node &gson(acl::json &json, const std::list<V> &objects)
|
||||
return node;
|
||||
}
|
||||
|
||||
template<class V>
|
||||
template<class T>
|
||||
static inline
|
||||
acl::json_node &gson(acl::json &json, const std::list<V> *objects)
|
||||
acl::json_node &gson(acl::json &json, const std::list<T> *objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
for (typename std::list<V>::const_iterator
|
||||
for (typename std::list<T>::const_iterator
|
||||
itr = objects->begin(); itr != objects->end(); ++itr)
|
||||
{
|
||||
add_item(json, node, *itr);
|
||||
@ -350,12 +417,12 @@ acl::json_node &gson(acl::json &json, const std::list<V> *objects)
|
||||
return node;
|
||||
}
|
||||
|
||||
template<class V>
|
||||
template<class T>
|
||||
static inline
|
||||
acl::json_node &gson(acl::json &json, const std::vector<V> &objects)
|
||||
acl::json_node &gson(acl::json &json, const std::vector<T> &objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
for (typename std::vector<V>::const_iterator
|
||||
for (typename std::vector<T>::const_iterator
|
||||
itr = objects.begin(); itr != objects.end(); ++itr)
|
||||
{
|
||||
add_item(json, node, *itr);
|
||||
@ -364,16 +431,16 @@ acl::json_node &gson(acl::json &json, const std::vector<V> &objects)
|
||||
return node;
|
||||
}
|
||||
|
||||
template<class V>
|
||||
template<class T>
|
||||
static inline
|
||||
acl::json_node &gson(acl::json &json, const std::vector<V> *objects)
|
||||
acl::json_node &gson(acl::json &json, const std::vector<T> *objects)
|
||||
{
|
||||
return gson(json, *objects);
|
||||
}
|
||||
|
||||
//define number map
|
||||
template<class K, class V>
|
||||
typename std::enable_if<is_number<V>::value, acl::json_node &>::type
|
||||
typename enable_if<is_number<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -397,7 +464,7 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
|
||||
//define number map
|
||||
template<class K, class V>
|
||||
typename std::enable_if< is_number<V>::value, acl::json_node &>::type
|
||||
typename enable_if< is_number<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<K, V> *objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -421,7 +488,7 @@ static inline gson(acl::json &json, const std::map<K, V> *objects)
|
||||
|
||||
//define floating map
|
||||
template<class K, class V>
|
||||
typename std::enable_if<is_double<V>::value, acl::json_node &>::type
|
||||
typename enable_if<is_double<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -443,7 +510,7 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
}
|
||||
|
||||
template<class K, class V>
|
||||
typename std::enable_if<is_double<V>::value, acl::json_node &>::type
|
||||
typename enable_if<is_double<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<K, V> *objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -467,7 +534,7 @@ static inline gson(acl::json &json, const std::map<K, V> *objects)
|
||||
|
||||
//define bool map
|
||||
template<class K, class V>
|
||||
typename std::enable_if<is_bool<V>::value, acl::json_node &>::type
|
||||
typename enable_if<is_bool<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -490,7 +557,7 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
}
|
||||
|
||||
template<class K, class V>
|
||||
typename std::enable_if<is_string<V>::value
|
||||
typename enable_if<is_string<V>::value
|
||||
|| is_char_ptr<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<K, V> & objects)
|
||||
{
|
||||
@ -514,7 +581,7 @@ static inline gson(acl::json &json, const std::map<K, V> & objects)
|
||||
}
|
||||
|
||||
template<class T, class V>
|
||||
typename std::enable_if<is_object<V>::value, acl::json_node &>::type
|
||||
typename enable_if<is_object<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<T, V> &objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -538,7 +605,7 @@ static inline gson(acl::json &json,const std::map<T, V> &objects)
|
||||
}
|
||||
|
||||
template<class T, class V>
|
||||
typename std::enable_if<is_object<V>::value, acl::json_node &>::type
|
||||
typename enable_if<is_object<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, const std::map<T, V> *objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
@ -564,7 +631,7 @@ static inline gson(acl::json &json, const std::map<T, V> *objects)
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_class<T>::value,
|
||||
typename enable_if<is_object<T>::value,
|
||||
std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T **obj);
|
||||
|
||||
@ -603,7 +670,7 @@ static inline std::pair<bool, std::string> gson(acl::json_node &node, bool **obj
|
||||
|
||||
//double
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value,
|
||||
typename enable_if<is_double<T>::value,
|
||||
std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T *obj)
|
||||
{
|
||||
@ -615,7 +682,7 @@ static inline gson(acl::json_node &node, T *obj)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value,
|
||||
typename enable_if<is_double<T>::value,
|
||||
std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T **obj)
|
||||
{
|
||||
@ -629,7 +696,7 @@ static inline gson(acl::json_node &node, T **obj)
|
||||
|
||||
//intergral
|
||||
template <class T>
|
||||
typename std::enable_if<is_number<T>::value, std::pair<bool, std::string>>::type
|
||||
typename enable_if<is_number<T>::value, std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T *obj)
|
||||
{
|
||||
if (node.is_number() == false)
|
||||
@ -640,7 +707,7 @@ static inline gson(acl::json_node &node, T *obj)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<is_number<T>::value, std::pair<bool, std::string>>::type
|
||||
typename enable_if<is_number<T>::value, std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T **obj)
|
||||
{
|
||||
if (node.is_number() == false)
|
||||
@ -652,25 +719,21 @@ static inline gson(acl::json_node &node, T **obj)
|
||||
}
|
||||
|
||||
//string
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_same<T,char>::value,
|
||||
std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T **obj)
|
||||
static inline
|
||||
std::pair<bool, std::string> gson(acl::json_node &node, char **obj)
|
||||
{
|
||||
if (node.is_string() == false)
|
||||
return std::make_pair(false, "get char * string failed");
|
||||
int len = strlen(node.get_string());
|
||||
*obj = new T[len + 1];
|
||||
*obj = new char[len + 1];
|
||||
memcpy(*obj, node.get_string(), len);
|
||||
(*obj)[len] = 0;
|
||||
|
||||
return std::make_pair(true, "");
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_string<T>::value
|
||||
&& !std::is_pointer<T>::value, std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T *obj)
|
||||
static inline std::pair<bool, std::string>
|
||||
gson(acl::json_node &node, acl::string *obj)
|
||||
{
|
||||
if (node.is_string() == false)
|
||||
return std::make_pair(false, "get string failed");
|
||||
@ -678,10 +741,28 @@ static inline gson(acl::json_node &node, T *obj)
|
||||
|
||||
return std::make_pair(true, "");
|
||||
}
|
||||
static inline std::pair<bool, std::string>
|
||||
gson(acl::json_node &node, acl::string **obj)
|
||||
{
|
||||
if (node.is_string() == false)
|
||||
return std::make_pair(false, "get string failed");
|
||||
*obj = new acl::string;
|
||||
(*obj)->append(node.get_string());
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_string<T>::value, std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, std::string **obj)
|
||||
return std::make_pair(true, "");
|
||||
}
|
||||
|
||||
static inline std::pair<bool, std::string>
|
||||
gson(acl::json_node &node, std::string *obj)
|
||||
{
|
||||
if (node.is_string() == false)
|
||||
return std::make_pair(false, "get string failed");
|
||||
obj->append(node.get_string());
|
||||
|
||||
return std::make_pair(true, "");
|
||||
}
|
||||
static inline std::pair<bool, std::string>
|
||||
gson(acl::json_node &node, std::string **obj)
|
||||
{
|
||||
if (node.is_string() == false)
|
||||
return std::make_pair(false, "get string failed");
|
||||
@ -736,7 +817,7 @@ static inline gson(acl::json_node &node, std::vector<T> *objs)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_class<T>::value,
|
||||
typename enable_if<is_object<T>::value,
|
||||
std::pair<bool, std::string>>::type
|
||||
static inline gson(acl::json_node &node, T **obj)
|
||||
{
|
||||
@ -756,12 +837,12 @@ static inline gson(acl::json_node &node, T **obj)
|
||||
//int map
|
||||
|
||||
template<class K, class T>
|
||||
typename std::enable_if
|
||||
<is_string<T>::value
|
||||
|| is_bool<T>::value
|
||||
|| is_number<T>::value
|
||||
|| is_double<T>::value
|
||||
|| is_char_ptr<T>::value,
|
||||
typename enable_if<
|
||||
is_string<T>::value||
|
||||
is_bool<T>::value||
|
||||
is_number<T>::value||
|
||||
is_double<T>::value||
|
||||
is_char_ptr<T>::value,
|
||||
std::pair<bool, std::string>>::type
|
||||
static inline expand(acl::json_node &node, std::map<K, T> *objs)
|
||||
{
|
||||
@ -792,9 +873,8 @@ static inline expand(acl::json_node &node, std::map<K, T> *objs)
|
||||
}
|
||||
|
||||
template<class K, class T>
|
||||
typename std::enable_if
|
||||
<std::is_class<typename std::remove_pointer<T>::type>::value
|
||||
&& !is_string<T>::value, std::pair<bool, std::string>>::type
|
||||
typename enable_if <is_object<T>::value ,
|
||||
std::pair<bool, std::string >> ::type
|
||||
static inline expand(acl::json_node &node, std::map<K, T> *objs)
|
||||
{
|
||||
std::pair<bool, std::string> result;
|
||||
|
Loading…
Reference in New Issue
Block a user