Add StringAnsi serialization
This commit is contained in:
@@ -82,6 +82,11 @@ public:
|
||||
String(buf.Get());
|
||||
}
|
||||
|
||||
void String(const StringAnsi& value)
|
||||
{
|
||||
String(value.Get(), static_cast<unsigned>(value.Length()));
|
||||
}
|
||||
|
||||
FORCE_INLINE void RawValue(const StringAnsi& str)
|
||||
{
|
||||
RawValue(str.Get(), static_cast<int32>(str.Length()));
|
||||
|
||||
@@ -254,6 +254,19 @@ namespace Serialization
|
||||
v = stream.GetText();
|
||||
}
|
||||
|
||||
inline bool ShouldSerialize(const StringAnsi& v, const void* otherObj)
|
||||
{
|
||||
return !otherObj || v != *(StringAnsi*)otherObj;
|
||||
}
|
||||
inline void Serialize(ISerializable::SerializeStream& stream, const StringAnsi& v, const void* otherObj)
|
||||
{
|
||||
stream.String(v);
|
||||
}
|
||||
inline void Deserialize(ISerializable::DeserializeStream& stream, StringAnsi& v, ISerializeModifier* modifier)
|
||||
{
|
||||
v = stream.GetTextAnsi();
|
||||
}
|
||||
|
||||
FLAXENGINE_API bool ShouldSerialize(const Version& v, const void* otherObj);
|
||||
FLAXENGINE_API void Serialize(ISerializable::SerializeStream& stream, const Version& v, const void* otherObj);
|
||||
FLAXENGINE_API void Deserialize(ISerializable::DeserializeStream& stream, Version& v, ISerializeModifier* modifier);
|
||||
|
||||
12
Source/ThirdParty/rapidjson/document.h
vendored
12
Source/ThirdParty/rapidjson/document.h
vendored
@@ -1661,6 +1661,18 @@ public:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
StringAnsi GetTextAnsi() const
|
||||
{
|
||||
StringAnsi result;
|
||||
if (IsString())
|
||||
{
|
||||
if (data_.f.flags & kInlineStrFlag)
|
||||
result.Set(data_.ss.str, data_.ss.GetLength());
|
||||
else
|
||||
result.Set(GetStringPointer(), data_.s.length);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//! Get the length of string.
|
||||
/*! Since rapidjson permits "\\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
|
||||
|
||||
Reference in New Issue
Block a user