CheckedSerialize now public, fix in type mismatch throw in Value

git-svn-id: svn://ultimatepp.org/upp/trunk@10133 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-08-01 18:20:51 +00:00
parent a208180883
commit 8163afbfae
2 changed files with 5 additions and 5 deletions

View file

@ -404,6 +404,8 @@ public:
// ------------------- Advanced streaming --------------------
void CheckedSerialize(const Callback1<Stream&> serialize, Stream& stream, int version = Null);
bool Load(Callback1<Stream&> serialize, Stream& stream, int version = Null);
bool Store(Callback1<Stream&> serialize, Stream& stream, int version = Null);
bool LoadFromFile(Callback1<Stream&> serialize, const char *file = NULL, int version = Null);

View file

@ -244,11 +244,9 @@ inline const T& Value::To() const
if(x)
return x->Get();
}
else {
ASSERT(t < 255);
if(Is((byte)t))
return GetSmallRaw<T>();
}
else
if(t < 255 && Is((byte)t))
return GetSmallRaw<T>();
throw ValueTypeError(String().Cat() << "Invalid value conversion: "
<< GetName() << " -> " << typeid(T).name(),
*this, t);