summaryrefslogtreecommitdiff
path: root/indra/test/llsd_new_tut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/test/llsd_new_tut.cpp')
-rw-r--r--indra/test/llsd_new_tut.cpp77
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);
}