Refactor: remove unncessary template member functions
This commit is contained in:
parent
f9d1e423ba
commit
02ea9f9db6
@ -957,27 +957,23 @@ private:
|
|||||||
a.PushBack(c, *allocator_);
|
a.PushBack(c, *allocator_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueType>
|
|
||||||
static const ValueType* GetMember(const ValueType& value, const ValueType& name) {
|
static const ValueType* GetMember(const ValueType& value, const ValueType& name) {
|
||||||
typename ValueType::ConstMemberIterator itr = value.FindMember(name);
|
typename ValueType::ConstMemberIterator itr = value.FindMember(name);
|
||||||
return itr != value.MemberEnd() ? &(itr->value) : 0;
|
return itr != value.MemberEnd() ? &(itr->value) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueType>
|
|
||||||
static void AssignIfExist(bool& out, const ValueType& value, const ValueType& name) {
|
static void AssignIfExist(bool& out, const ValueType& value, const ValueType& name) {
|
||||||
if (const ValueType* v = GetMember(value, name))
|
if (const ValueType* v = GetMember(value, name))
|
||||||
if (v->IsBool())
|
if (v->IsBool())
|
||||||
out = v->GetBool();
|
out = v->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueType>
|
|
||||||
static void AssignIfExist(SizeType& out, const ValueType& value, const ValueType& name) {
|
static void AssignIfExist(SizeType& out, const ValueType& value, const ValueType& name) {
|
||||||
if (const ValueType* v = GetMember(value, name))
|
if (const ValueType* v = GetMember(value, name))
|
||||||
if (v->IsUint64() && v->GetUint64() <= SizeType(~0))
|
if (v->IsUint64() && v->GetUint64() <= SizeType(~0))
|
||||||
out = static_cast<SizeType>(v->GetUint64());
|
out = static_cast<SizeType>(v->GetUint64());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueType, typename PointerType>
|
|
||||||
void AssignIfExist(SchemaArray& out, SchemaDocumentType& schemaDocument, const PointerType& p, const ValueType& value, const ValueType& name, const ValueType& document) {
|
void AssignIfExist(SchemaArray& out, SchemaDocumentType& schemaDocument, const PointerType& p, const ValueType& value, const ValueType& name, const ValueType& document) {
|
||||||
if (const ValueType* v = GetMember(value, name)) {
|
if (const ValueType* v = GetMember(value, name)) {
|
||||||
if (v->IsArray() && v->Size() > 0) {
|
if (v->IsArray() && v->Size() > 0) {
|
||||||
@ -1080,7 +1076,6 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// O(n)
|
// O(n)
|
||||||
template <typename ValueType>
|
|
||||||
bool FindPropertyIndex(const ValueType& name, SizeType* outIndex) const {
|
bool FindPropertyIndex(const ValueType& name, SizeType* outIndex) const {
|
||||||
SizeType len = name.GetStringLength();
|
SizeType len = name.GetStringLength();
|
||||||
const Ch* str = name.GetString();
|
const Ch* str = name.GetString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user