HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_JS_UTILS_H
8 #define PXR_BASE_JS_UTILS_H
9 
10 /// \file js/utils.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/base/js/api.h"
14 #include "pxr/base/js/value.h"
15 
16 #include <optional>
17 #include <string>
18 
20 
21 typedef std::optional<JsValue> JsOptionalValue;
22 
23 /// Returns the value associated with \p key in the given \p object. If no
24 /// such key exists, and the supplied default is not supplied, this method
25 /// returns an uninitialized optional JsValue. Otherwise, the \p
26 /// defaultValue is returned.
27 JS_API
29  const JsObject& object,
30  const std::string& key,
31  const JsOptionalValue& defaultValue = std::nullopt);
32 
34 
35 #endif // PXR_BASE_JS_UTILS_H
#define JS_API
Definition: api.h:23
std::map< std::string, JsValue > JsObject
Definition: types.h:20
PXR_NAMESPACE_OPEN_SCOPE typedef std::optional< JsValue > JsOptionalValue
Definition: utils.h:21
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
JS_API JsOptionalValue JsFindValue(const JsObject &object, const std::string &key, const JsOptionalValue &defaultValue=std::nullopt)