[EEP] LLSD Serialize Notation additions
This commit is contained in:
@@ -55,6 +55,7 @@ static const int MAX_HDR_LEN = 20;
|
||||
static const char LEGACY_NON_HEADER[] = "<llsd>";
|
||||
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
|
||||
const std::string LLSD_XML_HEADER("LLSD/XML");
|
||||
const std::string LLSD_NOTATION_HEADER("llsd/notation");
|
||||
|
||||
//used to deflate a gzipped asset (currently used for navmeshes)
|
||||
#define windowBits 15
|
||||
@@ -81,6 +82,11 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize
|
||||
f = new LLSDXMLFormatter;
|
||||
break;
|
||||
|
||||
case LLSD_NOTATION:
|
||||
str << "<? " << LLSD_NOTATION_HEADER << " ?>\n";
|
||||
f = new LLSDNotationFormatter;
|
||||
break;
|
||||
|
||||
default:
|
||||
LL_WARNS() << "serialize request for unknown ELLSD_Serialize" << LL_ENDL;
|
||||
}
|
||||
@@ -168,6 +174,10 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
|
||||
{
|
||||
p = new LLSDXMLParser;
|
||||
}
|
||||
else if (header == LLSD_NOTATION_HEADER)
|
||||
{
|
||||
p = new LLSDNotationParser;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "deserialize request for unknown ELLSD_Serialize" << LL_ENDL;
|
||||
|
||||
@@ -694,7 +694,7 @@ class LL_COMMON_API LLSDSerialize
|
||||
public:
|
||||
enum ELLSD_Serialize
|
||||
{
|
||||
LLSD_BINARY, LLSD_XML
|
||||
LLSD_BINARY, LLSD_XML, LLSD_NOTATION
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -192,6 +192,14 @@ char* ll_pretty_print_sd(const LLSD& sd)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string ll_stream_notation_sd(const LLSD& sd)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << LLSDOStreamer<LLSDNotationFormatter>(sd);
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
|
||||
//compares the structure of an LLSD to a template LLSD and stores the
|
||||
//"valid" values in a 3rd LLSD. Default values pulled from the template
|
||||
//if the tested LLSD does not contain the key/value pair.
|
||||
|
||||
@@ -56,6 +56,8 @@ LL_COMMON_API char* ll_print_sd(const LLSD& sd);
|
||||
LL_COMMON_API char* ll_pretty_print_sd_ptr(const LLSD* sd);
|
||||
LL_COMMON_API char* ll_pretty_print_sd(const LLSD& sd);
|
||||
|
||||
LL_COMMON_API std::string ll_stream_notation_sd(const LLSD& sd);
|
||||
|
||||
//compares the structure of an LLSD to a template LLSD and stores the
|
||||
//"valid" values in a 3rd LLSD. Default values
|
||||
//are pulled from the template. Extra keys/values in the test
|
||||
|
||||
Reference in New Issue
Block a user