HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usdaData.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 #ifndef PXR_USD_SDF_USDA_DATA_H
8 #define PXR_USD_SDF_USDA_DATA_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/sdf/data.h"
13 #include "pxr/usd/ar/asset.h"
14 
16 
18 
19 // SdfUsdaData is an SdfData for text files. It has several static methods that
20 // are convenient for determining if a text file can be read or for parsing the
21 // header of a text file. Otherwise, it is just an SdfData that also keeps track
22 // of an SdfFileVersion for the layer.
23 class SdfUsdaData: public SdfData
24 {
25 public:
26  SDF_API
27  SdfUsdaData();
28 
29  SDF_API
30  virtual ~SdfUsdaData();
31 
32  SDF_API
33  static bool
34  CanRead(const std::string& assetPath);
35 
36  SDF_API
37  static bool
38  CanRead(const std::string& assetPath,
39  const std::shared_ptr<ArAsset>& asset);
40 
41  // Validate a layer's version string.
42  //
43  // If the version string represents a version that we can read, return the
44  // SdfFileVersion and empty the string pointed to by reason. If the version
45  // string cannot be read, return an invalid version and store an appropriate
46  // error message in *reason.
47  SDF_API
48  static SdfFileVersion
49  ValidateLayerVersionString(const std::string& versionStr,
50  std::string* reason);
51 
52  // The version of this layer.
53  SDF_API
56  {
57  return _layerVersion;
58  }
59 
60  // Set the version as parsed from the file (if it is a legal version)
61  SDF_API
62  void
64 
65 private:
66  SdfFileVersion _layerVersion;
67 };
68 
70 
71 #endif // PXR_USD_SDF_USDA_DATA_H
virtual SDF_API ~SdfUsdaData()
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(SdfUsdaData)
SDF_API SdfUsdaData()
SDF_API void SetLayerVersion(const SdfFileVersion &version)
Definition: data.h:32
SDF_API SdfFileVersion GetLayerVersion() const
Definition: usdaData.h:55
GT_API const UT_StringHolder version
#define SDF_API
Definition: api.h:23
static SDF_API bool CanRead(const std::string &assetPath)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static SDF_API SdfFileVersion ValidateLayerVersionString(const std::string &versionStr, std::string *reason)