39 case ID::ARRAY_ELEMENT:
43 case ID::ARRAY_STRING:
44 case ID::ARRAY_BYTEARRAY:
47 case ID::ARRAY_VECTOR2:
48 case ID::ARRAY_EULER_ANGLE:
49 case ID::ARRAY_VECTOR3:
50 case ID::ARRAY_VECTOR4:
51 case ID::ARRAY_QUATERNION:
52 case ID::ARRAY_MATRIX_4X4:
68 const auto [index, stubGUID] = this->getValueAs<Value::Element>();
70 return "GUID: " + stubGUID;
72 return '#' + std::to_string(index);
75 return std::to_string(this->getValueAs<int32_t>());
77 return std::to_string(this->getValueAs<float>());
79 return this->getValueAs<bool>() ?
"true" :
"false";
81 return this->getValueAs<std::string>();
84 for (
auto byte : this->getValueAs<Value::ByteArray>()) {
86 ss << std::hex << std::uppercase;
87 ss << static_cast<unsigned char>(
byte);
93 return std::to_string(this->getValueAs<float>());
95 const auto [r, g, b, a] = this->getValueAs<Value::Color>();
96 return "rgba(" + std::to_string(r) +
", " + std::to_string(g) +
", " + std::to_string(b) +
", " + std::to_string(a) +
')';
99 const auto vec2 = this->getValueAs<Value::Vector2>();
100 return '[' + std::to_string(vec2[0]) +
", " + std::to_string(vec2[1]) +
']';
104 const auto vec3 = this->getValueAs<Value::Vector3>();
105 return '[' + std::to_string(vec3[0]) +
", " + std::to_string(vec3[1]) +
", " + std::to_string(vec3[2]) +
']';
109 const auto vec4 = this->getValueAs<Value::Vector4>();
110 return '[' + std::to_string(vec4[0]) +
", " + std::to_string(vec4[1]) +
", " + std::to_string(vec4[2]) +
", " + std::to_string(vec4[3]) +
']';
113 const auto mat4 = this->getValueAs<Value::Matrix4x4>();
115 for (
int i = 0; i < 4; i++) {
116 out += (i == 0 ?
'[' :
' ');
117 for (
int j = 0; j < 4; j++) {
118 out += std::to_string(mat4[i][j]);
130 case ARRAY_ELEMENT: {
131 const auto elements = this->getValueAs<std::vector<Value::Element>>();
132 std::string out =
"[";
133 for (
int i = 0; i < elements.size(); i++) {
134 if (elements[i].index == -2) {
135 out += (i == 0 ?
"" :
" ") + std::string{
"GUID: "} + elements[i].stubGUID + (i == elements.size() - 1 ?
"" :
",");
137 out += (i == 0 ?
"" :
" ") + std::string{
"#"} + std::to_string(elements[i].index) + (i == elements.size() - 1 ?
"" :
",");
143 const auto ints = this->getValueAs<std::vector<int>>();
144 std::string out =
"[";
145 for (
int i = 0; i < ints.size(); i++) {
146 out += (i == 0 ?
"" :
" ") + std::to_string(ints[i]) + (i == ints.size() - 1 ?
"" :
",");
151 const auto floats = this->getValueAs<std::vector<float>>();
152 std::string out =
"[";
153 for (
int i = 0; i < floats.size(); i++) {
154 out += (i == 0 ?
"" :
" ") + std::to_string(floats[i]) + (i == floats.size() - 1 ?
"" :
",");
159 const auto bools = this->getValueAs<std::vector<bool>>();
160 std::string out =
"[";
161 for (
int i = 0; i < bools.size(); i++) {
162 out += (i == 0 ?
"" :
" ") + std::string{bools[i] ?
"true" :
"false"} + (i == bools.size() - 1 ?
"" :
",");
167 const auto strings = this->getValueAs<std::vector<std::string>>();
168 std::string out =
"[";
169 for (
int i = 0; i < strings.size(); i++) {
170 out += (i == 0 ?
"" :
" ") + strings[i] + (i == strings.size() - 1 ?
"" :
",\n");
174 case ARRAY_BYTEARRAY: {
175 const auto bytearrays = this->getValueAs<std::vector<Value::ByteArray>>();
176 std::string out =
"[";
177 for (
int i = 0; i < bytearrays.size(); i++) {
179 for (
auto byte : bytearrays[i]) {
180 std::stringstream ss;
181 ss << std::hex << std::uppercase;
182 ss << static_cast<unsigned char>(
byte);
185 out += (i == 0 ?
"" :
" ") + hex + (i == bytearrays.size() - 1 ?
"" :
",\n");
190 const auto times = this->getValueAs<std::vector<float>>();
191 std::string out =
"[";
192 for (
int i = 0; i < times.size(); i++) {
193 out += (i == 0 ?
"" :
" ") + std::to_string(times[i]) + (i == times.size() - 1 ?
"" :
",");
198 const auto colors = this->getValueAs<std::vector<Value::Color>>();
199 std::string out =
"[";
200 for (
int i = 0; i < colors.size(); i++) {
201 out += (i == 0 ?
"" :
" ") + std::string{
"rgba("} + std::to_string(colors[i].r) +
", " + std::to_string(colors[i].g) +
", " + std::to_string(colors[i].b) +
", " + std::to_string(colors[i].a) +
')' + (i == colors.size() - 1 ?
"" :
",\n");
205 case ARRAY_VECTOR2: {
206 const auto vectors = this->getValueAs<std::vector<Value::Vector2>>();
207 std::string out =
"[";
208 for (
int i = 0; i < vectors.size(); i++) {
209 out += (i == 0 ?
"" :
" ") + std::string{
"["} + std::to_string(vectors[i][0]) +
", " + std::to_string(vectors[i][1]) +
']' + (i == vectors.size() - 1 ?
"" :
",\n");
214 case ARRAY_EULER_ANGLE: {
215 const auto vectors = this->getValueAs<std::vector<Value::Vector3>>();
216 std::string out =
"[";
217 for (
int i = 0; i < vectors.size(); i++) {
218 out += (i == 0 ?
"" :
" ") + std::string{
"["} + std::to_string(vectors[i][0]) +
", " + std::to_string(vectors[i][1]) +
", " + std::to_string(vectors[i][2]) +
']' + (i == vectors.size() - 1 ?
"" :
",\n");
223 case ARRAY_QUATERNION: {
224 const auto vectors = this->getValueAs<std::vector<Value::Vector4>>();
225 std::string out =
"[";
226 for (
int i = 0; i < vectors.size(); i++) {
227 out += (i == 0 ?
"" :
" ") + std::string{
"["} + std::to_string(vectors[i][0]) +
", " + std::to_string(vectors[i][1]) +
", " + std::to_string(vectors[i][2]) +
']' +
", " + std::to_string(vectors[i][3]) +
']' + (i == vectors.size() - 1 ?
"" :
",\n");
231 case ARRAY_MATRIX_4X4: {
232 const auto matrices = this->getValueAs<std::vector<Value::Matrix4x4>>();
233 std::string out =
"[";
234 for (
int m = 0; m < matrices.size(); m++) {
235 out += (m == 0 ?
"[" :
" [");
236 for (
int i = 0; i < 4; i++) {
237 out += (i == 0 ?
"" :
" ");
238 for (
int j = 0; j < 4; j++) {
239 out += std::to_string(matrices[m][i][j]);
249 if (m < matrices.size() - 1) {
std::string IDToString(ID id)
constexpr ID arrayIDToInnerID(ID id)
std::string getValue() const