Skip to content

Commit 3fe5e20

Browse files
fix(kvpp): make key searches/accesses case-insensitive
1 parent 025401d commit 3fe5e20

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/kvpp/kvpp.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <BufferStream.h>
44

55
#include <sourcepp/parser/Text.h>
6+
#include <sourcepp/string/String.h>
67

78
using namespace kvpp;
89
using namespace sourcepp;
@@ -30,7 +31,7 @@ uint64_t KV1Element::getChildCount() const {
3031
uint64_t KV1Element::getChildCount(std::string_view childKey) const {
3132
uint64_t count = 0;
3233
for (const KV1Element& element : this->children) {
33-
if (element.key == childKey) {
34+
if (string::iequals(element.key, childKey)) {
3435
++count;
3536
}
3637
}
@@ -51,7 +52,7 @@ const KV1Element& KV1Element::operator[](std::string_view childKey) const {
5152

5253
const KV1Element& KV1Element::operator()(std::string_view childKey) const {
5354
for (const auto& element : this->children) {
54-
if (element.key == childKey) {
55+
if (string::iequals(element.key, childKey)) {
5556
return element;
5657
}
5758
}
@@ -61,7 +62,7 @@ const KV1Element& KV1Element::operator()(std::string_view childKey) const {
6162
const KV1Element& KV1Element::operator()(std::string_view childKey, unsigned int n) const {
6263
unsigned int count = 0;
6364
for (const auto& element : this->children) {
64-
if (element.key == childKey) {
65+
if (string::iequals(element.key, childKey)) {
6566
if (count == n) {
6667
return element;
6768
} else {

0 commit comments

Comments
 (0)