Make some of the class names in BaseBuffer more accurate.

This commit is contained in:
2026-02-22 19:46:26 -05:00
parent 861f9b27dc
commit bd2f927d6f
5 changed files with 23 additions and 23 deletions

View File

@@ -124,7 +124,7 @@
#include <cassert>
#include <ostream>
struct AnimValue : public LuaValueHolderValue {
struct AnimValue : public LuaValue {
bool persistent;
AnimValue() { persistent = false; }

View File

@@ -226,7 +226,7 @@ enum DrvAction {
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
class PlayLogfile : public BaseWriter<PlayLogfile>, public std::ofstream {
class PlayLogfile : public BaseWriteMethods<PlayLogfile>, 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<ReplayLogfile>, public std::ifstream {
class ReplayLogfile : public BaseReadMethods<ReplayLogfile>, public std::ifstream {
using std::ifstream::ifstream;
public:
using read_string_type = std::string;

View File

@@ -243,7 +243,7 @@ public:
virtual char const *what() const { return "Stream Corruption"; }
};
using LuaValueHolderValue = LuaValueHolder<eng::string>;
using LuaValue = BaseLuaValue<eng::string>;
class StreamBufferCore {
protected:

View File

@@ -8,8 +8,8 @@
#include <iostream>
// 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) {

View File

@@ -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<class STRING>
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<DerivedWriter>
// class DerivedWriter : public BaseWriteMethods<DerivedWriter>
//
// You must provide two methods in the derived class:
//
@@ -131,7 +131,7 @@ struct LuaValueHolder {
///////////////////////////////////////////////////////////////
template<class Derived>
class BaseWriter {
class BaseWriteMethods {
protected:
template<class T>
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<DerivedReader>
// class DerivedReader : public BaseReadMethods<DerivedReader>
//
// The derived class must provide:
//
@@ -226,7 +226,7 @@ public:
///////////////////////////////////////////////////////////////
template<class Derived>
class BaseReader {
class BaseReadMethods {
protected:
template<class T>
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<class STRING>
void write_simple_dynamic(const LuaValueHolder<STRING> &sd) {
void write_simple_dynamic(const BaseLuaValue<STRING> &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<class STRING>
void read_simple_dynamic(LuaValueHolder<STRING> *result) {
void read_simple_dynamic(BaseLuaValue<STRING> *result) {
LuaValueType type = read_simple_dynamic_tag();
switch (type) {
case LuaValueType::STRING: result->set_string(read_string()); break;