Improve the readability of STBase-derived types

* Increase the visibility of each type's API.
* No functional changes.
This commit is contained in:
Howard Hinnant
2021-10-07 16:12:31 -04:00
committed by Nik Bougalis
parent 72377e7bf2
commit 74e6ed1af3
24 changed files with 2145 additions and 1425 deletions

View File

@@ -40,10 +40,7 @@ STObject::STObject(SOTemplate const& type, SField const& name) : STBase(name)
set(type);
}
STObject::STObject(
SOTemplate const& type,
SerialIter& sit,
SField const& name) noexcept(false)
STObject::STObject(SOTemplate const& type, SerialIter& sit, SField const& name)
: STBase(name)
{
v_.reserve(type.size());
@@ -60,6 +57,36 @@ STObject::STObject(SerialIter& sit, SField const& name, int depth) noexcept(
set(sit, depth);
}
STBase*
STObject::copy(std::size_t n, void* buf) const
{
return emplace(n, buf, *this);
}
STBase*
STObject::move(std::size_t n, void* buf)
{
return emplace(n, buf, std::move(*this));
}
SerializedTypeID
STObject::getSType() const
{
return STI_OBJECT;
}
bool
STObject::isDefault() const
{
return v_.empty();
}
void
STObject::add(Serializer& s) const
{
add(s, withAllFields); // just inner elements
}
STObject&
STObject::operator=(STObject&& other)
{
@@ -86,7 +113,7 @@ STObject::set(const SOTemplate& type)
}
void
STObject::applyTemplate(const SOTemplate& type) noexcept(false)
STObject::applyTemplate(const SOTemplate& type)
{
auto throwFieldErr = [](std::string const& field, char const* description) {
std::stringstream ss;
@@ -140,7 +167,7 @@ STObject::applyTemplate(const SOTemplate& type) noexcept(false)
}
void
STObject::applyTemplateFromSField(SField const& sField) noexcept(false)
STObject::applyTemplateFromSField(SField const& sField)
{
SOTemplate const* elements =
InnerObjectFormats::getInstance().findSOTemplateBySField(sField);
@@ -150,7 +177,7 @@ STObject::applyTemplateFromSField(SField const& sField) noexcept(false)
// return true = terminated with end-of-object
bool
STObject::set(SerialIter& sit, int depth) noexcept(false)
STObject::set(SerialIter& sit, int depth)
{
bool reachedEndOfObject = false;
@@ -229,9 +256,9 @@ STObject::getFullText() const
std::string ret;
bool first = true;
if (fName->hasName())
if (getFName().hasName())
{
ret = fName->getName();
ret = getFName().getName();
ret += " = {";
}
else