Skip to content

Commit 0e2314a

Browse files
kvpp: rename DMX int to int32
1 parent fea76de commit 0e2314a

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

include/kvpp/DMX.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ enum class ID : uint8_t {
8484

8585
VALUE_START = 1,
8686
ELEMENT = 1,
87-
INT = 2,
87+
INT32 = 2,
8888
FLOAT = 3,
8989
BOOL = 4,
9090
STRING = 5,
@@ -101,7 +101,7 @@ enum class ID : uint8_t {
101101

102102
ARRAY_START = 15,
103103
ARRAY_ELEMENT = 15,
104-
ARRAY_INT = 16,
104+
ARRAY_INT32 = 16,
105105
ARRAY_FLOAT = 17,
106106
ARRAY_BOOL = 18,
107107
ARRAY_STRING = 19,
@@ -145,7 +145,7 @@ enum class ID : uint8_t {
145145
[[nodiscard]] constexpr ID stringToID(std::string_view id) {
146146
using enum ID;
147147
if (id == "element") return ELEMENT;
148-
if (id == "int") return INT;
148+
if (id == "int") return INT32;
149149
if (id == "float") return FLOAT;
150150
if (id == "bool") return BOOL;
151151
if (id == "string") return STRING;
@@ -180,10 +180,10 @@ class DMXAttribute {
180180

181181
void setKey(std::string key_);
182182

183-
[[nodiscard]] bool isArray() const;
184-
185183
[[nodiscard]] DMXValue::ID getValueType() const;
186184

185+
[[nodiscard]] bool isValueArray() const;
186+
187187
[[nodiscard]] const DMXValue::Generic& getValue() const;
188188

189189
template<typename T>

src/kvpp/DMX.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ std::string DMXValue::IDToString(ID id) {
2020
break;
2121
case ID::ELEMENT:
2222
return "element";
23-
case ID::INT:
23+
case ID::INT32:
2424
return "int";
2525
case ID::FLOAT:
2626
return "float";
@@ -47,7 +47,7 @@ std::string DMXValue::IDToString(ID id) {
4747
case ID::MATRIX_4X4:
4848
return "matrix";
4949
case ID::ARRAY_ELEMENT:
50-
case ID::ARRAY_INT:
50+
case ID::ARRAY_INT32:
5151
case ID::ARRAY_FLOAT:
5252
case ID::ARRAY_BOOL:
5353
case ID::ARRAY_STRING:
@@ -81,14 +81,14 @@ void DMXAttribute::setKey(std::string key_) {
8181
this->key = std::move(key_);
8282
}
8383

84-
bool DMXAttribute::isArray() const {
85-
return static_cast<DMXValue::ID>(this->value.index()) >= DMXValue::ID::ARRAY_START;
86-
}
87-
8884
DMXValue::ID DMXAttribute::getValueType() const {
8985
return static_cast<DMXValue::ID>(this->value.index());
9086
}
9187

88+
bool DMXAttribute::isValueArray() const {
89+
return this->getValueType() >= DMXValue::ID::ARRAY_START;
90+
}
91+
9292
const DMXValue::Generic& DMXAttribute::getValue() const {
9393
return this->value;
9494
}
@@ -105,7 +105,7 @@ std::string DMXAttribute::getValueString() const {
105105
}
106106
return '#' + std::to_string(index);
107107
}
108-
case INT:
108+
case INT32:
109109
return std::to_string(this->getValue<int32_t>());
110110
case FLOAT:
111111
return std::to_string(this->getValue<float>());
@@ -179,7 +179,7 @@ std::string DMXAttribute::getValueString() const {
179179
}
180180
return out + ']';
181181
}
182-
case ARRAY_INT: {
182+
case ARRAY_INT32: {
183183
const auto ints = this->getValue<std::vector<int32_t>>();
184184
std::string out = "[";
185185
for (int i = 0; i < ints.size(); i++) {
@@ -645,7 +645,7 @@ DMX::DMX(std::span<const std::byte> dmxData) {
645645
}
646646
return value;
647647
}
648-
case INT:
648+
case INT32:
649649
return stream.read<int32_t>();
650650
case FLOAT:
651651
return stream.read<float>();
@@ -698,7 +698,7 @@ DMX::DMX(std::span<const std::byte> dmxData) {
698698
}
699699
case ARRAY_ELEMENT:
700700
return readArrayValue.operator()<DMXValue::Element>(type);
701-
case ARRAY_INT:
701+
case ARRAY_INT32:
702702
return readArrayValue.operator()<int32_t>(type);
703703
case ARRAY_FLOAT:
704704
return readArrayValue.operator()<float>(type);

0 commit comments

Comments
 (0)