-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge from update-ext-structural-metadata
- Loading branch information
Showing
12 changed files
with
450 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
CesiumGltf/generated/include/CesiumGltf/ExtensionExtStructuralMetadata.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// This file was generated by generate-classes. | ||
// DO NOT EDIT THIS FILE! | ||
#pragma once | ||
|
||
#include <CesiumGltf/Library.h> | ||
#include <CesiumUtility/ExtensibleObject.h> | ||
#include <CesiumUtility/JsonValue.h> | ||
|
||
#include <optional> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
namespace CesiumGltf { | ||
/** | ||
* @brief Structural metadata about a glTF element. | ||
*/ | ||
struct CESIUMGLTF_API ExtensionExtStructuralMetadata final | ||
: public CesiumUtility::ExtensibleObject { | ||
/** | ||
* @brief The original name of this type. | ||
*/ | ||
static constexpr const char* TypeName = "ExtensionExtStructuralMetadata"; | ||
/** @brief The official name of the extension. This should be the same as its | ||
* key in the `extensions` object. */ | ||
static constexpr const char* ExtensionName = "EXT_structural_metadata"; | ||
|
||
/** | ||
* @brief The class that property values conform to. The value shall be a | ||
* class ID declared in the `classes` dictionary of the metadata schema. | ||
*/ | ||
std::optional<std::string> classProperty; | ||
|
||
/** | ||
* @brief A dictionary, where each key corresponds to a property ID in the | ||
* class' `properties` dictionary and each value contains the property values. | ||
* The type of the value shall match the property definition: For `BOOLEAN` | ||
* use `true` or `false`. For `STRING` use a JSON string. For numeric types | ||
* use a JSON number. For `ENUM` use a valid enum `name`, not an integer | ||
* value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing | ||
* values matching the `componentType`. Required properties shall be included | ||
* in this dictionary. | ||
*/ | ||
std::unordered_map<std::string, CesiumUtility::JsonValue> properties; | ||
|
||
/** | ||
* @brief Calculates the size in bytes of this object, including the contents | ||
* of all collections, pointers, and strings. This will NOT include the size | ||
* of any extensions attached to the object. Calling this method may be slow | ||
* as it requires traversing the object's entire structure. | ||
*/ | ||
int64_t getSizeBytes() const { | ||
int64_t accum = 0; | ||
accum += int64_t(sizeof(ExtensionExtStructuralMetadata)); | ||
accum += CesiumUtility::ExtensibleObject::getSizeBytes() - | ||
int64_t(sizeof(CesiumUtility::ExtensibleObject)); | ||
if (this->classProperty) { | ||
accum += int64_t(this->classProperty->capacity() * sizeof(char)); | ||
} | ||
accum += int64_t( | ||
this->properties.bucket_count() * | ||
(sizeof(std::string) + sizeof(CesiumUtility::JsonValue))); | ||
for (const auto& [k, v] : this->properties) { | ||
accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string)); | ||
accum += int64_t(sizeof(CesiumUtility::JsonValue)); | ||
} | ||
return accum; | ||
} | ||
}; | ||
} // namespace CesiumGltf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
CesiumGltfReader/generated/include/CesiumGltfReader/ExtensionExtStructuralMetadataReader.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// This file was generated by generate-classes. | ||
// DO NOT EDIT THIS FILE! | ||
#pragma once | ||
|
||
#include <CesiumGltf/ExtensionExtStructuralMetadata.h> | ||
#include <CesiumGltfReader/Library.h> | ||
#include <CesiumJsonReader/JsonReader.h> | ||
#include <CesiumJsonReader/JsonReaderOptions.h> | ||
|
||
#include <rapidjson/fwd.h> | ||
|
||
#include <span> | ||
#include <vector> | ||
|
||
namespace CesiumGltf { | ||
struct ExtensionExtStructuralMetadata; | ||
} // namespace CesiumGltf | ||
|
||
namespace CesiumGltfReader { | ||
|
||
/** | ||
* @brief Reads \ref CesiumGltf::ExtensionExtStructuralMetadata | ||
* "ExtensionExtStructuralMetadata" instances from JSON. | ||
*/ | ||
class CESIUMGLTFREADER_API ExtensionExtStructuralMetadataReader { | ||
public: | ||
/** | ||
* @brief Constructs a new instance. | ||
*/ | ||
ExtensionExtStructuralMetadataReader(); | ||
|
||
/** | ||
* @brief Gets the options controlling how the JSON is read. | ||
*/ | ||
CesiumJsonReader::JsonReaderOptions& getOptions(); | ||
|
||
/** | ||
* @brief Gets the options controlling how the JSON is read. | ||
*/ | ||
const CesiumJsonReader::JsonReaderOptions& getOptions() const; | ||
|
||
/** | ||
* @brief Reads an instance of ExtensionExtStructuralMetadata from a byte | ||
* buffer. | ||
* | ||
* @param data The buffer from which to read the instance. | ||
* @return The result of reading the instance. | ||
*/ | ||
CesiumJsonReader::ReadJsonResult<CesiumGltf::ExtensionExtStructuralMetadata> | ||
readFromJson(const std::span<const std::byte>& data) const; | ||
|
||
/** | ||
* @brief Reads an instance of ExtensionExtStructuralMetadata from a | ||
* rapidJson::Value. | ||
* | ||
* @param value The value from which to read the instance. | ||
* @return The result of reading the instance. | ||
*/ | ||
CesiumJsonReader::ReadJsonResult<CesiumGltf::ExtensionExtStructuralMetadata> | ||
readFromJson(const rapidjson::Value& value) const; | ||
|
||
/** | ||
* @brief Reads an array of instances of ExtensionExtStructuralMetadata from a | ||
* rapidJson::Value. | ||
* | ||
* @param value The value from which to read the array of instances. | ||
* @return The result of reading the array of instances. | ||
*/ | ||
CesiumJsonReader::ReadJsonResult< | ||
std::vector<CesiumGltf::ExtensionExtStructuralMetadata>> | ||
readArrayFromJson(const rapidjson::Value& value) const; | ||
|
||
private: | ||
CesiumJsonReader::JsonReaderOptions _options; | ||
}; | ||
|
||
} // namespace CesiumGltfReader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
CesiumGltfReader/generated/src/ExtensionExtStructuralMetadataJsonHandler.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// This file was generated by generate-classes. | ||
// DO NOT EDIT THIS FILE! | ||
#pragma once | ||
|
||
#include <CesiumGltf/ExtensionExtStructuralMetadata.h> | ||
#include <CesiumJsonReader/DictionaryJsonHandler.h> | ||
#include <CesiumJsonReader/ExtensibleObjectJsonHandler.h> | ||
#include <CesiumJsonReader/JsonObjectJsonHandler.h> | ||
#include <CesiumJsonReader/StringJsonHandler.h> | ||
|
||
namespace CesiumJsonReader { | ||
class JsonReaderOptions; | ||
} // namespace CesiumJsonReader | ||
|
||
namespace CesiumGltfReader { | ||
class ExtensionExtStructuralMetadataJsonHandler | ||
: public CesiumJsonReader::ExtensibleObjectJsonHandler, | ||
public CesiumJsonReader::IExtensionJsonHandler { | ||
public: | ||
using ValueType = CesiumGltf::ExtensionExtStructuralMetadata; | ||
|
||
static constexpr const char* ExtensionName = "EXT_structural_metadata"; | ||
|
||
explicit ExtensionExtStructuralMetadataJsonHandler( | ||
const CesiumJsonReader::JsonReaderOptions& options) noexcept; | ||
void reset( | ||
IJsonHandler* pParentHandler, | ||
CesiumGltf::ExtensionExtStructuralMetadata* pObject); | ||
|
||
IJsonHandler* readObjectKey(const std::string_view& str) override; | ||
|
||
void reset( | ||
IJsonHandler* pParentHandler, | ||
CesiumUtility::ExtensibleObject& o, | ||
const std::string_view& extensionName) override; | ||
|
||
IJsonHandler& getHandler() override { return *this; } | ||
|
||
protected: | ||
IJsonHandler* readObjectKeyExtensionExtStructuralMetadata( | ||
const std::string& objectType, | ||
const std::string_view& str, | ||
CesiumGltf::ExtensionExtStructuralMetadata& o); | ||
|
||
private: | ||
CesiumGltf::ExtensionExtStructuralMetadata* _pObject = nullptr; | ||
CesiumJsonReader::StringJsonHandler _classProperty; | ||
CesiumJsonReader::DictionaryJsonHandler< | ||
CesiumUtility::JsonValue, | ||
CesiumJsonReader::JsonObjectJsonHandler> | ||
_properties; | ||
}; | ||
} // namespace CesiumGltfReader |
Oops, something went wrong.