diff --git a/luprex/cpp/core/animqueue.hpp b/luprex/cpp/core/animqueue.hpp index 16d3cae6..2d58c02b 100644 --- a/luprex/cpp/core/animqueue.hpp +++ b/luprex/cpp/core/animqueue.hpp @@ -124,7 +124,7 @@ #include #include -struct AnimValue : public LuaValueHolderValue { +struct AnimValue : public LuaValue { bool persistent; AnimValue() { persistent = false; } diff --git a/luprex/cpp/core/drivenengine.cpp b/luprex/cpp/core/drivenengine.cpp index b43ec093..9dfde5ff 100644 --- a/luprex/cpp/core/drivenengine.cpp +++ b/luprex/cpp/core/drivenengine.cpp @@ -226,7 +226,7 @@ enum DrvAction { ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -class PlayLogfile : public BaseWriter, public std::ofstream { +class PlayLogfile : public BaseWriteMethods, public std::ofstream { using std::ofstream::ofstream; public: void write_bytes(const char *n, size_t size) { write(n, size); } @@ -244,7 +244,7 @@ public: } }; -class ReplayLogfile : public BaseReader, public std::ifstream { +class ReplayLogfile : public BaseReadMethods, public std::ifstream { using std::ifstream::ifstream; public: using read_string_type = std::string; diff --git a/luprex/cpp/core/streambuffer.hpp b/luprex/cpp/core/streambuffer.hpp index 3a315517..9ca636d6 100644 --- a/luprex/cpp/core/streambuffer.hpp +++ b/luprex/cpp/core/streambuffer.hpp @@ -243,7 +243,7 @@ public: virtual char const *what() const { return "Stream Corruption"; } }; -using LuaValueHolderValue = LuaValueHolder; +using LuaValue = BaseLuaValue; class StreamBufferCore { protected: diff --git a/luprex/cpp/core/world-core.cpp b/luprex/cpp/core/world-core.cpp index 1dfe4df6..3b3b2cf3 100644 --- a/luprex/cpp/core/world-core.cpp +++ b/luprex/cpp/core/world-core.cpp @@ -8,8 +8,8 @@ #include -// Read a LuaValueHolder value from the streambuffer and push -// it onto the lua stack. +// Read a serialized LuaValue value from the +// streambuffer and push it onto the lua stack. void push_simple_dynamic(lua_State *L, StreamBuffer *sb) { LuaValueType type = sb->read_simple_dynamic_tag(); switch (type) { diff --git a/luprex/ext/base-buffer.hpp b/luprex/ext/base-buffer.hpp index 70ff2b54..f3c61080 100644 --- a/luprex/ext/base-buffer.hpp +++ b/luprex/ext/base-buffer.hpp @@ -17,7 +17,7 @@ /////////////////////////////////////////////////////////////// // -// LuaValueHolder +// BaseLuaValue // // A struct that holds a dynamically typed value. // This can hold a string, token, number, vector, or boolean. @@ -42,13 +42,13 @@ enum class LuaValueType { }; template -struct LuaValueHolder { +struct BaseLuaValue { using string = STRING; LuaValueType type; double x, y, z; string s; - LuaValueHolder() { + BaseLuaValue() { type = LuaValueType::UNINITIALIZED; x=y=z=0; } @@ -93,7 +93,7 @@ struct LuaValueHolder { type = LuaValueType::VECTOR; s.clear(); x=ix; y=iy; z=iz; } - void copy_value(const LuaValueHolder &other) { + void copy_value(const BaseLuaValue &other) { type = other.type; s=other.s; x=other.x; y=other.y; z=other.z; } @@ -101,7 +101,7 @@ struct LuaValueHolder { /////////////////////////////////////////////////////////////// // -// BaseWriter +// BaseWriteMethods // // This base class provides the following methods: // @@ -119,9 +119,9 @@ struct LuaValueHolder { // void write_length(size_t data) // void write_string(std::string_view data) // -// You should derive from BaseWriter using the CRTP pattern: +// You should derive from BaseWriteMethods using the CRTP pattern: // -// class DerivedWriter : public BaseWriter +// class DerivedWriter : public BaseWriteMethods // // You must provide two methods in the derived class: // @@ -131,7 +131,7 @@ struct LuaValueHolder { /////////////////////////////////////////////////////////////// template -class BaseWriter { +class BaseWriteMethods { protected: template void write_value_core(T arg) { @@ -179,7 +179,7 @@ public: /////////////////////////////////////////////////////////////// // -// BaseReader +// BaseReadMethods // // This base class provides the following methods: // @@ -199,9 +199,9 @@ public: // String read_string_limit(uint64_t size); // String read_string(); // -// You should derive from BaseReader using the CRTP pattern: +// You should derive from BaseReadMethods using the CRTP pattern: // -// class DerivedReader : public BaseReader +// class DerivedReader : public BaseReadMethods // // The derived class must provide: // @@ -226,7 +226,7 @@ public: /////////////////////////////////////////////////////////////// template -class BaseReader { +class BaseReadMethods { protected: template T read_value_core() { @@ -502,13 +502,13 @@ public: write_uint8(uint8_t(tag)); } - // Write a LuaValueHolder value. + // Write a BaseLuaValue value. // // This works regardless of what kind of data is present in the - // LuaValueHolder. + // BaseLuaValue. // template - void write_simple_dynamic(const LuaValueHolder &sd) { + void write_simple_dynamic(const BaseLuaValue &sd) { write_simple_dynamic_tag(sd.type); switch(sd.type) { case LuaValueType::STRING: write_string(sd.s); break; @@ -626,10 +626,10 @@ public: return LuaValueType(read_uint8()); } - // Read a LuaValueHolder + // Read a BaseLuaValue // template - void read_simple_dynamic(LuaValueHolder *result) { + void read_simple_dynamic(BaseLuaValue *result) { LuaValueType type = read_simple_dynamic_tag(); switch (type) { case LuaValueType::STRING: result->set_string(read_string()); break;