|
||||
File indexing completed on 2025-01-18 10:04:58
0001 // Copyright (c) 2019 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _Standard_Dump_HeaderFile 0015 #define _Standard_Dump_HeaderFile 0016 0017 #include <NCollection_IndexedDataMap.hxx> 0018 #include <NCollection_List.hxx> 0019 #include <Standard_OStream.hxx> 0020 #include <Standard_SStream.hxx> 0021 #include <TCollection_AsciiString.hxx> 0022 0023 //!@file 0024 //! The file contains interface to prepare dump output for OCCT objects. Format of the dump is JSON. 0025 //! 0026 //! To prepare this output, implement method DumpJson in the object and use macro functions from this file. 0027 //! Macros have one parameter for both, key and the value. It is a field of the current class. Macro has internal analyzer that 0028 //! uses the variable name to generate key. If the parameter has prefix symbols "&", "*" and "my", it is cut. 0029 //! 0030 //! - OCCT_DUMP_FIELD_VALUE_NUMERICAL. Use it for fields of numerical C++ types, like int, float, double. It creates a pair "key", "value", 0031 //! - OCCT_DUMP_FIELD_VALUE_NUMERICAL_INC. Use it for fields of numerical C++ types, like int, float, double. 0032 //! It creates a pair "key_inc", "value", 0033 //! - OCCT_DUMP_FIELD_VALUE_STRING. Use it for char* type. It creates a pair "key", "value", 0034 //! - OCCT_DUMP_FIELD_VALUE_POINTER. Use it for pointer fields. It creates a pair "key", "value", where the value is the pointer address, 0035 //! - OCCT_DUMP_FIELD_VALUES_DUMPED. Use it for fields that has own Dump implementation. It expects the pointer to the class instance. 0036 //! It creates "key": { result of dump of the field } 0037 //! - OCCT_DUMP_FIELD_VALUES_DUMPED_INC. Use it for fields that has own Dump implementation. It expects the pointer to the class instance. 0038 //! It creates "key_inc": { result of dump of the field } 0039 //! - OCCT_DUMP_STREAM_VALUE_DUMPED. Use it for Standard_SStream. It creates "key": { text of stream } 0040 //! - OCCT_DUMP_FIELD_VALUES_NUMERICAL. Use it for unlimited list of fields of C++ double type. 0041 //! It creates massive of values [value_1, value_2, ...] 0042 //! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString types. 0043 //! It creates massive of values ["value_1", "value_2", ...] 0044 //! - OCCT_DUMP_BASE_CLASS. Use if Dump implementation of the class is virtual, to perform ClassName::Dump() of the parent class, 0045 //! expected parameter is the parent class name. 0046 //! It creates "key": { result of dump of the field } 0047 //! - OCCT_DUMP_VECTOR_CLASS. Use it as a single row in some object dump to have one row in output. 0048 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call. 0049 //! It creates massive of values [value_1, value_2, ...] 0050 //! 0051 //! The Dump result prepared by these macros is an output stream, it is not arranged with spaces and line feed. 0052 //! To have output in a more readable way, use ConvertToAlignedString method for obtained stream. 0053 0054 //! Converts the class type into a string value 0055 #define OCCT_CLASS_NAME(theClass) #theClass 0056 0057 //! @def OCCT_DUMP_CLASS_BEGIN 0058 //! Creates an instance of Sentry to cover the current Dump implementation with keys of start and end. 0059 //! This row should be inserted before other macros. The end key will be added by the sentry remove, 0060 //! (exit of the method). 0061 #define OCCT_DUMP_CLASS_BEGIN(theOStream, theField) \ 0062 { \ 0063 const char* className = OCCT_CLASS_NAME(theField); \ 0064 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, className) \ 0065 } 0066 0067 //! @def OCCT_DUMP_TRANSIENT_CLASS_BEGIN 0068 //! Creates an instance of Sentry to cover the current Dump implementation with keys of start and end. 0069 //! This row should be inserted before other macros. The end key will be added by the sentry remove, 0070 //! (exit of the method). 0071 #define OCCT_DUMP_TRANSIENT_CLASS_BEGIN(theOStream) \ 0072 { \ 0073 const char* className = get_type_name(); \ 0074 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, className) \ 0075 } 0076 0077 //! @def OCCT_DUMP_FIELD_VALUE_NUMERICAL 0078 //! Append into output value: "Name": Field 0079 #define OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, theField) \ 0080 { \ 0081 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \ 0082 Standard_Dump::AddValuesSeparator (theOStream); \ 0083 theOStream << "\"" << aName << "\": " << theField; \ 0084 } 0085 0086 //! @def OCCT_DUMP_FIELD_VALUE_NUMERICAL 0087 //! Append into output value: "Name": Field 0088 //! Inc name value added to the key to provide unique keys 0089 #define OCCT_DUMP_FIELD_VALUE_NUMERICAL_INC(theOStream, theField, theIncName) \ 0090 { \ 0091 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField) + theIncName; \ 0092 Standard_Dump::AddValuesSeparator (theOStream); \ 0093 theOStream << "\"" << aName << "\": " << theField; \ 0094 } 0095 0096 //! @def OCCT_INIT_FIELD_VALUE_REAL 0097 //! Append vector values into output value: "Name": [value_1, value_2, ...] 0098 //! This macro is intended to have only one row for dumped object in Json. 0099 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump. 0100 #define OCCT_INIT_FIELD_VALUE_REAL(theOStream, theStreamPos, theField) \ 0101 { \ 0102 Standard_Integer aStreamPos = theStreamPos; \ 0103 if (!Standard_Dump::ProcessFieldName (theOStream, #theField, aStreamPos)) \ 0104 return Standard_False; \ 0105 TCollection_AsciiString aValueText; \ 0106 if (!Standard_Dump::InitValue (theOStream, aStreamPos, aValueText) || !aValueText.IsRealValue()) \ 0107 return Standard_False; \ 0108 theField = aValueText.RealValue(); \ 0109 theStreamPos = aStreamPos; \ 0110 } 0111 0112 //! @def OCCT_INIT_FIELD_VALUE_NUMERICAL 0113 //! Append vector values into output value: "Name": [value_1, value_2, ...] 0114 //! This macro is intended to have only one row for dumped object in Json. 0115 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump. 0116 #define OCCT_INIT_FIELD_VALUE_INTEGER(theOStream, theStreamPos, theField) \ 0117 { \ 0118 Standard_Integer aStreamPos = theStreamPos; \ 0119 if (!Standard_Dump::ProcessFieldName (theOStream, #theField, aStreamPos)) \ 0120 return Standard_False; \ 0121 TCollection_AsciiString aValueText; \ 0122 if (!Standard_Dump::InitValue (theOStream, aStreamPos, aValueText) || !aValueText.IsIntegerValue()) \ 0123 return Standard_False; \ 0124 theField = aValueText.IntegerValue(); \ 0125 theStreamPos = aStreamPos; \ 0126 } 0127 0128 //! @def OCCT_DUMP_FIELD_VALUE_STRING 0129 //! Append into output value: "Name": "Field" 0130 #define OCCT_DUMP_FIELD_VALUE_STRING(theOStream, theField) \ 0131 { \ 0132 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \ 0133 Standard_Dump::AddValuesSeparator (theOStream); \ 0134 theOStream << "\"" << aName << "\": \"" << theField << "\""; \ 0135 } 0136 0137 //! @def OCCT_DUMP_FIELD_VALUE_POINTER 0138 //! Append into output value: "Name": "address of the pointer" 0139 #define OCCT_DUMP_FIELD_VALUE_POINTER(theOStream, theField) \ 0140 { \ 0141 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \ 0142 Standard_Dump::AddValuesSeparator (theOStream); \ 0143 theOStream << "\"" << aName << "\": \"" << Standard_Dump::GetPointerInfo (theField) << "\""; \ 0144 } 0145 0146 //! @def OCCT_DUMP_FIELD_VALUE_STRING 0147 //! Append into output value: "Name": "Field" 0148 #define OCCT_DUMP_FIELD_VALUE_GUID(theOStream, theField) \ 0149 { \ 0150 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \ 0151 Standard_Dump::AddValuesSeparator (theOStream); \ 0152 char aStr[Standard_GUID_SIZE_ALLOC]; \ 0153 theField.ToCString (aStr); \ 0154 theOStream << "\"" << aName << "\": \"" << aStr << "\""; \ 0155 } 0156 0157 //! @def OCCT_DUMP_FIELD_VALUES_DUMPED 0158 //! Append into output value: "Name": { field dumped values } 0159 //! It computes Dump of the fields. The expected field is a pointer. 0160 //! Use this macro for fields of the dumped class which has own Dump implementation. 0161 //! The macros is recursive. Recursion is stopped when the depth value becomes equal to zero. 0162 //! Depth = -1 is the default value, dump here is unlimited. 0163 #define OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, theField) \ 0164 { \ 0165 if (theDepth != 0 && (void*)(theField) != NULL) \ 0166 { \ 0167 Standard_SStream aFieldStream; \ 0168 (theField)->DumpJson (aFieldStream, theDepth - 1); \ 0169 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \ 0170 Standard_Dump::DumpKeyToClass (theOStream, aName, Standard_Dump::Text (aFieldStream)); \ 0171 } \ 0172 } 0173 0174 //! @def OCCT_DUMP_FIELD_VALUES_DUMPED_INC 0175 //! Append into output value: "Name": { field dumped values } 0176 //! It computes Dump of the fields. The expected field is a pointer. 0177 //! Use this macro for fields of the dumped class which has own Dump implementation. 0178 //! The macros is recursive. Recursion is stopped when the depth value becomes equal to zero. 0179 //! Depth = -1 is the default value, dump here is unlimited. 0180 //! Inc name value added to the key to provide unique keys 0181 #define OCCT_DUMP_FIELD_VALUES_DUMPED_INC(theOStream, theDepth, theField, theIncName) \ 0182 { \ 0183 if (theDepth != 0 && (void*)(theField) != NULL) \ 0184 { \ 0185 Standard_SStream aFieldStream; \ 0186 (theField)->DumpJson (aFieldStream, theDepth - 1); \ 0187 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField) + theIncName; \ 0188 Standard_Dump::DumpKeyToClass (theOStream, aName, Standard_Dump::Text (aFieldStream)); \ 0189 } \ 0190 } 0191 0192 //! @def OCCT_INIT_FIELD_VALUES_DUMPED 0193 //! Append into output value: "Name": { field dumped values } 0194 //! It computes Dump of the fields. The expected field is a pointer. 0195 //! Use this macro for fields of the dumped class which has own Dump implementation. 0196 //! The macros is recursive. Recursion is stopped when the depth value becomes equal to zero. 0197 //! Depth = -1 is the default value, dump here is unlimited. 0198 #define OCCT_INIT_FIELD_VALUES_DUMPED(theSStream, theStreamPos, theField) \ 0199 { \ 0200 if ((theField) == NULL || !(theField)->InitFromJson (theSStream, theStreamPos)) \ 0201 return Standard_False; \ 0202 } 0203 0204 //! @def OCCT_DUMP_STREAM_VALUE_DUMPED 0205 //! Append into output value: "Name": { stream text } 0206 //! It computes Dump of the fields. The expected field is a pointer. 0207 //! Use this macro for Standard_SStream field. 0208 #define OCCT_DUMP_STREAM_VALUE_DUMPED(theOStream, theField) \ 0209 { \ 0210 TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \ 0211 Standard_Dump::DumpKeyToClass (theOStream, aName, Standard_Dump::Text (theField)); \ 0212 } 0213 0214 //! @def OCCT_DUMP_FIELD_VALUES_NUMERICAL 0215 //! Append real values into output values in an order: [value_1, value_2, ...] 0216 //! It computes Dump of the parent. The expected field is a parent class name to call ClassName::Dump. 0217 #define OCCT_DUMP_FIELD_VALUES_NUMERICAL(theOStream, theName, theCount, ...) \ 0218 { \ 0219 Standard_Dump::AddValuesSeparator (theOStream); \ 0220 theOStream << "\"" << theName << "\": ["; \ 0221 Standard_Dump::DumpRealValues (theOStream, theCount, __VA_ARGS__);\ 0222 theOStream << "]"; \ 0223 } 0224 0225 //! @def OCCT_DUMP_FIELD_VALUES_STRING 0226 //! Append real values into output values in an order: ["value_1", "value_2", ...] 0227 //! It computes Dump of the parent. The expected field is a parent class name to call ClassName::Dump. 0228 #define OCCT_DUMP_FIELD_VALUES_STRING(theOStream, theName, theCount, ...) \ 0229 { \ 0230 Standard_Dump::AddValuesSeparator (theOStream); \ 0231 theOStream << "\"" << theName << "\": ["; \ 0232 Standard_Dump::DumpCharacterValues (theOStream, theCount, __VA_ARGS__);\ 0233 theOStream << "]"; \ 0234 } 0235 0236 //! @def OCCT_DUMP_BASE_CLASS 0237 //! Append into output value: "Name": { field dumped values } 0238 //! It computes Dump of the parent. The expected field is a parent class name to call ClassName::Dump. 0239 //! Use this macro for parent of the current class. 0240 //! The macros is recursive. Recursive is stopped when the depth value becomes equal to zero. 0241 //! Depth = -1 is the default value, dump here is unlimited. 0242 #define OCCT_DUMP_BASE_CLASS(theOStream, theDepth, theField) \ 0243 { \ 0244 if (theDepth != 0) \ 0245 { \ 0246 Standard_Dump::AddValuesSeparator (theOStream); \ 0247 theField::DumpJson (theOStream, theDepth - 1); \ 0248 } \ 0249 } 0250 0251 //! @def OCCT_DUMP_VECTOR_CLASS 0252 //! Append vector values into output value: "Name": [value_1, value_2, ...] 0253 //! This macro is intended to have only one row for dumped object in Json. 0254 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump. 0255 #define OCCT_DUMP_VECTOR_CLASS(theOStream, theName, theCount, ...) \ 0256 { \ 0257 Standard_Dump::AddValuesSeparator (theOStream); \ 0258 theOStream << "\"" << theName << "\": ["; \ 0259 Standard_Dump::DumpRealValues (theOStream, theCount, __VA_ARGS__);\ 0260 theOStream << "]"; \ 0261 } 0262 0263 //! @def OCCT_INIT_VECTOR_CLASS 0264 //! Append vector values into output value: "Name": [value_1, value_2, ...] 0265 //! This macro is intended to have only one row for dumped object in Json. 0266 //! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump. 0267 #define OCCT_INIT_VECTOR_CLASS(theOStream, theName, theStreamPos, theCount, ...) \ 0268 { \ 0269 Standard_Integer aStreamPos = theStreamPos; \ 0270 if (!Standard_Dump::ProcessStreamName (theOStream, theName, aStreamPos)) \ 0271 return Standard_False; \ 0272 if (!Standard_Dump::InitRealValues (theOStream, aStreamPos, theCount, __VA_ARGS__)) \ 0273 return Standard_False; \ 0274 theStreamPos = aStreamPos; \ 0275 } 0276 0277 //! Kind of key in Json string 0278 enum Standard_JsonKey 0279 { 0280 Standard_JsonKey_None, //!< no key 0281 Standard_JsonKey_OpenChild, //!< "{" 0282 Standard_JsonKey_CloseChild, //!< "}" 0283 Standard_JsonKey_OpenContainer, //!< "[" 0284 Standard_JsonKey_CloseContainer, //!< "]" 0285 Standard_JsonKey_Quote, //!< "\"" 0286 Standard_JsonKey_SeparatorKeyToValue, //!< ": " 0287 Standard_JsonKey_SeparatorValueToValue //!< ", " 0288 }; 0289 0290 //! Type for storing a dump value with the stream position 0291 struct Standard_DumpValue 0292 { 0293 Standard_DumpValue() : myStartPosition (0) {} 0294 Standard_DumpValue (const TCollection_AsciiString& theValue, const Standard_Integer theStartPos) 0295 : myValue (theValue), myStartPosition (theStartPos) {} 0296 0297 TCollection_AsciiString myValue; //!< current string value 0298 Standard_Integer myStartPosition; //!< position of the value first char in the whole stream 0299 }; 0300 0301 //! This interface has some tool methods for stream (in JSON format) processing. 0302 class Standard_Dump 0303 { 0304 public: 0305 //! Converts stream value to string value. The result is original stream value. 0306 //! @param theStream source value 0307 //! @return text presentation 0308 Standard_EXPORT static TCollection_AsciiString Text (const Standard_SStream& theStream); 0309 0310 //! Converts stream value to string value. Improves the text presentation with the following cases: 0311 //! - for '{' append after '\n' and indent to the next value, increment current indent value 0312 //! - for '}' append '\n' and current indent before it, decrement indent value 0313 //! - for ',' append after '\n' and indent to the next value. If the current symbol is in massive container [], do nothing 0314 //! Covers result with opened and closed brackets on the top level, if it has no symbols there. 0315 //! @param theStream source value 0316 //! @param theIndent count of ' ' symbols to apply hierarchical indent of the text values 0317 //! @return text presentation 0318 Standard_EXPORT static TCollection_AsciiString FormatJson (const Standard_SStream& theStream, const Standard_Integer theIndent = 3); 0319 0320 //! Converts stream into map of values. 0321 //! 0322 //! The one level stream example: 'key_1: value_1, key_2: value_2' 0323 //! In output: values contain 'key_1: value_1' and 'key_2: value_2'. 0324 //! 0325 //! 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' 0326 //! 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'. 0327 //! The sublevel value might be processed later using the same method. 0328 //! 0329 //! @param theStreamStr stream value 0330 //! @param theKeyToValues [out] container of split values. It contains key to value and position of the value in the stream text 0331 Standard_EXPORT static Standard_Boolean SplitJson (const TCollection_AsciiString& theStreamStr, 0332 NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theKeyToValues); 0333 0334 //! Returns container of indices in values, that has hierarchical value 0335 Standard_EXPORT static NCollection_List<Standard_Integer> HierarchicalValueIndices ( 0336 const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues); 0337 0338 //! Returns true if the value has bracket key 0339 Standard_EXPORT static Standard_Boolean HasChildKey (const TCollection_AsciiString& theSourceValue); 0340 0341 //! Returns key value for enum type 0342 Standard_EXPORT static Standard_CString JsonKeyToString (const Standard_JsonKey theKey); 0343 0344 //! Returns length value for enum type 0345 Standard_EXPORT static Standard_Integer JsonKeyLength (const Standard_JsonKey theKey); 0346 0347 //! @param theOStream source value 0348 static Standard_EXPORT void AddValuesSeparator (Standard_OStream& theOStream); 0349 0350 //! Returns default prefix added for each pointer info string if short presentation of pointer used 0351 static TCollection_AsciiString GetPointerPrefix() { return "0x"; } 0352 0353 //! Convert handle pointer to address of the pointer. If the handle is NULL, the result is an empty string. 0354 //! @param thePointer a pointer 0355 //! @param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped 0356 //! @return the string value 0357 Standard_EXPORT static TCollection_AsciiString GetPointerInfo (const Handle(Standard_Transient)& thePointer, 0358 const bool isShortInfo = true); 0359 0360 //! Convert pointer to address of the pointer. If the handle is NULL, the result is an empty string. 0361 //! @param thePointer a pointer 0362 //! @param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped 0363 //! @return the string value 0364 Standard_EXPORT static TCollection_AsciiString GetPointerInfo (const void* thePointer, 0365 const bool isShortInfo = true); 0366 0367 //! Append into output value: "Name": { Field } 0368 //! @param theOStream [out] stream to be fill with values 0369 //! @param theKey a source value 0370 //! @param theField stream value 0371 Standard_EXPORT static void DumpKeyToClass (Standard_OStream& theOStream, 0372 const TCollection_AsciiString& theKey, 0373 const TCollection_AsciiString& theField); 0374 0375 //! Unite values in one value using template: "value_1", "value_2", ..., "value_n" 0376 //! @param theOStream [out] stream to be fill with values 0377 //! @param theCount [in] number of values 0378 Standard_EXPORT static void DumpCharacterValues (Standard_OStream& theOStream, int theCount, ...); 0379 0380 //! Unite values in one value using template: value_1, value_2, ..., value_n 0381 //! @param theOStream [out] stream to be fill with values 0382 //! @param theCount [in] number of values 0383 Standard_EXPORT static void DumpRealValues (Standard_OStream& theOStream, int theCount, ...); 0384 0385 //! Check whether the parameter name is equal to the name in the stream at position 0386 //! @param[in] theStreamStr stream with values 0387 //! @param[in] theName stream key value 0388 //! @param[out] theStreamPos current position in the stream 0389 Standard_EXPORT static Standard_Boolean ProcessStreamName (const TCollection_AsciiString& theStreamStr, 0390 const TCollection_AsciiString& theName, 0391 Standard_Integer& theStreamPos); 0392 0393 //! Check whether the field name is equal to the name in the stream at position 0394 //! @param[in] theStreamStr stream with values 0395 //! @param[in] theName stream key field value 0396 //! @param[out] theStreamPos current position in the stream 0397 Standard_EXPORT static Standard_Boolean ProcessFieldName (const TCollection_AsciiString& theStreamStr, 0398 const TCollection_AsciiString& theName, 0399 Standard_Integer& theStreamPos); 0400 0401 //! Unite values in one value using template: value_1, value_2, ..., value_n 0402 //! @param[in] theStreamStr stream with values 0403 //! @param[out] theStreamPos current position in the stream 0404 //! @param[in] theCount number of values 0405 Standard_EXPORT static Standard_Boolean InitRealValues (const TCollection_AsciiString& theStreamStr, 0406 Standard_Integer& theStreamPos, 0407 int theCount, ...); 0408 0409 //! Returns real value 0410 //! @param[in] theStreamStr stream with values 0411 //! @param[out] theStreamPos current position in the stream 0412 //! @param[out] theValue stream value 0413 Standard_EXPORT static Standard_Boolean InitValue (const TCollection_AsciiString& theStreamStr, 0414 Standard_Integer& theStreamPos, 0415 TCollection_AsciiString& theValue); 0416 0417 //! Convert field name into dump text value, removes "&" and "my" prefixes 0418 //! An example, for field myValue, theName is Value, for &myCLass, the name is Class 0419 //! @param theField a source value 0420 Standard_EXPORT static TCollection_AsciiString DumpFieldToName (const TCollection_AsciiString& theField); 0421 0422 private: 0423 //! Extracts from the string value a pair (key, value), add it into output container, update index value 0424 //! Example: 0425 //! stream string starting the index position contains: ..."key": <value>... 0426 //! a pair key, value will be added into theValues 0427 //! at beginning theIndex is the position of the quota before <key>, after the index is the next position after the value 0428 //! splitDumped(aString) gives theSplitValue = "abc", theTailValue = "defg", theKey = "key" 0429 Standard_EXPORT static Standard_Boolean splitKeyToValue (const TCollection_AsciiString& theStreamStr, 0430 Standard_Integer theStartIndex, 0431 Standard_Integer& theNextIndex, 0432 NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue>& theValues); 0433 0434 0435 //! Returns key of json in the index position. Incement the index position to the next symbol in the row 0436 Standard_EXPORT static Standard_Boolean jsonKey (const TCollection_AsciiString& theStreamStr, 0437 Standard_Integer theStartIndex, 0438 Standard_Integer& theNextIndex, 0439 Standard_JsonKey& theKey); 0440 0441 //! Find position in the source string of the symbol close after the start position. 0442 //! Ignore combination <symbol open> ... <symbol close> between the close symbol. 0443 //! Example, for case ... { ... { ... } ...} ... } it returns the position of the forth brace 0444 Standard_EXPORT static Standard_Integer nextClosePosition (const TCollection_AsciiString& theSourceValue, 0445 const Standard_Integer theStartPosition, 0446 const Standard_JsonKey theCloseKey, 0447 const Standard_JsonKey theOpenKey); 0448 0449 }; 0450 0451 #endif // _Standard_Dump_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |