A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/json__over__uttp_8cpp_source.html below:

NCBI C++ ToolKit: src/connect/services/json_over_uttp.cpp Source File

93  return "eInvalidNodeType"

;

95  return "eIndexOutOfRange"

;

97  return "eKeyNotFound"

;

167  return "an integer"

;

169  return "a floating point"

;

184  GetTypeName

(required_type) <<

" node is required"

);

243  const char

*

operation

,

size_t

index)

const 245  if

(

m_Array

.size() <= index) {

248  " is out of range (array size is "

<<

342  const char

* ch =

value

.begin();

343  const char

* end =

value

.end();

351  if

(++ch >= end || !

isdigit

(*ch))

354  case '0'

:

case '1'

:

case '2'

:

case '3'

:

case '4'

:

355  case '5'

:

case '6'

:

case '7'

:

case '8'

:

case '9'

:

363  if

(++ch == end || !

isdigit

(*ch))

370  if

(*ch ==

'E'

|| *ch ==

'e'

)

380  if

(++ch < end && (*ch ==

'-'

|| *ch ==

'+'

?

423  return m_Impl

->m_NodeType;

428  return m_Impl

->GetTypeName();

440  virtual string GetKey

()

const

;

441  virtual bool Next

();

442  virtual bool IsValid

()

const

;

475  m_Iterator

(container->m_ElementOrder.begin())

480  virtual string GetKey

()

const

;

481  virtual bool Next

();

482  virtual bool IsValid

()

const

;

490  return

(*m_Iterator)->m_Node;

495  return

(*m_Iterator)->m_Key;

520  virtual string GetKey

()

const

;

521  virtual bool Next

();

522  virtual bool IsValid

()

const

;

536  "Cannot get a key for an array iterator"

);

576  virtual string GetKey

()

const

;

577  virtual bool Next

();

578  virtual bool IsValid

()

const

;

588  if

(

m_Index

== (

size_t

) -1) {

592  string

path(

m_Path

+

'.'

);

601  string

path(

m_Path

+

'.'

);

671  switch

(m_Impl->m_NodeType) {

678

m_Impl.GetPointerOrNull())));

683

m_Impl.GetPointerOrNull())));

689  if

(

mode

== eFlatten)

694

m_Impl.GetPointerOrNull())));

698  "Cannot iterate a non-container type"

);

704  switch

(m_Impl->m_NodeType) {

707

m_Impl.GetPointerOrNull())->m_Elements.size();

710

m_Impl.GetPointerOrNull())->m_Array.size();

713  "GetSize() requires a container type"

);

744

m_Impl->GetArrayNodeImpl(

"Append()"

)->

752  impl

->VerifyIndexBounds(

"InsertAt()"

, index);

761  impl

->VerifyIndexBounds(

"SetAt()"

, index);

770  impl

->VerifyIndexBounds(

"DeleteAt()"

, index);

772  impl

->m_Array.erase(

impl

->m_Array.begin() + index);

779  impl

->VerifyIndexBounds(

"GetAt()"

, index);

813

pair<TJsonObjectElements::iterator, bool> insertion =

821  if

(insertion.second) {

823  impl

->m_ElementOrder.insert(element);

834  if

(it !=

impl

->m_Elements.end()) {

836  impl

->m_Elements.erase(it);

845  impl

->m_Elements.end();

855  if

(it ==

impl

->m_Elements.end())

858  return const_cast<SJsonNodeImpl

*

>

(it->m_Node.GetPointerOrNull());

863

m_Impl->VerifyType(

"AsString()"

,

eString

);

866

m_Impl.GetPointerOrNull())->m_String;

871  if

(m_Impl->m_NodeType == eDouble)

873

m_Impl.GetPointerOrNull())->m_Double;

875

m_Impl->

VerifyType

(

"AsInteger()"

, eInteger);

878

m_Impl.GetPointerOrNull())->m_Integer;

883  if

(m_Impl->m_NodeType == eInteger)

885

m_Impl.GetPointerOrNull())->m_Integer;

887

m_Impl->

VerifyType

(

"AsDouble()"

, eDouble);

890

m_Impl.GetPointerOrNull())->m_Double;

895

m_Impl->VerifyType(

"AsBoolean()"

, eBoolean);

898

m_Impl.GetPointerOrNull())->m_Boolean;

965

os.append(node.

AsBoolean

() ?

"true"

:

"false"

);

976  switch

(GetNodeType()) {

978  if

(

flags

& fOmitOutermostBrackets)

987  if

(

flags

& fOmitOutermostBrackets)

996  if

(

flags

& fVerbatimIfString)

998

m_Impl.GetPointerOrNull())->

m_String

);

1007 #define INVALID_FORMAT_ERROR() \ 1008  NCBI_THROW2(CStringException, eFormat, \ 1009  (*m_Ch == '\0' ? "Unexpected end of output"

: \

1010

"Syntax error in structured output"), \

1015

m_Ch = (m_NSOutput = json).c_str();

1017  while

(

isspace

((

unsigned char

) *m_Ch))

1025

root = ParseArray(

']'

);

1030

root = ParseObject(

'}'

);

1037  while

(

isspace

((

unsigned char

) *m_Ch))

1040  if

(*m_Ch !=

'\0'

) {

1062  if

(*m_Ch ==

'-'

) {

1066  if

(*m_Ch ==

'0'

&&

len

> 1) {

1068  "Leading zeros are not allowed"

, GetPosition());

1085  while

(

isspace

((

unsigned char

) *m_Ch))

1089  while

(

isspace

((

unsigned char

) *++m_Ch))

1098  while

(

isspace

((

unsigned char

) *m_Ch))

1101  if

(*m_Ch == closing_char) {

1106  while

(*m_Ch ==

'\''

|| *m_Ch ==

'"'

) {

1108  string

attr_name(ParseString(GetRemainder()));

1110  while

(

isspace

((

unsigned char

) *m_Ch))

1112  if

(*m_Ch ==

':'

|| *m_Ch ==

'='

)

1113  while

(

isspace

((

unsigned char

) *++m_Ch))

1116  result

.SetByKey(attr_name, ParseValue());

1119  if

(*m_Ch != closing_char)

1133  while

(

isspace

((

unsigned char

) *m_Ch))

1136  if

(*m_Ch == closing_char) {

1142  result

.Append(ParseValue());

1143  while

(MoreNodes());

1145  if

(*m_Ch == closing_char) {

1155  size_t

max_len = GetRemainder();

1162  return

ParseArray(

']'

);

1167  return

ParseObject(

'}'

);

1177  if

(max_len <= 1 || !

isdigit

((

unsigned char

) m_Ch[1])) {

1183  case '0'

:

case '1'

:

case '2'

:

case '3'

:

case '4'

:

1184  case '5'

:

case '6'

:

case '7'

:

case '8'

:

case '9'

:

1187  if

(++

len

>= max_len)

1189  while

(

isdigit

((

unsigned char

) m_Ch[

len

]));

1193  switch

(m_Ch[

len

]) {

1195  if

(++

len

== max_len || !

isdigit

((

unsigned char

) m_Ch[

len

])) {

1197  "At least one digit after the decimal " 1198  "point is required"

, GetPosition());

1201  if

(++

len

== max_len)

1204  if

(!

isdigit

((

unsigned char

) m_Ch[

len

])) {

1205  if

(m_Ch[

len

] ==

'E'

|| m_Ch[

len

] ==

'e'

)

1215  if

(++

len

== max_len ||

1216

(m_Ch[

len

] ==

'-'

|| m_Ch[

len

] ==

'+'

?

1217

++

len

== max_len ||

1219

!

isdigit

((

unsigned char

) m_Ch[

len

]))) {

1222  "Invalid exponent specification"

, GetPosition());

1224  while

(++

len

< max_len &&

isdigit

((

unsigned char

) m_Ch[

len

]))

1233  case 'F'

:

case 'f'

:

case 'N'

:

case 'n'

:

1234  case 'T'

:

case 't'

:

case 'Y'

:

case 'y'

:

1235  while

(

len

<= max_len &&

isalpha

((

unsigned char

) m_Ch[

len

]))

1266  switch

(GetErrCode()) {

1267  case

eUTTPFormatError:

1268  return "eUTTPFormatError"

;

1269  case

eChunkContinuationExpected:

1270  return "eChunkContinuationExpected"

;

1271  case

eUnexpectedEOM:

1272  return "eUnexpectedEOM"

;

1273  case

eUnexpectedTrailingToken:

1274  return "eUnexpectedTrailingToken"

;

1275  case

eObjectKeyMustBeString:

1276  return "eObjectKeyMustBeString"

;

1277  case

eUnexpectedClosingBracket:

1278  return "eUnexpectedClosingBracket"

;

1279  case

eUnknownControlSymbol:

1280  return "eUnknownControlSymbol"

;

1287

m_State(eExpectNextToken),

1288

m_HashValueIsExpected(

false

)

1292 #ifdef WORDS_BIGENDIAN 1293 #define DOUBLE_PREFIX 'D' 1295 #define DOUBLE_PREFIX 'd' 1298 #define EOM_MARKER '\n' 1323  goto

ThrowUnexpectedTrailingToken;

1343

reverse(

reinterpret_cast<char

*

>

(&

m_Double

),

1344  reinterpret_cast<char

*

>

(&

m_Double

+ 1));

1349  goto

ThrowUnexpectedTrailingToken;

1376  "JSON-over-UTTP: Unexpected end of message"

);

1382  goto

ThrowChunkContinuationExpected;

1384  switch

(control_symbol) {

1388  CJsonNode

new_node(control_symbol ==

'['

?

1403  "JSON-over-UTTP: Unexpected closing bracket"

);

1415  switch

(reader.

ReadRawData

(

sizeof

(

double

))) {

1439  char

* dst =

reinterpret_cast<char

*

>

(&

m_Double

+ 1);

1440  int count

=

sizeof

(double);

1444  while

(--

count

> 0);

1469

eUnknownControlSymbol,

1470  "JSON-over-UTTP: Unknown control symbol '"

<<

1484  goto

ThrowUnexpectedTrailingToken;

1486  goto

ThrowChunkContinuationExpected;

1495  "JSON-over-UTTP: UTTP format error"

);

1498

ThrowUnexpectedTrailingToken:

1500  "JSON-over-UTTP: Received a token while expected EOM"

);

1502

ThrowChunkContinuationExpected:

1504  "JSON-over-UTTP: Chunk continuation expected"

);

1531  "JSON-over-UTTP: Invalid object key type"

);

Exception class for use by CJsonNode.

@ eKeyNotFound

No such key in the object node.

@ eIndexOutOfRange

JSON array index exceeds the maximum index.

@ eInvalidNodeType

Operation is not valid for this node type.

virtual const char * GetErrCodeString() const override

Get error code interpreted as text.

Iterator for JSON arrays and objects.

bool Next()

Skip to the next element if there is one, in which case TRUE is returned.

bool IsValid() const

Return true if this iterator is still valid.

CJsonNode GetNode() const

Return the value of the current element.

string GetKey() const

When iterating over a JSON object, return the key of the current element.

Int8 AsInteger() const

Provided that this is a numeric node (that is, either an integer or a floating point node),...

void AppendBoolean(bool value)

For an array node, add a boolean node at the end of the array.

size_t GetSize() const

For a container node (that is, either an array or an object), return the number of elements in the co...

void SetAt(size_t index, CJsonNode::TInstance value)

For an array node, set a new value for an existing element.

static CJsonNode NewArrayNode()

Create a new JSON array node.

static CJsonNode GuessType(const CTempString &value)

Guess the type of a JSON scalar from the string representation of its value and initialize a new node...

void SetDouble(const string &key, double value)

Set a JSON object element to the specified floating point value.

bool HasKey(const string &key) const

Check if an object node has an element accessible by the specified key.

int TParseFlags

Binary OR of EParseFlags.

string Repr(TReprFlags flags=0) const

Return a string representation of this node.

bool IsArray() const

Return true for a JSON array. Return false otherwise.

void InsertAt(size_t index, CJsonNode::TInstance value)

For an array node, insert a new element at the specified position.

static CJsonNode ParseJSON(const string &json, TParseFlags flags=0)

int TReprFlags

Binary OR of EReprFlags.

CNetRef< SJsonNodeImpl > m_Impl

void DeleteByKey(const string &key)

Delete an element referred to by the specified key from a JSON object.

SJsonIteratorImpl * Iterate(EIterationMode mode=eNatural) const

For a container node (that is, either an array or an object), begin iteration over its elements.

static CJsonNode ParseObject(const string &json, TParseFlags flags=0)

void SetString(const string &key, const string &value)

Set a JSON object element to the specified string value.

void SetNull(const string &key)

Set a JSON object element to the specified null value.

string GetTypeName() const

Return a string identifying the node type.

void AppendInteger(Int8 value)

For an array node, add a integer node at the end of the array.

void AppendString(const string &value)

For an array node, add a string node at the end of the array.

const string AsString() const

Provided that this is a string node, return the string value of this node.

void SetBoolean(const string &key, bool value)

Set a JSON object element to the specified boolean value.

static CJsonNode NewDoubleNode(double value)

Create a new JSON double node.

static CJsonNode NewBooleanNode(bool value)

Create a new JSON boolean node.

static CJsonNode ParseArray(const string &json, TParseFlags flags=0)

bool AsBoolean() const

Provided that this is a boolean node, return the boolean value of this node.

ENodeType GetNodeType() const

Return a ENodeType constant identifying the node type.

void SetInteger(const string &key, Int8 value)

Set a JSON object element to the specified integer value.

void SetByKey(const string &key, CJsonNode::TInstance value)

For a JSON object node, insert a new element or update an existing element.

static CJsonNode NewIntegerNode(Int8 value)

Create a new JSON integer node.

bool IsObject() const

Return true for a JSON object. Return false otherwise.

void AppendDouble(double value)

For an array node, add a floating point node at the end of the array.

static CJsonNode NewStringNode(const string &value)

Create a new JSON string node.

CJsonNode GetAt(size_t index) const

Return a JSON array element at the specified index.

void DeleteAt(size_t index)

Delete an element located at the specified index from a JSON array.

EIterationMode

Different modes of array and object iteration.

ENodeType

JSON node type.

static CJsonNode NewObjectNode()

Create a new JSON object node.

void AppendNull()

For an array node, add a null node at the end of the array.

void Append(CJsonNode::TInstance value)

For an array node, add a new element at the end of the array.

CJsonNode GetByKeyOrNull(const string &key) const

For a JSON object node, return the value associated with the specified key.

static CJsonNode NewNullNode()

Create a new JSON null node.

double AsDouble() const

Provided that this is a numeric node (that is, either a floating point or an integer node),...

Exception class for use by CJsonNode.

virtual const char * GetErrCodeString() const override

Get error code interpreted as text.

bool m_HashValueIsExpected

bool x_AddNewNode(CJsonNode::TInstance new_node)

enum CJsonOverUTTPReader::@87 m_State

bool ReadMessage(CUTTPReader &reader)

CUTTPWriter & m_UTTPWriter

bool WriteMessage(const CJsonNode &root_node)

bool x_SendNode(const CJsonNode &node)

TOutputStack m_OutputStack

SOutputStackFrame m_CurrentOutputNode

void x_PushNode(const CJsonNode &node)

CJsonNode ParseJSON(const string &json)

CJsonParser(CJsonNode::TParseFlags flags)

CJsonNode::TParseFlags m_Flags

Int8 ParseInt(size_t len)

size_t GetPosition() const

double ParseDouble(size_t len)

size_t GetRemainder() const

CJsonNode ParseArray(const string &ns_output)

string ParseString(size_t max_len)

CJsonNode ParseObject(const string &ns_output)

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

Class for reading series of chunks sent by a CUTTPWriter instance as a stream of bytes.

EStreamParsingEvent GetNextEvent()

Parse the input buffer until a parsing event occurs.

EStreamParsingEvent ReadRawData(size_t data_size)

Tell the reader to switch to reading raw data of the specified length.

char GetControlSymbol() const

Return the control symbol that has been just read.

@ eChunk

Notify that the last part of the chunk has been read.

@ eEndOfBuffer

Notify that the end of the input buffer has been reached.

@ eChunkPart

Notify that a part of a chunk has been read and can be fetched by a call to the GetChunkPart() method...

@ eControlSymbol

Notify that a control symbol has been read.

@ eNumber

Notify that a number has been read.

Int8 GetNumber() const

Return the number that has been just read.

const char * GetChunkPart() const

Return a pointer to the buffer that contains a part of the chunk currently being read.

size_t GetChunkPartSize() const

Return the size of the buffer returned by the GetChunkPart() method.

bool SendControlSymbol(char symbol)

Send a control symbol over the output buffer.

bool SendNumber(Int8 number)

Send an integer over the output buffer.

bool SendRawData(const void *data, size_t data_size)

Mix a chunk of raw data right in the output stream.

bool SendChunk(const char *chunk, size_t chunk_length, bool to_be_continued)

Send a chunk of data to the output buffer.

parent_type::iterator iterator

parent_type::const_iterator const_iterator

static const char * str(char *buf, int n)

TErrCode GetErrCode(void) const

Get error code.

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

#define NCBI_THROW2(exception_class, err_code, message, extra)

Throw exception with extra parameter.

#define NCBI_THROW_FMT(exception_class, err_code, message)

The same as NCBI_THROW but with message processed as output to ostream.

virtual const char * GetErrCodeString(void) const

Get error code interpreted as text.

int64_t Int8

8-byte (64-bit) signed integer

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static bool StringToBool(const CTempString str)

Convert string to bool.

static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)

Get a printable version of the specified string.

static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)

Convert double to string.

static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-insensitive compare of a substring with another string.

static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)

Convert string to Int8.

static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)

Convert string to double.

static string JsonDecode(const CTempString str, size_t *n_read=NULL)

Decode a string encoded by JsonEncode.

static string JsonEncode(const CTempString str, EJsonEncode encoding=eJsonEnc_UTF8)

Encode a string for JSON.

static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)

Convert numeric value to string.

static string ParseQuoted(const CTempString str, size_t *n_read=NULL)

Discard C-style backslash escapes and extract a quoted string.

@ eJsonEnc_Quoted

Quote resulting string.

operation

Bit operations.

set< SJsonObjectElement > TJsonObjectElements

CNetRef< SJsonNodeImpl > TJsonNodeRef

CJsonNode::TInstance s_CreateImpl(CJsonNode::ENodeType type)

#define INVALID_FORMAT_ERROR()

static void s_Repr_Value(string &os, const CJsonNode &node, CJsonNode::TReprFlags flags)

static void s_Repr_Object(string &os, const CJsonNode &node, CJsonNode::TReprFlags flags)

set< SJsonObjectElement *, SObjectElementLessOrder > TJsonObjectElementOrder

static void s_Repr_Array(string &os, const CJsonNode &node, CJsonNode::TReprFlags flags)

vector< TJsonNodeRef > TJsonNodeVector

const struct ncbi::grid::netcache::search::fields::KEY key

const GenericPointer< typename T::ValueType > T2 value

NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.

bool x_DepthFirstSearchForScalar()

virtual SJsonNodeImpl * GetNode() const

vector< SFrame > m_IteratorStack

virtual bool IsValid() const

SFlattenIterator(const CJsonNode &container)

virtual string GetKey() const

virtual string GetKey() const

SJsonArrayIterator(SJsonArrayNodeImpl *container)

CNetRef< SJsonArrayNodeImpl > m_Container

virtual SJsonNodeImpl * GetNode() const

virtual bool IsValid() const

TJsonNodeVector::iterator m_Iterator

void VerifyIndexBounds(const char *operation, size_t index) const

SJsonFixedSizeNodeImpl(double value)

SJsonFixedSizeNodeImpl(Int8 value)

SJsonFixedSizeNodeImpl(bool value)

This interface should not be used directly.

const SJsonArrayNodeImpl * GetArrayNodeImpl(const char *operation) const

CJsonNode::ENodeType m_NodeType

void VerifyType(const char *operation, CJsonNode::ENodeType required_type) const

const char * GetTypeName() const

SJsonNodeImpl(CJsonNode::ENodeType node_type)

const SJsonObjectNodeImpl * GetObjectNodeImpl(const char *operation) const

virtual string GetKey() const

virtual SJsonNodeImpl * GetNode() const

TJsonObjectElementOrder::iterator m_Iterator

CNetRef< SJsonObjectNodeImpl > m_Container

virtual bool IsValid() const

SJsonObjectElementOrderIterator(SJsonObjectNodeImpl *container)

bool operator<(const SJsonObjectElement &right_hand) const

SJsonObjectElement(const string &key, SJsonNodeImpl *node_impl)

SJsonObjectKeyIterator(SJsonObjectNodeImpl *container)

virtual bool IsValid() const

CNetRef< SJsonObjectNodeImpl > m_Container

virtual string GetKey() const

virtual SJsonNodeImpl * GetNode() const

TJsonObjectElements::iterator m_Iterator

size_t m_NextElementOrder

TJsonObjectElementOrder m_ElementOrder

TJsonObjectElements m_Elements

SJsonStringNodeImpl(const string &str)

bool operator()(const SJsonObjectElement *left_hand, const SJsonObjectElement *right_hand) const


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4