Refactor STObject, STLedgerEntry:

* Normalize names
* Remove unused and deprecated members
This commit is contained in:
Nik Bougalis
2016-09-04 01:16:17 -07:00
parent 5be33a650d
commit 9a988963e9
15 changed files with 62 additions and 154 deletions

View File

@@ -164,28 +164,6 @@ STObject::setTypeFromSField (SField const& sField)
return ret;
}
bool STObject::isValidForType ()
{
auto it = v_.begin();
for (auto const& elem : mType->all())
{
if (it == v_.end())
return false;
if (elem->e_field != it->get().getFName())
return false;
++it;
}
return true;
}
bool STObject::isFieldAllowed (SField const& field)
{
if (mType == nullptr)
return true;
return mType->getIndex (field) != -1;
}
// return true = terminated with end-of-object
bool STObject::set (SerialIter& sit, int depth)
{
@@ -504,15 +482,6 @@ void STObject::delField (int index)
v_.erase (v_.begin () + index);
}
std::string STObject::getFieldString (SField const& field) const
{
const STBase* rf = peekAtPField (field);
if (! rf) Throw<std::runtime_error> ("Field not found");
return rf->getText ();
}
unsigned char STObject::getFieldU8 (SField const& field) const
{
return getFieldByValue <STUInt8> (field);
@@ -584,12 +553,6 @@ const STArray& STObject::getFieldArray (SField const& field) const
return getFieldByConstRef <STArray> (field, empty);
}
const STObject& STObject::getFieldObject (SField const& field) const
{
static STObject const empty{sfInvalid};
return getFieldByConstRef <STObject> (field, empty);
}
void
STObject::set (std::unique_ptr<STBase> v)
{
@@ -664,21 +627,11 @@ void STObject::setFieldAmount (SField const& field, STAmount const& v)
setFieldUsingAssignment (field, v);
}
void STObject::setFieldPathSet (SField const& field, STPathSet const& v)
{
setFieldUsingAssignment (field, v);
}
void STObject::setFieldArray (SField const& field, STArray const& v)
{
setFieldUsingAssignment (field, v);
}
void STObject::setFieldObject (SField const& field, STObject const& v)
{
setFieldUsingAssignment (field, v);
}
Json::Value STObject::getJson (int options) const
{
Json::Value ret (Json::objectValue);