Merge branch 'main' into heightmaps
This commit is contained in:
@@ -129,6 +129,12 @@ Map& List::putMap() {
|
|||||||
return *map;
|
return *map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuffer& List::putBytes(size_t size) {
|
||||||
|
auto bytes = create_bytes(size);
|
||||||
|
put(bytes);
|
||||||
|
return *bytes;
|
||||||
|
}
|
||||||
|
|
||||||
void List::remove(size_t index) {
|
void List::remove(size_t index) {
|
||||||
values.erase(values.begin() + index);
|
values.erase(values.begin() + index);
|
||||||
}
|
}
|
||||||
@@ -280,6 +286,12 @@ Map& Map::putMap(const std::string& key) {
|
|||||||
return *obj;
|
return *obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuffer& Map::putBytes(const std::string& key, size_t size) {
|
||||||
|
auto bytes = create_bytes(size);
|
||||||
|
put(key, bytes);
|
||||||
|
return *bytes;
|
||||||
|
}
|
||||||
|
|
||||||
bool Map::has(const std::string& key) const {
|
bool Map::has(const std::string& key) const {
|
||||||
return values.find(key) != values.end();
|
return values.find(key) != values.end();
|
||||||
}
|
}
|
||||||
@@ -312,6 +324,10 @@ Map_sptr dynamic::create_map(
|
|||||||
return std::make_shared<Map>(entries);
|
return std::make_shared<Map>(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuffer_sptr dynamic::create_bytes(size_t size) {
|
||||||
|
return std::make_shared<ByteBuffer>(size);
|
||||||
|
}
|
||||||
|
|
||||||
number_t dynamic::get_number(const Value& value) {
|
number_t dynamic::get_number(const Value& value) {
|
||||||
if (auto num = std::get_if<number_t>(&value)) {
|
if (auto num = std::get_if<number_t>(&value)) {
|
||||||
return *num;
|
return *num;
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ namespace dynamic {
|
|||||||
Map_sptr create_map(
|
Map_sptr create_map(
|
||||||
std::initializer_list<std::pair<const std::string, Value>> entries = {}
|
std::initializer_list<std::pair<const std::string, Value>> entries = {}
|
||||||
);
|
);
|
||||||
|
ByteBuffer_sptr create_bytes(size_t size);
|
||||||
|
|
||||||
number_t get_number(const Value& value);
|
number_t get_number(const Value& value);
|
||||||
integer_t get_integer(const Value& value);
|
integer_t get_integer(const Value& value);
|
||||||
|
|
||||||
@@ -82,6 +84,7 @@ namespace dynamic {
|
|||||||
|
|
||||||
List& putList();
|
List& putList();
|
||||||
Map& putMap();
|
Map& putMap();
|
||||||
|
ByteBuffer& putBytes(size_t size);
|
||||||
|
|
||||||
void remove(size_t index);
|
void remove(size_t index);
|
||||||
};
|
};
|
||||||
@@ -173,6 +176,7 @@ namespace dynamic {
|
|||||||
|
|
||||||
List& putList(const std::string& key);
|
List& putList(const std::string& key);
|
||||||
Map& putMap(const std::string& key);
|
Map& putMap(const std::string& key);
|
||||||
|
ByteBuffer& putBytes(const std::string& key, size_t size);
|
||||||
|
|
||||||
bool has(const std::string& key) const;
|
bool has(const std::string& key) const;
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user