diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-04-28 13:55:05 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-11-07 16:41:37 +0000 |
commit | fc4ee249e0e4dd1b904080c817153e61c670acb1 (patch) | |
tree | 090e498888a928c374e08244c63e68e938c4269b | |
parent | Simplify object creation code (diff) | |
download | ilt-fc4ee249e0e4dd1b904080c817153e61c670acb1.tar.bz2 ilt-fc4ee249e0e4dd1b904080c817153e61c670acb1.tar.xz ilt-fc4ee249e0e4dd1b904080c817153e61c670acb1.zip |
Tidy case of function names
-rw-r--r-- | lib/jsonParse-persistance.cpp | 38 | ||||
-rw-r--r-- | lib/jsonParse-persistance.h | 20 | ||||
-rw-r--r-- | lib/jsonParse.h | 18 | ||||
-rw-r--r-- | lib/jsonParse.ll | 22 | ||||
-rw-r--r-- | lib/persistance.cpp | 14 | ||||
-rw-r--r-- | lib/persistance.h | 30 |
6 files changed, 71 insertions, 71 deletions
diff --git a/lib/jsonParse-persistance.cpp b/lib/jsonParse-persistance.cpp index 00b84dd..100fa5c 100644 --- a/lib/jsonParse-persistance.cpp +++ b/lib/jsonParse-persistance.cpp @@ -10,69 +10,69 @@ namespace Persistanace { } void - JsonParsePersistance::BeginObject() + JsonParsePersistance::beginObject() { current()->beforeValue(stk); - current()->BeginObject(stk); + current()->beginObject(stk); } void - JsonParsePersistance::BeginArray() + JsonParsePersistance::beginArray() { current()->beforeValue(stk); - current()->BeginArray(stk); + current()->beginArray(stk); } void - JsonParsePersistance::PushBoolean(bool value) + JsonParsePersistance::pushBoolean(bool value) { - PushValue(value); + pushValue(value); } void - JsonParsePersistance::PushNumber(float value) + JsonParsePersistance::pushNumber(float value) { - PushValue(value); + pushValue(value); } void - JsonParsePersistance::PushNull() + JsonParsePersistance::pushNull() { - PushValue(nullptr); + pushValue(nullptr); } void - JsonParsePersistance::PushText(std::string && value) + JsonParsePersistance::pushText(std::string && value) { - PushValue(value); + pushValue(value); } void - JsonParsePersistance::PushKey(std::string && k) + JsonParsePersistance::pushKey(std::string && k) { stk.push(current()->select(k)); } void - JsonParsePersistance::EndArray() + JsonParsePersistance::endArray() { stk.pop(); stk.pop(); } void - JsonParsePersistance::EndObject() + JsonParsePersistance::endObject() { - current()->EndObject(stk); - current()->EndObject(stk); + current()->endObject(stk); + current()->endObject(stk); } template<typename T> inline void - JsonParsePersistance::PushValue(T && value) + JsonParsePersistance::pushValue(T && value) { current()->beforeValue(stk); - (*current())(value); + current()->setValue(value); stk.pop(); } diff --git a/lib/jsonParse-persistance.h b/lib/jsonParse-persistance.h index bea93e0..37483bc 100644 --- a/lib/jsonParse-persistance.h +++ b/lib/jsonParse-persistance.h @@ -24,19 +24,19 @@ namespace Persistanace { protected: void loadState(std::istream & in); - void BeginObject() override; - void BeginArray() override; - void PushBoolean(bool value) override; - void PushNumber(float value) override; - void PushNull() override; - void PushText(std::string && value) override; - void PushKey(std::string && k) override; - void EndArray() override; - void EndObject() override; + void beginObject() override; + void beginArray() override; + void pushBoolean(bool value) override; + void pushNumber(float value) override; + void pushNull() override; + void pushText(std::string && value) override; + void pushKey(std::string && k) override; + void endArray() override; + void endObject() override; Stack stk; - template<typename T> inline void PushValue(T && value); + template<typename T> inline void pushValue(T && value); inline SelectionPtr & current(); }; } diff --git a/lib/jsonParse.h b/lib/jsonParse.h index 6b1249f..79833eb 100644 --- a/lib/jsonParse.h +++ b/lib/jsonParse.h @@ -22,17 +22,17 @@ namespace json { static void appendEscape(unsigned long, std::string &); protected: - virtual void BeginObject() = 0; - virtual void BeginArray() = 0; + virtual void beginObject() = 0; + virtual void beginArray() = 0; - virtual void PushBoolean(bool) = 0; - virtual void PushNumber(float) = 0; - virtual void PushNull() = 0; - virtual void PushText(std::string &&) = 0; - virtual void PushKey(std::string &&) = 0; + virtual void pushBoolean(bool) = 0; + virtual void pushNumber(float) = 0; + virtual void pushNull() = 0; + virtual void pushText(std::string &&) = 0; + virtual void pushKey(std::string &&) = 0; - virtual void EndArray() = 0; - virtual void EndObject() = 0; + virtual void endArray() = 0; + virtual void endObject() = 0; void LexerError(const char * msg) override; diff --git a/lib/jsonParse.ll b/lib/jsonParse.ll index 7e0b8ca..52ad89f 100644 --- a/lib/jsonParse.ll +++ b/lib/jsonParse.ll @@ -47,22 +47,22 @@ text [^\\\"]* %% <ARRAY_ITEM,INITIAL>{true} { - PushBoolean(true); + pushBoolean(true); yy_pop_state(); } <ARRAY_ITEM,INITIAL>{false} { - PushBoolean(false); + pushBoolean(false); yy_pop_state(); } <ARRAY_ITEM,INITIAL>{number} { - PushNumber(std::strtof(YYText(), NULL)); + pushNumber(std::strtof(YYText(), NULL)); yy_pop_state(); } <ARRAY_ITEM,INITIAL>{null} { - PushNull(); + pushNull(); yy_pop_state(); } @@ -71,12 +71,12 @@ text [^\\\"]* } <ARRAY_ITEM,INITIAL>{beginobj} { - BeginObject(); + beginObject(); BEGIN(OBJECT_ITEM_OR_END); } <ARRAY_ITEM,INITIAL>{beginarray} { - BeginArray(); + beginArray(); BEGIN(ARRAY_NEXT); yy_push_state(ARRAY_ITEM); } @@ -86,12 +86,12 @@ text [^\\\"]* switch (YY_START) { case ARRAY_ITEM: case INITIAL: - PushText(std::move(buf)); + pushText(std::move(buf)); yy_pop_state(); break; case OBJECT_ITEM: case OBJECT_ITEM_OR_END: - PushKey(std::move(buf)); + pushKey(std::move(buf)); BEGIN(COLON); break; } @@ -99,18 +99,18 @@ text [^\\\"]* } <OBJECT_NEXT,OBJECT_ITEM_OR_END>{endobj} { - EndObject(); + endObject(); yy_pop_state(); } <ARRAY_ITEM>{endarray} { - EndArray(); + endArray(); yy_pop_state(); yy_pop_state(); } <ARRAY_NEXT>{endarray} { - EndArray(); + endArray(); yy_pop_state(); } diff --git a/lib/persistance.cpp b/lib/persistance.cpp index c21a6b1..0dd7cba 100644 --- a/lib/persistance.cpp +++ b/lib/persistance.cpp @@ -18,37 +18,37 @@ namespace Persistanace { } void - Selection::operator()(float &) + Selection::setValue(float &) { throw std::runtime_error("Unexpected float"); } void - Selection::operator()(bool &) + Selection::setValue(bool &) { throw std::runtime_error("Unexpected bool"); } void - Selection::operator()(const std::nullptr_t &) + Selection::setValue(const std::nullptr_t &) { throw std::runtime_error("Unexpected null"); } void - Selection::operator()(std::string &) + Selection::setValue(std::string &) { throw std::runtime_error("Unexpected string"); } void - Selection::BeginArray(Stack &) + Selection::beginArray(Stack &) { throw std::runtime_error("Unexpected array"); } void - Selection::BeginObject(Stack &) + Selection::beginObject(Stack &) { throw std::runtime_error("Unexpected object"); } @@ -66,7 +66,7 @@ namespace Persistanace { } void - Selection::EndObject(Stack &) + Selection::endObject(Stack &) { } } diff --git a/lib/persistance.h b/lib/persistance.h index 866be51..32e5cb2 100644 --- a/lib/persistance.h +++ b/lib/persistance.h @@ -27,13 +27,13 @@ namespace Persistanace { virtual ~Selection() = default; DEFAULT_MOVE_COPY(Selection); - virtual void operator()(float &); - virtual void operator()(bool &); - virtual void operator()(const std::nullptr_t &); - virtual void operator()(std::string &); - virtual void BeginArray(Stack &); - virtual void BeginObject(Stack &); - virtual void EndObject(Stack &); + virtual void setValue(float &); + virtual void setValue(bool &); + virtual void setValue(const std::nullptr_t &); + virtual void setValue(std::string &); + virtual void beginArray(Stack &); + virtual void beginObject(Stack &); + virtual void endObject(Stack &); virtual void beforeValue(Stack &); virtual SelectionPtr select(const std::string &); @@ -50,7 +50,7 @@ namespace Persistanace { } void - operator()(T & evalue) override + setValue(T & evalue) override { std::swap(v, evalue); } @@ -107,7 +107,7 @@ namespace Persistanace { explicit SelectionT(V & value) : v {value} { } void - BeginArray(Stack & stk) override + beginArray(Stack & stk) override { stk.push(make_s<Members>(v)); } @@ -138,7 +138,7 @@ namespace Persistanace { explicit SelectionT(V & value) : v {value} { } void - BeginArray(Stack & stk) override + beginArray(Stack & stk) override { stk.push(make_s<Members>(v)); } @@ -174,7 +174,7 @@ namespace Persistanace { } void - operator()(std::string & type) override + setValue(std::string & type) override { auto no = Persistable::callFactory(type); if (dynamic_cast<T *>(no.get())) { @@ -215,7 +215,7 @@ namespace Persistanace { } void - EndObject(Stack & stk) override + endObject(Stack & stk) override { if (!v) { if constexpr (std::is_abstract_v<T>) { @@ -239,19 +239,19 @@ namespace Persistanace { } void - operator()(const std::nullptr_t &) override + setValue(const std::nullptr_t &) override { v.reset(); } void - BeginObject(Stack & stk) override + beginObject(Stack & stk) override { stk.push(make_s<SelectionObj>(v)); } void - EndObject(Stack & stk) override + endObject(Stack & stk) override { stk.pop(); } |