[EEP] LLSD Serialize Notation additions

This commit is contained in:
Lirusaito
2019-03-24 21:04:25 -04:00
parent 2e02f5ac2c
commit fe33db1620
4 changed files with 21 additions and 1 deletions

View File

@@ -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;

View File

@@ -694,7 +694,7 @@ class LL_COMMON_API LLSDSerialize
public:
enum ELLSD_Serialize
{
LLSD_BINARY, LLSD_XML
LLSD_BINARY, LLSD_XML, LLSD_NOTATION
};
/**

View File

@@ -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.

View File

@@ -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