HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_ConvertToType.h File Reference
#include "NET_API.h"
#include <UT/UT_IntArray.h>
#include <UT/UT_JSONValue.h>
#include <UT/UT_JSONWriter.h>
#include <UT/UT_SGuid.h>
#include <UT/UT_String.h>
#include <UT/UT_StringArray.h>
#include <UT/UT_StringHolder.h>
#include <UT/UT_StringSet.h>
#include <UT/UT_StringView.h>
#include <UT/UT_WorkBuffer.h>
#include <type_traits>
+ Include dependency graph for NET_ConvertToType.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  NET_EmptySerializer
 
struct  NET_ConvertToType::NET_remove_cref< T >
 
class  NET_ConvertToType::convertImpl< Tto, Enable >
 
class  NET_ConvertToType::convertImpl< Tto, std::enable_if_t< std::is_same< UT_StringHolder, NET_remove_cref_t< Tto > >::value > >
 
class  NET_ConvertToType::convertImpl< Tto, std::enable_if_t< std::is_same< UT_StringArray, NET_remove_cref_t< Tto > >::value > >
 
class  NET_ConvertToType::convertImpl< Tto, std::enable_if_t< std::is_same< UT_IntArray, NET_remove_cref_t< Tto > >::value > >
 
class  NET_ConvertToType::convertImpl< Tto, std::enable_if_t< std::is_integral< Tto >::value &&!std::is_same< Tto, bool >::value > >
 
class  NET_ConvertToType::convertImpl< Tto, std::enable_if_t< std::is_floating_point< Tto >::value > >
 
class  NET_ConvertToType::convertImpl< Tto, std::enable_if_t< std::is_same< bool, Tto >::value > >
 

Namespaces

 NET_ConvertToType
 

Macros

#define NET_REQUIRE(_cond_)   std::enable_if_t<_cond_>
 
#define NET_DEFINE_INT_SERIALIZER(_T_)
 
#define NET_DEFINE_ARRAY_SERIALIZER(_ARRAY_)
 
#define NET_DEFINE_SET_SERIALIZER(_SET_)
 

Typedefs

using NET_UnusedParameter = NET_EmptySerializer
 
template<class T >
using NET_ConvertToType::NET_remove_cref_t = typename NET_remove_cref< T >::type
 

Functions

template<typename T >
bool NETserialize (UT_JSONWriter &writer, const T &obj)
 
template<typename T >
bool NETserialize (const UT_JSONValue &data, T &obj)
 
 NET_DEFINE_INT_SERIALIZER (int8)
 
 NET_DEFINE_INT_SERIALIZER (int16)
 
 NET_DEFINE_INT_SERIALIZER (int32)
 
template<>
bool NETserialize< int64 > (UT_JSONWriter &writer, const int64 &obj)
 
template<>
bool NETserialize< int64 > (const UT_JSONValue &data, int64 &obj)
 
template<>
bool NETserialize< uint32 > (UT_JSONWriter &writer, const uint32 &obj)
 
template<>
bool NETserialize< uint32 > (const UT_JSONValue &data, uint32 &obj)
 
template<>
bool NETserialize< bool > (UT_JSONWriter &writer, const bool &obj)
 
template<>
bool NETserialize< bool > (const UT_JSONValue &data, bool &item)
 
template<>
bool NETserialize< UT_StringHolder > (UT_JSONWriter &writer, const UT_StringHolder &obj)
 
template<>
bool NETserialize< UT_StringHolder > (const UT_JSONValue &data, UT_StringHolder &obj)
 
template<>
bool NETserialize< UT_StringRef > (UT_JSONWriter &writer, const UT_StringRef &obj)
 
template<>
bool NETserialize< UT_StringRef > (const UT_JSONValue &data, UT_StringRef &obj)
 
template<>
bool NETserialize< UT_String > (UT_JSONWriter &writer, const UT_String &obj)
 
template<>
bool NETserialize< UT_String > (const UT_JSONValue &data, UT_String &obj)
 
template<>
bool NETserialize< UT_StringLit > (UT_JSONWriter &writer, const UT_StringLit &obj)
 
template<>
bool NETserialize< UT_StringLit > (const UT_JSONValue &data, UT_StringLit &)=delete
 
template<>
bool NETserialize< UT_WorkBuffer > (UT_JSONWriter &writer, const UT_WorkBuffer &obj)
 
template<>
bool NETserialize< UT_WorkBuffer > (const UT_JSONValue &data, UT_WorkBuffer &obj)
 
template<>
bool NETserialize< UT_SGuid > (UT_JSONWriter &writer, const UT_SGuid &id)
 
template<>
bool NETserialize< UT_SGuid > (const UT_JSONValue &data, UT_SGuid &id)
 
template<typename T , template< typename > class ARRAY>
bool NETserializeArray (UT_JSONWriter &writer, const ARRAY< T > &items)
 
template<typename T , template< typename > class ARRAY>
bool NETserializeArray (const UT_JSONValue &data, ARRAY< T > &items)
 
template<>
bool NETserialize< UT_StringArray > (UT_JSONWriter &writer, const UT_StringArray &items)
 
template<>
bool NETserialize< UT_StringArray > (const UT_JSONValue &data, UT_StringArray &items)
 
template<typename SetT >
bool NETserializeSet (UT_JSONWriter &writer, const SetT &items)
 
template<typename SetT >
bool NETserializeSet (const UT_JSONValue &data, SetT &items)
 
template<>
bool NETserialize< UT_StringSet > (UT_JSONWriter &writer, const UT_StringSet &items)
 
template<>
bool NETserialize< UT_StringSet > (const UT_JSONValue &data, UT_StringSet &items)
 
template<>
bool NETserialize< UT_JSONValue > (UT_JSONWriter &writer, const UT_JSONValue &value)
 
template<>
bool NETserialize< UT_JSONValue > (const UT_JSONValue &data, UT_JSONValue &item)
 
template<>
bool NETserialize< NET_EmptySerializer > (UT_JSONWriter &writer, const NET_EmptySerializer &)
 
template<>
bool NETserialize< NET_EmptySerializer > (const UT_JSONValue &data, NET_EmptySerializer &)
 
template<typename Tto , typename Tfrom >
Tto convert (const Tfrom &source)
 

Macro Definition Documentation

#define NET_DEFINE_ARRAY_SERIALIZER (   _ARRAY_)
Value:
template <typename T> \
inline bool NETserialize(UT_JSONWriter& writer, const _ARRAY_<typename T::value_type>& items) \
{ \
return NETserializeArray<typename T::value_type, _ARRAY_>(writer, items); \
} \
template <typename T> \
inline bool NETserialize(const UT_JSONValue& data, _ARRAY_<typename T::value_type>& items) \
{ \
return NETserializeArray<typename T::value_type, _ARRAY_>(data, items); \
}
GLboolean * data
Definition: glcorearb.h:131
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
bool NETserialize(UT_JSONWriter &writer, const T &obj)
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
Definition: format.h:895

Definition at line 246 of file NET_ConvertToType.h.

#define NET_DEFINE_INT_SERIALIZER (   _T_)
Value:
template <> \
inline bool NETserialize<_T_>(UT_JSONWriter& writer, const _T_& obj) \
{ \
writer.jsonValue(obj); \
return true; \
} \
template <> \
inline bool NETserialize<_T_>(const UT_JSONValue& data, _T_& item) \
{ \
int64 v = 0; \
bool res = data.import(v); \
item = static_cast<_T_>(v); \
return res; \
}
GLboolean * data
Definition: glcorearb.h:131
const GLdouble * v
Definition: glcorearb.h:837
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
long long int64
Definition: SYS_Types.h:116
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99

Definition at line 51 of file NET_ConvertToType.h.

#define NET_DEFINE_SET_SERIALIZER (   _SET_)
Value:
template <typename T> \
inline bool NETserialize(UT_JSONWriter& writer, const _SET_<typename T::value_type>& items) \
{ \
return NETserializeSet<T>(writer, items); \
} \
template <typename T> \
inline bool NETserialize(const UT_JSONValue& data, _SET_<typename T::value_type>& items) \
{ \
return NETserializeSet<T>(data, items); \
}
GLboolean * data
Definition: glcorearb.h:131
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
bool NETserialize(UT_JSONWriter &writer, const T &obj)
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
Definition: format.h:895

Definition at line 322 of file NET_ConvertToType.h.

#define NET_REQUIRE (   _cond_)    std::enable_if_t<_cond_>

Definition at line 29 of file NET_ConvertToType.h.

Typedef Documentation

Definition at line 389 of file NET_ConvertToType.h.

Function Documentation

template<typename Tto , typename Tfrom >
Tto convert ( const Tfrom &  source)

Definition at line 545 of file NET_ConvertToType.h.

NET_DEFINE_INT_SERIALIZER ( int8  )
NET_DEFINE_INT_SERIALIZER ( int16  )
NET_DEFINE_INT_SERIALIZER ( int32  )
template<typename T >
bool NETserialize ( UT_JSONWriter writer,
const T &  obj 
)

Definition at line 36 of file NET_ConvertToType.h.

template<typename T >
bool NETserialize ( const UT_JSONValue data,
T &  obj 
)

Definition at line 42 of file NET_ConvertToType.h.

template<>
bool NETserialize< bool > ( UT_JSONWriter writer,
const bool &  obj 
)
inline

Definition at line 105 of file NET_ConvertToType.h.

template<>
bool NETserialize< bool > ( const UT_JSONValue data,
bool &  item 
)
inline

Definition at line 112 of file NET_ConvertToType.h.

template<>
bool NETserialize< int64 > ( UT_JSONWriter writer,
const int64 obj 
)
inline

Definition at line 72 of file NET_ConvertToType.h.

template<>
bool NETserialize< int64 > ( const UT_JSONValue data,
int64 obj 
)
inline

Definition at line 79 of file NET_ConvertToType.h.

template<>
bool NETserialize< NET_EmptySerializer > ( UT_JSONWriter writer,
const NET_EmptySerializer  
)
inline

Definition at line 393 of file NET_ConvertToType.h.

template<>
bool NETserialize< NET_EmptySerializer > ( const UT_JSONValue data,
NET_EmptySerializer  
)
inline

Definition at line 402 of file NET_ConvertToType.h.

template<>
bool NETserialize< uint32 > ( UT_JSONWriter writer,
const uint32 obj 
)
inline

Definition at line 85 of file NET_ConvertToType.h.

template<>
bool NETserialize< uint32 > ( const UT_JSONValue data,
uint32 obj 
)
inline

Definition at line 92 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_JSONValue > ( UT_JSONWriter writer,
const UT_JSONValue value 
)
inline

Definition at line 364 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_JSONValue > ( const UT_JSONValue data,
UT_JSONValue item 
)
inline

Definition at line 371 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_SGuid > ( UT_JSONWriter writer,
const UT_SGuid id 
)
inline

Definition at line 194 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_SGuid > ( const UT_JSONValue data,
UT_SGuid id 
)
inline

Definition at line 201 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_String > ( UT_JSONWriter writer,
const UT_String obj 
)
inline

Definition at line 148 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_String > ( const UT_JSONValue data,
UT_String obj 
)
inline

Definition at line 154 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringArray > ( UT_JSONWriter writer,
const UT_StringArray items 
)
inline

Definition at line 262 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringArray > ( const UT_JSONValue data,
UT_StringArray items 
)
inline

Definition at line 268 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringHolder > ( UT_JSONWriter writer,
const UT_StringHolder obj 
)
inline

Definition at line 122 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringHolder > ( const UT_JSONValue data,
UT_StringHolder obj 
)
inline

Definition at line 129 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringLit > ( UT_JSONWriter writer,
const UT_StringLit obj 
)
inline

Definition at line 163 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringLit > ( const UT_JSONValue data,
UT_StringLit  
)
inlinedelete
template<>
bool NETserialize< UT_StringRef > ( UT_JSONWriter writer,
const UT_StringRef obj 
)
inline

Definition at line 135 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringRef > ( const UT_JSONValue data,
UT_StringRef obj 
)
inline

Definition at line 142 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringSet > ( UT_JSONWriter writer,
const UT_StringSet items 
)
inline

Definition at line 338 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_StringSet > ( const UT_JSONValue data,
UT_StringSet items 
)
inline

Definition at line 345 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_WorkBuffer > ( UT_JSONWriter writer,
const UT_WorkBuffer obj 
)
inline

Definition at line 177 of file NET_ConvertToType.h.

template<>
bool NETserialize< UT_WorkBuffer > ( const UT_JSONValue data,
UT_WorkBuffer obj 
)
inline

Definition at line 184 of file NET_ConvertToType.h.

template<typename T , template< typename > class ARRAY>
bool NETserializeArray ( UT_JSONWriter writer,
const ARRAY< T > &  items 
)
inline

Definition at line 215 of file NET_ConvertToType.h.

template<typename T , template< typename > class ARRAY>
bool NETserializeArray ( const UT_JSONValue data,
ARRAY< T > &  items 
)
inline

Definition at line 225 of file NET_ConvertToType.h.

template<typename SetT >
bool NETserializeSet ( UT_JSONWriter writer,
const SetT &  items 
)
inline

Definition at line 286 of file NET_ConvertToType.h.

template<typename SetT >
bool NETserializeSet ( const UT_JSONValue data,
SetT &  items 
)
inline

Definition at line 297 of file NET_ConvertToType.h.