mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove nested types SField::ref and SField::ptr...
* This silences a warning about a redundant cv-qualifier. * This makes future coding mistakes about redundant cv-qualifiers much less likely. * This makes the code easier to read.
This commit is contained in:
committed by
Tom Ritchford
parent
47482acf83
commit
100a76f0e8
@@ -31,7 +31,7 @@ namespace ripple {
|
||||
// file-scope. The following 3 objects must have scope prior to
|
||||
// the file-scope SFields.
|
||||
static std::mutex SField_mutex;
|
||||
static std::map<int, SField::ptr> knownCodeToField;
|
||||
static std::map<int, SField const*> knownCodeToField;
|
||||
static std::map<int, std::unique_ptr<SField const>> unknownCodeToField;
|
||||
|
||||
int SField::num = 0;
|
||||
@@ -267,7 +267,8 @@ SField::SField (SerializedTypeID tid, int fv)
|
||||
assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
|
||||
}
|
||||
|
||||
SField::ref SField::getField (int code)
|
||||
SField const&
|
||||
SField::getField (int code)
|
||||
{
|
||||
auto it = knownCodeToField.find (code);
|
||||
|
||||
@@ -323,7 +324,7 @@ SField::ref SField::getField (int code)
|
||||
}
|
||||
}
|
||||
|
||||
int SField::compare (SField::ref f1, SField::ref f2)
|
||||
int SField::compare (SField const& f1, SField const& f2)
|
||||
{
|
||||
// -1 = f1 comes before f2, 0 = illegal combination, 1 = f1 comes after f2
|
||||
if ((f1.fieldCode <= 0) || (f2.fieldCode <= 0))
|
||||
@@ -350,7 +351,8 @@ std::string SField::getName () const
|
||||
std::to_string(fieldValue);
|
||||
}
|
||||
|
||||
SField::ref SField::getField (std::string const& fieldName)
|
||||
SField const&
|
||||
SField::getField (std::string const& fieldName)
|
||||
{
|
||||
for (auto const & fieldPair : knownCodeToField)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user