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_JSONValueArray.h>
#include <UT/UT_JSONValueMap.h>
#include <UT/UT_JSONWriter.h>
#include <UT/UT_String.h>
#include <UT/UT_StringArray.h>
#include <UT/UT_StringHolder.h>
#include <UT/UT_StringView.h>
#include <UT/UT_Variant.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

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_)
 

Typedefs

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_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<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<>
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< UT_VariantArray > (UT_JSONWriter &writer, const UT_VariantArray &value)
 
template<>
bool NETserialize< UT_VariantArray > (const UT_JSONValue &data, UT_VariantArray &value)
 
template<>
bool NETserialize< UT_VariantMap > (UT_JSONWriter &writer, const UT_VariantMap &value)
 
template<>
bool NETserialize< UT_VariantMap > (const UT_JSONValue &data, UT_VariantMap &value)
 
template<>
bool NETserialize< UT_Variant > (UT_JSONWriter &writer, const UT_Variant &v)
 
template<>
bool NETserialize< UT_Variant > (const UT_JSONValue &data, UT_Variant &v)
 
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); \
}
basic_writer< back_insert_range< internal::buffer > > writer
Definition: format.h:361
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
bool NETserialize(UT_JSONWriter &writer, const T &obj)
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:77

Definition at line 211 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; \
}
basic_writer< back_insert_range< internal::buffer > > writer
Definition: format.h:361
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
const GLdouble * v
Definition: glew.h:1391
GLhandleARB obj
Definition: glew.h:6236
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
long long int64
Definition: SYS_Types.h:116
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:77
GLuint res
Definition: glew.h:11507

Definition at line 52 of file NET_ConvertToType.h.

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

Definition at line 30 of file NET_ConvertToType.h.

Function Documentation

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

Definition at line 559 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 37 of file NET_ConvertToType.h.

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

Definition at line 43 of file NET_ConvertToType.h.

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

Definition at line 106 of file NET_ConvertToType.h.

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

Definition at line 113 of file NET_ConvertToType.h.

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

Definition at line 73 of file NET_ConvertToType.h.

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

Definition at line 80 of file NET_ConvertToType.h.

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

Definition at line 86 of file NET_ConvertToType.h.

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

Definition at line 93 of file NET_ConvertToType.h.

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

Definition at line 243 of file NET_ConvertToType.h.

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

Definition at line 250 of file NET_ConvertToType.h.

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

Definition at line 136 of file NET_ConvertToType.h.

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

Definition at line 142 of file NET_ConvertToType.h.

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

Definition at line 227 of file NET_ConvertToType.h.

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

Definition at line 233 of file NET_ConvertToType.h.

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

Definition at line 123 of file NET_ConvertToType.h.

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

Definition at line 130 of file NET_ConvertToType.h.

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

Definition at line 151 of file NET_ConvertToType.h.

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

Definition at line 272 of file NET_ConvertToType.h.

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

Definition at line 301 of file NET_ConvertToType.h.

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

Definition at line 340 of file NET_ConvertToType.h.

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

Definition at line 356 of file NET_ConvertToType.h.

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

Definition at line 383 of file NET_ConvertToType.h.

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

Definition at line 402 of file NET_ConvertToType.h.

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

Definition at line 165 of file NET_ConvertToType.h.

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

Definition at line 172 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 182 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 192 of file NET_ConvertToType.h.