diff options
author | Don Kjer <don@lindenlab.com> | 2007-05-01 21:39:25 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2007-05-01 21:39:25 +0000 |
commit | 4ecb9cb63e4993b3b4bc65d73ed255139b5c3f75 (patch) | |
tree | 48d9bb9a1ae468ecdbd53cf21a598d66ee8eced3 /indra/test/llsd_new_tut.cpp | |
parent | f5e9ce7e47694e349a4eb28b052016b11e1bdf81 (diff) |
svn merge -r 59163:61099 svn+ssh://svn/svn/linden/branches/release-candidate into release
Diffstat (limited to 'indra/test/llsd_new_tut.cpp')
-rw-r--r-- | indra/test/llsd_new_tut.cpp | 77 |
1 files changed, 3 insertions, 74 deletions
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp index 2354698239..0ceb4302ff 100644 --- a/indra/test/llsd_new_tut.cpp +++ b/indra/test/llsd_new_tut.cpp @@ -12,82 +12,11 @@ #include "linden_common.h" #include "lltut.h" -#include "llsd.h" +#include "llsdtraits.h" #include "llstring.h" namespace tut { - template<class T> - class SDTraits - { - protected: - typedef T (LLSD::*Getter)() const; - - LLSD::Type type; - Getter getter; - - public: - SDTraits(); - - T get(const LLSD& actual) - { - return (actual.*getter)(); - } - - bool checkType(const LLSD& actual) - { - return actual.type() == type; - } - }; - - template<> - SDTraits<LLSD::Boolean>::SDTraits() - : type(LLSD::TypeBoolean), getter(&LLSD::asBoolean) - { } - - template<> - SDTraits<LLSD::Integer>::SDTraits() - : type(LLSD::TypeInteger), getter(&LLSD::asInteger) - { } - - template<> - SDTraits<LLSD::Real>::SDTraits() - : type(LLSD::TypeReal), getter(&LLSD::asReal) - { } - - template<> - SDTraits<LLSD::UUID>::SDTraits() - : type(LLSD::TypeUUID), getter(&LLSD::asUUID) - { } - - template<> - SDTraits<LLSD::String>::SDTraits() - : type(LLSD::TypeString), getter(&LLSD::asString) - { } - - template<> - class SDTraits<LLString> : public SDTraits<LLSD::String> - { }; - - template<> - class SDTraits<const char*> : public SDTraits<LLSD::String> - { }; - - template<> - SDTraits<LLSD::Date>::SDTraits() - : type(LLSD::TypeDate), getter(&LLSD::asDate) - { } - - template<> - SDTraits<LLSD::URI>::SDTraits() - : type(LLSD::TypeURI), getter(&LLSD::asURI) - { } - - template<> - SDTraits<LLSD::Binary>::SDTraits() - : type(LLSD::TypeBinary), getter(&LLSD::asBinary) - { } - class SDCleanupCheck { private: @@ -126,7 +55,7 @@ namespace tut static void ensureTypeAndValue(const char* msg, const LLSD& actual, T expectedValue) { - SDTraits<T> traits; + LLSDTraits<T> traits; std::string s(msg); @@ -334,7 +263,7 @@ namespace tut } LLSD u(str); - SDTraits<T> traits; + LLSDTraits<T> traits; ensure_equals(msg + " value", traits.get(u), vExpected); } |