24 #ifndef PXR_BASE_JS_CONVERTER_H
25 #define PXR_BASE_JS_CONVERTER_H
37 template <
class ValueType,
class MapType,
bool UseInt64 = true>
47 template <
class ValueType,
class MapType>
78 template <
class ValueType,
class MapType,
bool UseInt64 = true>
81 typedef std::vector<ValueType> VectorType;
87 return _ToValueType(value);
116 static MapType _ObjectToMap(
const JsObject&
object) {
118 for (
const auto& p :
object) {
119 result[p.first] = _ToValueType(p.second);
125 static VectorType _ArrayToVector(
const JsArray& array) {
127 result.reserve(array.size());
128 for (
const auto& value : array) {
129 result.push_back(_ToValueType(value));
138 template <
class ValueType,
class MapType>
145 #endif // PXR_BASE_JS_CONVERTER_H
JS_API int GetInt() const
JS_API int64_t GetInt64() const
ValueType JsConvertToContainerType(const JsValue &value)
JS_API double GetReal() const
**But if you need a result
static ValueType Apply(const JsValue &value)
std::vector< JsValue > JsArray
JS_API const std::string & GetString() const
static ValueType Convert(const JsValue &value)
std::map< std::string, JsValue > JsObject
static ValueType Apply(const JsValue &value)
JS_API Type GetType() const
Returns the type of this value.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
JS_API uint64_t GetUInt64() const
JS_API bool GetBool() const
JS_API const JsArray & GetJsArray() const
#define PXR_NAMESPACE_CLOSE_SCOPE
JS_API const JsObject & GetJsObject() const
JS_API bool IsUInt64() const
Returns true if this value is holding a 64-bit unsigned integer.