Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,29 @@ class Value {

bool operator==(const tinygltf::Value &other) const;

Value & operator[](const std::string &key) {
assert(type_ == OBJECT_TYPE);
return object_value_[key];
}

void Push(const Value &val) {
assert(type_ == ARRAY_TYPE);
array_value_.push_back(val);
}

Value & operator[](size_t index) {
assert(type_ == ARRAY_TYPE);
assert(index < array_value_.size());
return array_value_[index];
}

const Value & operator[](size_t index) const {
assert(type_ == ARRAY_TYPE);
assert(index < array_value_.size());
return array_value_[index];
}


protected:
int type_ = NULL_TYPE;

Expand Down