Open CASCADE Technology  7.7.0
Static Public Member Functions

Standard_Dump Class Reference

This interface has some tool methods for stream (in JSON format) processing. More...

#include <Standard_Dump.hxx>

Static Public Member Functions

static TCollection_AsciiString Text (const Standard_SStream &theStream)
 Converts stream value to string value. The result is original stream value. More...
 
static TCollection_AsciiString FormatJson (const Standard_SStream &theStream, const Standard_Integer theIndent=3)
 Converts stream value to string value. Improves the text presentation with the following cases: More...
 
static Standard_Boolean SplitJson (const TCollection_AsciiString &theStreamStr, NCollection_IndexedDataMap< TCollection_AsciiString, Standard_DumpValue > &theKeyToValues)
 Converts stream into map of values. More...
 
static NCollection_List< Standard_IntegerHierarchicalValueIndices (const NCollection_IndexedDataMap< TCollection_AsciiString, TCollection_AsciiString > &theValues)
 Returns container of indices in values, that has hierarchical value. More...
 
static Standard_Boolean HasChildKey (const TCollection_AsciiString &theSourceValue)
 Returns true if the value has bracket key. More...
 
static Standard_CString JsonKeyToString (const Standard_JsonKey theKey)
 Returns key value for enum type. More...
 
static Standard_Integer JsonKeyLength (const Standard_JsonKey theKey)
 Returns length value for enum type. More...
 
static void AddValuesSeparator (Standard_OStream &theOStream)
 
static TCollection_AsciiString GetPointerPrefix ()
 Returns default prefix added for each pointer info string if short presentation of pointer used. More...
 
static TCollection_AsciiString GetPointerInfo (const Handle< Standard_Transient > &thePointer, const bool isShortInfo=true)
 Convert handle pointer to address of the pointer. If the handle is NULL, the result is an empty string. More...
 
static TCollection_AsciiString GetPointerInfo (const void *thePointer, const bool isShortInfo=true)
 Convert pointer to address of the pointer. If the handle is NULL, the result is an empty string. More...
 
static void DumpKeyToClass (Standard_OStream &theOStream, const TCollection_AsciiString &theKey, const TCollection_AsciiString &theField)
 Append into output value: "Name": { Field }. More...
 
static void DumpCharacterValues (Standard_OStream &theOStream, int theCount,...)
 Unite values in one value using template: "value_1", "value_2", ..., "value_n". More...
 
static void DumpRealValues (Standard_OStream &theOStream, int theCount,...)
 Unite values in one value using template: value_1, value_2, ..., value_n. More...
 
static Standard_Boolean ProcessStreamName (const TCollection_AsciiString &theStreamStr, const TCollection_AsciiString &theName, Standard_Integer &theStreamPos)
 Check whether the parameter name is equal to the name in the stream at position. More...
 
static Standard_Boolean ProcessFieldName (const TCollection_AsciiString &theStreamStr, const TCollection_AsciiString &theName, Standard_Integer &theStreamPos)
 Check whether the field name is equal to the name in the stream at position. More...
 
static Standard_Boolean InitRealValues (const TCollection_AsciiString &theStreamStr, Standard_Integer &theStreamPos, int theCount,...)
 Unite values in one value using template: value_1, value_2, ..., value_n. More...
 
static Standard_Boolean InitValue (const TCollection_AsciiString &theStreamStr, Standard_Integer &theStreamPos, TCollection_AsciiString &theValue)
 Returns real value. More...
 
static TCollection_AsciiString DumpFieldToName (const TCollection_AsciiString &theField)
 Convert field name into dump text value, removes "&" and "my" prefixes An example, for field myValue, theName is Value, for &myCLass, the name is Class. More...
 

Detailed Description

This interface has some tool methods for stream (in JSON format) processing.

Member Function Documentation

◆ AddValuesSeparator()

static void Standard_Dump::AddValuesSeparator ( Standard_OStream theOStream)
static
Parameters
theOStreamsource value

◆ DumpCharacterValues()

static void Standard_Dump::DumpCharacterValues ( Standard_OStream theOStream,
int  theCount,
  ... 
)
static

Unite values in one value using template: "value_1", "value_2", ..., "value_n".

Parameters
theOStream[out] stream to be fill with values
theCount[in] number of values

◆ DumpFieldToName()

static TCollection_AsciiString Standard_Dump::DumpFieldToName ( const TCollection_AsciiString theField)
static

Convert field name into dump text value, removes "&" and "my" prefixes An example, for field myValue, theName is Value, for &myCLass, the name is Class.

Parameters
theFielda source value

◆ DumpKeyToClass()

static void Standard_Dump::DumpKeyToClass ( Standard_OStream theOStream,
const TCollection_AsciiString theKey,
const TCollection_AsciiString theField 
)
static

Append into output value: "Name": { Field }.

Parameters
theOStream[out] stream to be fill with values
theKeya source value
theFieldstream value

◆ DumpRealValues()

static void Standard_Dump::DumpRealValues ( Standard_OStream theOStream,
int  theCount,
  ... 
)
static

Unite values in one value using template: value_1, value_2, ..., value_n.

Parameters
theOStream[out] stream to be fill with values
theCount[in] number of values

◆ FormatJson()

static TCollection_AsciiString Standard_Dump::FormatJson ( const Standard_SStream theStream,
const Standard_Integer  theIndent = 3 
)
static

Converts stream value to string value. Improves the text presentation with the following cases:

  • for '{' append after '
    ' and indent to the next value, increment current indent value
  • for '}' append '
    ' and current indent before it, decrement indent value
  • for ',' append after '
    ' and indent to the next value. If the current symbol is in massive container [], do nothing Covers result with opened and closed brackets on the top level, if it has no symbols there.
    Parameters
    theStreamsource value
    theIndentcount of ' ' symbols to apply hierarchical indent of the text values
    Returns
    text presentation

◆ GetPointerInfo() [1/2]

static TCollection_AsciiString Standard_Dump::GetPointerInfo ( const Handle< Standard_Transient > &  thePointer,
const bool  isShortInfo = true 
)
static

Convert handle pointer to address of the pointer. If the handle is NULL, the result is an empty string.

Parameters
thePointera pointer
isShortInfoif true, all '0' symbols in the beginning of the pointer are skipped
Returns
the string value

◆ GetPointerInfo() [2/2]

static TCollection_AsciiString Standard_Dump::GetPointerInfo ( const void *  thePointer,
const bool  isShortInfo = true 
)
static

Convert pointer to address of the pointer. If the handle is NULL, the result is an empty string.

Parameters
thePointera pointer
isShortInfoif true, all '0' symbols in the beginning of the pointer are skipped
Returns
the string value

◆ GetPointerPrefix()

static TCollection_AsciiString Standard_Dump::GetPointerPrefix ( )
inlinestatic

Returns default prefix added for each pointer info string if short presentation of pointer used.

◆ HasChildKey()

static Standard_Boolean Standard_Dump::HasChildKey ( const TCollection_AsciiString theSourceValue)
static

Returns true if the value has bracket key.

◆ HierarchicalValueIndices()

static NCollection_List<Standard_Integer> Standard_Dump::HierarchicalValueIndices ( const NCollection_IndexedDataMap< TCollection_AsciiString, TCollection_AsciiString > &  theValues)
static

Returns container of indices in values, that has hierarchical value.

◆ InitRealValues()

static Standard_Boolean Standard_Dump::InitRealValues ( const TCollection_AsciiString theStreamStr,
Standard_Integer theStreamPos,
int  theCount,
  ... 
)
static

Unite values in one value using template: value_1, value_2, ..., value_n.

Parameters
[in]theStreamStrstream with values
[out]theStreamPoscurrent position in the stream
[in]theCountnumber of values

◆ InitValue()

static Standard_Boolean Standard_Dump::InitValue ( const TCollection_AsciiString theStreamStr,
Standard_Integer theStreamPos,
TCollection_AsciiString theValue 
)
static

Returns real value.

Parameters
[in]theStreamStrstream with values
[out]theStreamPoscurrent position in the stream
[out]theValuestream value

◆ JsonKeyLength()

static Standard_Integer Standard_Dump::JsonKeyLength ( const Standard_JsonKey  theKey)
static

Returns length value for enum type.

◆ JsonKeyToString()

static Standard_CString Standard_Dump::JsonKeyToString ( const Standard_JsonKey  theKey)
static

Returns key value for enum type.

◆ ProcessFieldName()

static Standard_Boolean Standard_Dump::ProcessFieldName ( const TCollection_AsciiString theStreamStr,
const TCollection_AsciiString theName,
Standard_Integer theStreamPos 
)
static

Check whether the field name is equal to the name in the stream at position.

Parameters
[in]theStreamStrstream with values
[in]theNamestream key field value
[out]theStreamPoscurrent position in the stream

◆ ProcessStreamName()

static Standard_Boolean Standard_Dump::ProcessStreamName ( const TCollection_AsciiString theStreamStr,
const TCollection_AsciiString theName,
Standard_Integer theStreamPos 
)
static

Check whether the parameter name is equal to the name in the stream at position.

Parameters
[in]theStreamStrstream with values
[in]theNamestream key value
[out]theStreamPoscurrent position in the stream

◆ SplitJson()

static Standard_Boolean Standard_Dump::SplitJson ( const TCollection_AsciiString theStreamStr,
NCollection_IndexedDataMap< TCollection_AsciiString, Standard_DumpValue > &  theKeyToValues 
)
static

Converts stream into map of values.

The one level stream example: 'key_1: value_1, key_2: value_2' In output: values contain 'key_1: value_1' and 'key_2: value_2'.

The two level stream example: 'key_1: value_1, key_2: value_2, key_3: {sublevel_key_1: sublevel_value_1}, key_4: value_4' In output values contain 'key_1: value_1', 'key_2: value_2', 'key_3: {sublevel_key_1: sublevel_value_1}' and 'key_4: value_4'. The sublevel value might be processed later using the same method.

Parameters
theStreamStrstream value
theKeyToValues[out] container of split values. It contains key to value and position of the value in the stream text

◆ Text()

static TCollection_AsciiString Standard_Dump::Text ( const Standard_SStream theStream)
static

Converts stream value to string value. The result is original stream value.

Parameters
theStreamsource value
Returns
text presentation

The documentation for this class was generated from the following file: