1 #ifndef JSON_OVER_UTTP__HPP
2 #define JSON_OVER_UTTP__HPP
150 ENodeType GetNodeType()
const;
153 string GetTypeName()
const;
156 bool IsObject()
const;
159 bool IsArray()
const;
162 bool IsString()
const;
165 bool IsInteger()
const;
168 bool IsDouble()
const;
171 bool IsBoolean()
const;
177 bool IsContainer()
const;
180 bool IsScalar()
const;
201 size_t GetSize()
const;
204 void AppendString(
const string&
value);
210 void AppendDouble(
double value);
213 void AppendBoolean(
bool value);
230 void DeleteAt(
size_t index);
237 void SetString(
const string&
key,
const string&
value);
243 void SetDouble(
const string&
key,
double value);
246 void SetBoolean(
const string&
key,
bool value);
249 void SetNull(
const string&
key);
256 void DeleteByKey(
const string&
key);
260 bool HasKey(
const string&
key)
const;
275 string GetString(
const string&
key)
const;
285 double GetDouble(
const string&
key)
const;
290 bool GetBoolean(
const string&
key)
const;
294 const string AsString()
const;
299 Int8 AsInteger()
const;
304 double AsDouble()
const;
308 bool AsBoolean()
const;
312 fVerbatimIfString = 1 << 0,
313 fOmitOutermostBrackets = 1 << 1,
314 fStandardJson = 1 << 2
324 fStandardJson = EReprFlags::fStandardJson,
345 string GetKey()
const;
361 operator bool()
const;
420 "GetByKey(): no such key \"" <<
key <<
'\"');
474 inline CJsonIterator::operator
bool()
const
476 return m_Impl->IsValid();
479 inline CJsonIterator::operator
bool()
481 return m_Impl->IsValid();
544 bool WriteMessage(
const CJsonNode& root_node);
545 bool CompleteMessage();
546 void GetOutputBuffer(
const char** output_buffer,
547 size_t* output_buffer_size);
548 bool NextOutputBuffer();
580 const char** output_buffer,
size_t* output_buffer_size)
Exception class for use by CJsonNode.
NCBI_EXCEPTION_DEFAULT(CJsonException, CException)
@ 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.
Iterator for JSON arrays and objects.
CJsonNode operator*() const
An alternative way to get the value of the current element.
bool Next()
Skip to the next element if there is one, in which case TRUE is returned.
CNetRef< SJsonIteratorImpl > m_Impl
CJsonIterator & operator++()
An operator version of Next().
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),...
bool IsNull() const
Return true for a null node. Return false otherwise.
int TParseFlags
Binary OR of EParseFlags.
double GetDouble(const string &key) const
For a JSON object node, return the floating point number referred to by the specified key.
bool IsArray() const
Return true for a JSON array. Return false otherwise.
int TReprFlags
Binary OR of EReprFlags.
Int8 GetInteger(const string &key) const
For a JSON object node, return the integer referred to by the specified key.
bool IsBoolean() const
Return true for a boolean node. Return false otherwise.
EParseFlags
Parse methods flags.
const string AsString() const
Provided that this is a string node, return the string value of this node.
string GetString(const string &key) const
For a JSON object node, return the string referred to by the specified key.
static CJsonNode NewDoubleNode(double value)
Create a new JSON double node.
static CJsonNode NewBooleanNode(bool value)
Create a new JSON boolean node.
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.
bool IsDouble() const
Return true for a double node. Return false otherwise.
bool GetBoolean(const string &key) const
For a JSON object node, return the boolean referred to by the specified key.
static CJsonNode NewIntegerNode(Int8 value)
Create a new JSON integer node.
bool IsInteger() const
Return true for an integer node. Return false otherwise.
bool IsObject() const
Return true for a JSON object. Return false otherwise.
static CJsonNode NewStringNode(const string &value)
Create a new JSON string node.
EIterationMode
Different modes of array and object iteration.
bool IsContainer() const
Return true if the node is either an object or an array.
bool IsScalar() const
Return true if the node is any of the JSON scalar types.
EReprFlags
String representation flags.
CJsonNode GetByKey(const string &key) const
For a JSON object node, return the value associated with the specified key.
CJsonNode GetByKeyOrNull(const string &key) const
For a JSON object node, return the value associated with the specified key.
bool IsString() const
Return true for a string node. Return false otherwise.
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.
NCBI_EXCEPTION_DEFAULT(CJsonOverUTTPException, CException)
@ eUnexpectedClosingBracket
@ eChunkContinuationExpected
@ eUnexpectedTrailingToken
bool m_HashValueIsExpected
list< CJsonNode > TNodeStack
const CJsonNode GetMessage() const
CUTTPWriter & m_UTTPWriter
list< SOutputStackFrame > TOutputStack
CJsonOverUTTPWriter(CUTTPWriter &writer)
TOutputStack m_OutputStack
void GetOutputBuffer(const char **output_buffer, size_t *output_buffer_size)
SOutputStackFrame m_CurrentOutputNode
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.
Class that serializes series of chunks of data for sending over binary streams.
void GetOutputBuffer(const char **output_buffer, size_t *output_buffer_size)
Return data to be sent over the output stream and extend internal pointers to the next buffer.
bool NextOutputBuffer()
Proceed to the next output buffer.
#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.
CVect2< NCBI_PROMOTE(int,U) > operator*(int v1, const CVect2< U > &v2)
bool IsValid(const CSeq_point &pt, CScope *scope)
Checks that point >= 0 and point < length of Bioseq.
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.
#define NCBI_XCONNECT_EXPORT
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
#define NCBI_NET_COMPONENT(component)
This interface should not be used directly.
virtual bool IsValid() const =0
virtual SJsonNodeImpl * GetNode() const =0
virtual string GetKey() const =0
static bool SetInteger(wxSpinCtrl *spinctrl, int value)
static bool GetInteger(wxSpinCtrl *spinctrl, int *value)
This file contains declaration of the CDiscreteDistribution class.