llsdserialize.cpp File Reference

Implementation of LLSD parsers and formatters. More...

#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"

Include dependency graph for llsdserialize.cpp:

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]


Detailed Description

Implementation of LLSD parsers and formatters.

Author:
Phoenix
Date:
2006-03-05
LicenseInfo
firstyear=2006&license=viewergpl

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.


Function Documentation

int deserialize_boolean ( std::istream &  istr,
LLSD data,
const std::string &  compare,
bool  value 
)

helper method for dealing with the different notation boolean format.

Parameters:
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.
Returns:
Returns number of bytes read off of the stream. Returns PARSE_FAILURE (-1) on failure.

Definition at line 1934 of file llsdserialize.cpp.

References LLSD::clear(), and LLSDParser::PARSE_FAILURE.

Referenced by LLSDNotationParser::doParse().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
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.
Returns:
Returns number of bytes read off of the stream. Returns PARSE_FAILURE (-1) on failure.
local functions

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int deserialize_string_delim ( std::istream &  istr,
std::string &  value,
char  d 
)

Parse a delimited string.

Parameters:
istr The stream to read from, with the delimiter already popped.
value [out] The string which was found.
d The delimiter to use.
Returns:
Returns number of bytes read off of the stream. Returns PARSE_FAILURE (-1) on failure.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int deserialize_string_raw ( std::istream &  istr,
std::string &  value,
S32  max_bytes 
)

Read a raw string off the stream.

Parameters:
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.
Returns:
Returns number of bytes read off of the stream. Returns PARSE_FAILURE (-1) on failure.

Definition at line 1621 of file llsdserialize.cpp.

References fullread(), NULL, LLSDParser::PARSE_FAILURE, and S32.

Referenced by deserialize_string().

Here is the call graph for this function:

Here is the caller graph for this function:

F64 ll_htond ( F64  hostlonglong  ) 

Definition at line 184 of file llsdserialize.cpp.

Referenced by LLSDBinaryFormatter::format().

Here is the caller graph for this function:

U64 ll_htonll ( U64  hostlonglong  ) 

Endian handlers

Definition at line 182 of file llsdserialize.cpp.

F64 ll_ntohd ( F64  netlonglong  ) 

Definition at line 185 of file llsdserialize.cpp.

Referenced by LLSDBinaryParser::doParse().

Here is the caller graph for this function:

U64 ll_ntohll ( U64  netlonglong  ) 

Definition at line 183 of file llsdserialize.cpp.

const std::string LLSD_BINARY_HEADER ( "LLSD/Binary"   ) 

Referenced by LLSDSerialize::deserialize(), and LLSDSerialize::serialize().

Here is the caller graph for this function:

const std::string LLSD_XML_HEADER ( "LLSD/XML"   ) 

Referenced by LLSDSerialize::deserialize(), and LLSDSerialize::serialize().

Here is the caller graph for this function:

static const std::string NOTATION_FALSE_SERIAL ( "false"   )  [static]

Referenced by LLSDNotationParser::doParse(), and LLSDNotationFormatter::format().

Here is the caller graph for this function:

static const std::string NOTATION_TRUE_SERIAL ( "true"   )  [static]

Local constants.

Referenced by LLSDNotationParser::doParse(), and LLSDNotationFormatter::format().

Here is the caller graph for this function:

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.

Parameters:
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().

Here is the caller graph for this function:


Variable Documentation

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]

Definition at line 53 of file llsdserialize.cpp.

Referenced by LLSDSerialize::deserialize().

const int MAX_HDR_LEN = 20 [static]

Definition at line 52 of file llsdserialize.cpp.

Referenced by LLSDSerialize::deserialize().

const char* NOTATION_STRING_CHARACTERS[256] [static]

Definition at line 1662 of file llsdserialize.cpp.


Generated on Fri May 16 08:34:48 2008 for SecondLife by  doxygen 1.5.5