make values capable of being a list & add boost
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
b37ca963cd
commit
3697759ceb
16 changed files with 315 additions and 140 deletions
|
|
@ -1,26 +1,55 @@
|
|||
#include "ikarus/values/text_value.h"
|
||||
|
||||
#include "text_value.hpp"
|
||||
#include <values/text_value.hpp>
|
||||
|
||||
IkarusTextValue * ikarus_text_value_create(char const * value) {
|
||||
return new IkarusTextValue{value};
|
||||
IkarusTextValue::IkarusTextValue():
|
||||
IkarusValue{this} {}
|
||||
|
||||
boost::container::vector<char const *>& IkarusTextValue::get_value() {
|
||||
return _value;
|
||||
}
|
||||
|
||||
boost::container::vector<char const *> const& IkarusTextValue::get_value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
IkarusTextValue * ikarus_text_value_create(char const ** data, size_t data_size) {
|
||||
auto * ret = new IkarusTextValue{};
|
||||
|
||||
ikarus_text_value_set(ret, data, data_size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
IkarusTextValue * ikarus_text_value_create_indeterminate() {
|
||||
auto * ret = new IkarusTextValue{""};
|
||||
auto * ret = new IkarusTextValue{};
|
||||
ret->set_intermediate(true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char const * ikarus_text_value_get(IkarusTextValue const * value) {
|
||||
char ** ikarus_text_value_get(IkarusTextValue * value, size_t * data_size_out) {
|
||||
// NOLINTNEXTLINE(*-pro-type-const-cast)
|
||||
return const_cast<char **>(ikarus_text_value_get_const(value, data_size_out));
|
||||
}
|
||||
|
||||
char const * const * ikarus_text_value_get_const(IkarusTextValue const * value, size_t * data_size_out) {
|
||||
if (data_size_out != nullptr) {
|
||||
*data_size_out = value->get_value().size();
|
||||
}
|
||||
|
||||
return value->get_value().data();
|
||||
}
|
||||
|
||||
void ikarus_text_value_set(IkarusTextValue * value, char const * new_value) {
|
||||
value->set_value(new_value);
|
||||
void ikarus_text_value_set(IkarusTextValue * value, char const ** new_data, size_t new_data_size) {
|
||||
value->get_value().reserve(new_data_size);
|
||||
|
||||
for (auto i = 0; i < new_data_size; ++i) {
|
||||
// NOLINTNEXTLINE(*-pro-bounds-pointer-arithmetic)
|
||||
value->get_value().emplace_back(new_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
struct IkarusValue * ikarus_text_value_to_value(IkarusTextValue * text_value) {
|
||||
return static_cast<IkarusValue *>(text_value);
|
||||
struct IkarusValue * ikarus_text_value_to_value(IkarusTextValue * value) {
|
||||
return static_cast<IkarusValue *>(value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue