LLSD update. LLSD::insert no longer returns self. Use LLSD::with if return value is required.
This commit is contained in:
@@ -349,13 +349,13 @@ namespace
|
||||
|
||||
virtual LLSD::Boolean asBoolean() const { return !mData.empty(); }
|
||||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
virtual LLSD get(const LLSD::String&) const;
|
||||
LLSD& insert(const LLSD::String& k, const LLSD& v);
|
||||
void insert(const LLSD::String& k, const LLSD& v);
|
||||
virtual void erase(const LLSD::String&);
|
||||
LLSD& ref(const LLSD::String&);
|
||||
virtual const LLSD& ref(const LLSD::String&) const;
|
||||
@@ -394,14 +394,9 @@ namespace
|
||||
return (i != mData.end()) ? i->second : LLSD();
|
||||
}
|
||||
|
||||
LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v)
|
||||
void ImplMap::insert(const LLSD::String& k, const LLSD& v)
|
||||
{
|
||||
mData.insert(DataMap::value_type(k, v));
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImplMap::erase(const LLSD::String& k)
|
||||
@@ -444,15 +439,13 @@ namespace
|
||||
|
||||
virtual LLSD::Boolean asBoolean() const { return !mData.empty(); }
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::String)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
|
||||
virtual int size() const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
|
||||
virtual LLSD get(LLSD::Integer) const;
|
||||
void set(LLSD::Integer, const LLSD&);
|
||||
LLSD& insert(LLSD::Integer, const LLSD&);
|
||||
void insert(LLSD::Integer, const LLSD&);
|
||||
void append(const LLSD&);
|
||||
virtual void erase(LLSD::Integer);
|
||||
LLSD& ref(LLSD::Integer);
|
||||
@@ -501,14 +494,10 @@ namespace
|
||||
mData[index] = v;
|
||||
}
|
||||
|
||||
LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
void ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
{
|
||||
if (i < 0) {
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
DataVector::size_type index = i;
|
||||
|
||||
@@ -518,11 +507,6 @@ namespace
|
||||
}
|
||||
|
||||
mData.insert(mData.begin() + index, v);
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImplArray::append(const LLSD& v)
|
||||
@@ -765,11 +749,16 @@ LLSD LLSD::emptyMap()
|
||||
|
||||
bool LLSD::has(const String& k) const { return safe(impl).has(k); }
|
||||
LLSD LLSD::get(const String& k) const { return safe(impl).get(k); }
|
||||
void LLSD::insert(const String& k, const LLSD& v) { makeMap(impl).insert(k, v); }
|
||||
|
||||
LLSD& LLSD::insert(const String& k, const LLSD& v)
|
||||
LLSD& LLSD::with(const String& k, const LLSD& v)
|
||||
{
|
||||
makeMap(impl).insert(k, v);
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#ifdef LL_MSVC7
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#else
|
||||
return *this;
|
||||
#endif
|
||||
}
|
||||
void LLSD::erase(const String& k) { makeMap(impl).erase(k); }
|
||||
|
||||
@@ -790,11 +779,16 @@ int LLSD::size() const { return safe(impl).size(); }
|
||||
|
||||
LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
|
||||
void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
|
||||
void LLSD::insert(Integer i, const LLSD& v) { makeArray(impl).insert(i, v); }
|
||||
|
||||
LLSD& LLSD::insert(Integer i, const LLSD& v)
|
||||
LLSD& LLSD::with(Integer i, const LLSD& v)
|
||||
{
|
||||
makeArray(impl).insert(i, v);
|
||||
return *this;
|
||||
#ifdef LL_MSVC7
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#else
|
||||
return *this;
|
||||
#endif
|
||||
}
|
||||
void LLSD::append(const LLSD& v) { makeArray(impl).append(v); }
|
||||
void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
|
||||
@@ -821,9 +815,15 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
|
||||
{
|
||||
std::ostringstream out;
|
||||
if (useXMLFormat)
|
||||
out << LLSDXMLStreamer(llsd);
|
||||
{
|
||||
LLSDXMLStreamer xml_streamer(llsd);
|
||||
out << xml_streamer;
|
||||
}
|
||||
else
|
||||
out << LLSDNotationStreamer(llsd);
|
||||
{
|
||||
LLSDNotationStreamer notation_streamer(llsd);
|
||||
out << notation_streamer;
|
||||
}
|
||||
out_string = out.str();
|
||||
}
|
||||
int len = out_string.length();
|
||||
|
||||
Reference in New Issue
Block a user