#include "linden_common.h"
#include "llsdserialize.h"
#include "llmemory.h"
#include "llstreamtools.h"
#include <iostream>
#include "apr-1/apr_base64.h"
#include <netinet/in.h>
#include "lldate.h"
#include "llsd.h"
#include "llstring.h"
#include "lluri.h"
Go to the source code of this file.
Functions | |
const std::string | LLSD_BINARY_HEADER ("LLSD/Binary") |
const std::string | LLSD_XML_HEADER ("LLSD/XML") |
U64 | ll_htonll (U64 hostlonglong) |
U64 | ll_ntohll (U64 netlonglong) |
F64 | ll_htond (F64 hostlonglong) |
F64 | ll_ntohd (F64 netlonglong) |
int | deserialize_string (std::istream &istr, std::string &value, S32 max_bytes) |
Figure out what kind of string it is (raw or delimited) and handoff. | |
int | deserialize_string_delim (std::istream &istr, std::string &value, char d) |
Parse a delimited string. | |
int | deserialize_string_raw (std::istream &istr, std::string &value, S32 max_bytes) |
Read a raw string off the stream. | |
int | deserialize_boolean (std::istream &istr, LLSD &data, const std::string &compare, bool value) |
helper method for dealing with the different notation boolean format. | |
void | serialize_string (const std::string &value, std::ostream &str) |
Do notation escaping of a string to an ostream. | |
static const std::string | NOTATION_TRUE_SERIAL ("true") |
static const std::string | NOTATION_FALSE_SERIAL ("false") |
std::ostream & | operator<< (std::ostream &s, const LLSD &llsd) |
Variables | |
static const int | MAX_HDR_LEN = 20 |
static const char | LEGACY_NON_HEADER [] = "<llsd>" |
static const char | BINARY_TRUE_SERIAL = '1' |
static const char | BINARY_FALSE_SERIAL = '0' |
static const char * | NOTATION_STRING_CHARACTERS [256] |
Copyright (c) 2006-2008, Linden Research, Inc.
Second Life Viewer Source Code The source code in this file ("Source Code") is provided by Linden Lab to you under the terms of the GNU General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other License"), formally executed by you and Linden Lab. Terms of the GPL can be found in doc/GPL-license.txt in this distribution, or online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
There are special exceptions to the terms and conditions of the GPL as it is applied to this Source Code. View the full text of the exception in the file doc/FLOSS-exception.txt in this software distribution, or online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
By copying, modifying or distributing this software, you acknowledge that you have read and understood your obligations described above, and agree to abide by those obligations.
ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. $/LicenseInfo$
Definition in file llsdserialize.cpp.
int deserialize_boolean | ( | std::istream & | istr, | |
LLSD & | data, | |||
const std::string & | compare, | |||
bool | value | |||
) |
helper method for dealing with the different notation boolean format.
istr | The stream to read from with the leading character stripped. | |
data | [out] the result of the parse. | |
compare | The string to compare the boolean against | |
vale | The value to assign to data if the parse succeeds. |
Definition at line 1934 of file llsdserialize.cpp.
References LLSD::clear(), and LLSDParser::PARSE_FAILURE.
Referenced by LLSDNotationParser::doParse().
int deserialize_string | ( | std::istream & | istr, | |
std::string & | value, | |||
S32 | max_bytes | |||
) |
Figure out what kind of string it is (raw or delimited) and handoff.
Local functions.
istr | The stream to read from. | |
value | [out] The string which was found. | |
max_bytes | The maximum possible length of the string. Passing in a negative value will skip this check. |
Definition at line 1490 of file llsdserialize.cpp.
References deserialize_string_delim(), deserialize_string_raw(), and LLSDParser::PARSE_FAILURE.
Referenced by LLSDNotationParser::parseMap(), and LLSDNotationParser::parseString().
int deserialize_string_delim | ( | std::istream & | istr, | |
std::string & | value, | |||
char | d | |||
) |
Parse a delimited string.
istr | The stream to read from, with the delimiter already popped. | |
value | [out] The string which was found. | |
d | The delimiter to use. |
Definition at line 1520 of file llsdserialize.cpp.
References hex_as_nybble(), and LLSDParser::PARSE_FAILURE.
Referenced by deserialize_string(), LLSDBinaryParser::doParse(), LLSDNotationParser::doParse(), and LLSDBinaryParser::parseMap().
int deserialize_string_raw | ( | std::istream & | istr, | |
std::string & | value, | |||
S32 | max_bytes | |||
) |
Read a raw string off the stream.
istr | The stream to read from, with the (len) parameter leading the stream. | |
value | [out] The string which was found. | |
d | The delimiter to use. | |
max_bytes | The maximum possible length of the string. Passing in a negative value will skip this check. |
Definition at line 1621 of file llsdserialize.cpp.
References fullread(), NULL, LLSDParser::PARSE_FAILURE, and S32.
Referenced by deserialize_string().
Definition at line 184 of file llsdserialize.cpp.
Referenced by LLSDBinaryFormatter::format().
Endian handlers
Definition at line 182 of file llsdserialize.cpp.
Definition at line 185 of file llsdserialize.cpp.
Referenced by LLSDBinaryParser::doParse().
Definition at line 183 of file llsdserialize.cpp.
const std::string LLSD_BINARY_HEADER | ( | "LLSD/Binary" | ) |
Referenced by LLSDSerialize::deserialize(), and LLSDSerialize::serialize().
const std::string LLSD_XML_HEADER | ( | "LLSD/XML" | ) |
Referenced by LLSDSerialize::deserialize(), and LLSDSerialize::serialize().
static const std::string NOTATION_FALSE_SERIAL | ( | "false" | ) | [static] |
Referenced by LLSDNotationParser::doParse(), and LLSDNotationFormatter::format().
static const std::string NOTATION_TRUE_SERIAL | ( | "true" | ) | [static] |
Local constants.
Referenced by LLSDNotationParser::doParse(), and LLSDNotationFormatter::format().
std::ostream& operator<< | ( | std::ostream & | s, | |
const LLSD & | llsd | |||
) |
Definition at line 1971 of file llsdserialize.cpp.
void serialize_string | ( | const std::string & | value, | |
std::ostream & | str | |||
) |
Do notation escaping of a string to an ostream.
value | The string to escape and serialize | |
str | The stream to serialize to. |
Definition at line 1922 of file llsdserialize.cpp.
Referenced by LLSDNotationFormatter::escapeString(), and LLSDNotationFormatter::format().
const char BINARY_FALSE_SERIAL = '0' [static] |
Definition at line 297 of file llsdserialize.cpp.
const char BINARY_TRUE_SERIAL = '1' [static] |
Definition at line 296 of file llsdserialize.cpp.
const char LEGACY_NON_HEADER[] = "<llsd>" [static] |
const int MAX_HDR_LEN = 20 [static] |
const char* NOTATION_STRING_CHARACTERS[256] [static] |
Definition at line 1662 of file llsdserialize.cpp.