HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
textParserUtils.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
8 #ifndef PXR_USD_SDF_TEXT_PARSER_UTILS_H
9 #define PXR_USD_SDF_TEXT_PARSER_UTILS_H
10 
11 #include "pxr/base/vt/value.h"
12 #include "pxr/usd/sdf/api.h"
13 
15 
16 class SdfValueTypeName;
17 
18 /// Attempt to parse a VtValue from a string representing a value
19 /// given the expected sdf type. The parse follows the expectations of
20 /// the .usda file format. On success, returns a corresponding VtValue.
21 /// On failure, returns an empty VtValue and populates TfError(s).
22 SDF_API
23 VtValue Sdf_ParseValueFromString(const std::string& input,
24  const SdfValueTypeName& expectedSdfType);
25 
26 /// Add quotes around given string, escaping inner quotes and
27 /// unprintable characters as necessary. If the string contains newlines
28 /// it's quoted with triple quotes and the newlines are not escaped.
29 SDF_API
30 std::string Sdf_QuoteString(const std::string& input);
31 
32 /// Add @'s around a given path to produce a string representation of
33 /// an asset path. If the path contains @, @@@ will be added around the
34 /// path. If the path contains @@@, the contained @@@ will be escaped.
35 SDF_API
36 std::string Sdf_QuoteAssetPath(const std::string& path);
37 
39 
40 #endif
SDF_API std::string Sdf_QuoteString(const std::string &input)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
SDF_API VtValue Sdf_ParseValueFromString(const std::string &input, const SdfValueTypeName &expectedSdfType)
#define SDF_API
Definition: api.h:23
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
SDF_API std::string Sdf_QuoteAssetPath(const std::string &path)
Definition: value.h:89