|
Options |
Name |
Purpose |
|
|
|
AddArrayPrimitive (JsonArray, character)
|
Adds a primitive value to a JsonArray by detecting its type
Notes :
@param poArray The JsonArray to add the value to
@param pcValue The string representation of the value
*/
|
|
|
|
AddListItemArray (longchar, integer, integer, character, character, integer, JsonArray)
|
Parses a list item that is an array itself and adds it to the
surrounding array
Notes : Prefixes the header with an internal key and reuses the named
array parser, as ParseRootArray does
@param plcLines The full TOON content split by LF
@param piTotal The total number of lines
@param piDepth The indentation depth of the list item
@param pcHeader The array header of the list item, for example [2]
@param pcInlineValue The value after the colon of an inline array
@param piLine INPUT-OUTPUT The current line index
@param poArray The JsonArray to add the nested array to
*/
|
|
|
|
AddPrimitiveValue (JsonObject, character, character)
|
Adds a primitive value to a JsonObject by detecting its type
Notes : Detects null, boolean, number, and string (with unquoting)
@param poObject The JsonObject to add the value to
@param pcKey The property name
@param pcValue The string representation of the value
*/
|
|
|
|
CHARACTER CanonicalDecimal (decimal)
|
Converts a decimal to canonical string representation
Notes : Strips trailing zeros from the fractional part
@param pdeValue The decimal value to convert
@return The canonical decimal string
*/
|
|
|
|
LONGCHAR Convert (JsonArray)
|
Converts a JsonArray to TOON format
Notes : An array at root level uses the same encoding as a named
array, but omits the key, as required by TOON v3.0
@param poJson The JsonArray to convert
@return The TOON representation as LONGCHAR
*/
|
|
|
|
LONGCHAR Convert (JsonObject)
|
Converts a JsonObject to TOON format
Notes :
@param poJson The JsonObject to convert
@return The TOON representation as LONGCHAR
*/
|
|
|
|
CHARACTER EscapeString (character)
|
Escapes special characters in a quoted TOON string
Notes : Only the five TOON escape sequences are used. The backslash
has to be escaped first, so that the backslashes of the other
escape sequences are not escaped again (SCL-5973)
@param pcValue The string to escape
@return The escaped string
*/
|
|
|
|
INTEGER FindKeyColon (character)
|
Finds the position of the key-terminating colon in a line
Notes : Skips colons inside quoted strings and array headers
@param pcLine The line to search
@return The position of the colon, or 0 if not found
*/
|
|
|
|
INTEGER FirstContentLine (longchar, integer)
|
Returns the index of the first line that carries content
Notes : Returns a value greater than piTotal when every line is blank
@param plcLines The full TOON content split by LF
@param piTotal The total number of lines
@return The index of the first non blank line
*/
|
|
|
|
CHARACTER FormatArrayNumber (JsonArray, integer)
|
Formats a number from a JsonArray element in canonical form
Notes :
@param poArray The JsonArray containing the element
@param piIndex The 1-based index of the element
@return The canonical number string
*/
|
|
|
|
CHARACTER FormatArrayPrimitive (JsonArray, integer)
|
Formats a primitive value from a JsonArray element
Notes :
@param poArray The JsonArray containing the element
@param piIndex The 1-based index of the element
@return The formatted primitive value
*/
|
|
|
|
CHARACTER FormatNumber (JsonObject, character)
|
Formats a number from a JsonObject property in canonical form
Notes : Removes trailing zeros, ensures no exponent notation
@param poObj The JsonObject containing the property
@param pcName The property name
@return The canonical number string
*/
|
|
|
|
CHARACTER FormatPrimitive (JsonObject, character)
|
Formats a primitive value from a JsonObject property
Notes : Applies TOON quoting and number canonicalization rules
@param poObj The JsonObject containing the property
@param pcName The property name
@return The formatted primitive value
*/
|
|
|
|
CHARACTER FormatString (character)
|
Formats a string value with TOON quoting rules
Notes : Quotes are added only when necessary per the spec
@param pcValue The string value to format
@return The formatted (possibly quoted) string
*/
|
|
|
|
INTEGER GetDepth (character)
|
Calculates the indentation depth of a line
Notes :
@param pcLine The line to measure
@return The depth (number of indent levels)
*/
|
|
|
|
CHARACTER Indent (integer)
|
Returns the indentation string for the given depth
Notes : Uses 2 spaces per level as the TOON default
@param piDepth The indentation depth
@return The indentation string
*/
|
|
|
|
LOGICAL IsArrayHeader (character)
|
Checks if a key contains an array header pattern
Notes : Looks for key[N] or key[N]{fields} pattern
@param pcKey The key to check
@return TRUE if the key is an array header
*/
|
|
|
|
LOGICAL IsNumericToken (character)
|
Checks if a token represents a numeric value
Notes :
@param pcValue The token to check
@return TRUE if the token is a valid number
*/
|
|
|
|
LOGICAL IsPrimitiveArray (JsonArray)
|
Checks if all elements in an array are primitive types
Notes :
@param poArray The JsonArray to check
@return TRUE if all elements are primitives
*/
|
|
|
|
LOGICAL IsTabularArray (JsonArray)
|
Checks if an array qualifies for tabular encoding
Notes : All elements must be objects with identical key sets and
all values must be primitives
@param poArray The JsonArray to check
@return TRUE if the array can be encoded in tabular format
*/
|
|
|
|
LOGICAL LooksLikeNumber (character)
|
Checks if a string looks like a numeric token
Notes : Matches patterns like 123, -123, 1.5, 1e6, 05
@param pcValue The string to check
@return TRUE if the string could be confused with a number
*/
|
|
|
|
LOGICAL NeedsQuoting (character)
|
Determines if a string value requires quoting in TOON
Notes : Checks for reserved words, special characters, numeric patterns
@param pcValue The string value to check
@return TRUE if the value needs quoting
*/
|
|
|
|
ParseArrayFromHeader (longchar, integer, integer, character, character, integer, JsonObject)
|
Parses an array from its header line
Notes : Handles inline primitive, tabular, and mixed arrays
@param plcLines The full TOON content
@param piTotal The total number of lines
@param piDepth The current depth
@param pcHeader The array header (e.g. key[3] or key[3]{f1,f2})
@param pcInlineValue The value after the colon (for inline arrays)
@param piLine INPUT-OUTPUT The current line index
@param poObject The parent JsonObject
*/
|
|
|
|
ParseArrayFromHeaderForListItem (longchar, integer, integer, character, character, integer, JsonObject)
|
Parses an array header within a list-item object context
Notes :
@param plcLines The full TOON content
@param piTotal The total number of lines
@param piDepth The current depth
@param pcHeader The array header
@param pcInlineValue The inline value after the colon
@param piLine INPUT-OUTPUT The current line index
@param poObject The parent JsonObject
*/
|
|
|
|
DECIMAL ParseDecimal (character)
|
Parses a decimal from a TOON numeric token
Notes : TOON always uses period as decimal point, so we must
enforce American numeric format for parsing
@param pcValue The numeric token string
@return The parsed decimal value
*/
|
|
|
|
ParseInlineValues (character, integer, JsonArray)
|
Parses inline comma-separated values into a JsonArray
Notes :
@param pcValues The comma-separated values string
@param piCount The declared element count
@param poArray The JsonArray to populate
*/
|
|
|
|
ParseListItemObjectFields (longchar, integer, integer, integer, JsonObject)
|
Parses remaining fields of a list-item object
Notes : After the first field on the hyphen line, remaining fields
appear at depth+1
@param plcLines The full TOON content
@param piTotal The total number of lines
@param piDepth The expected indentation depth for remaining fields
@param piLine INPUT-OUTPUT The current line index
@param poObject The object to add fields to
*/
|
|
|
|
ParseListItems (longchar, integer, integer, integer, integer, JsonArray)
|
Parses list items (mixed array) from TOON lines
Notes :
@param plcLines The full TOON content
@param piTotal The total number of lines
@param piDepth The expected indentation depth for items
@param piCount The declared element count
@param piLine INPUT-OUTPUT The current line index
@param poArray The JsonArray to populate
*/
|
|
|
|
ParseObject (longchar, integer, integer, integer, JsonObject)
|
Parses object properties from TOON lines at a given depth
Notes :
@param plcLines The full TOON content split by LF
@param piTotal The total number of lines
@param piDepth The expected indentation depth
@param piLine INPUT-OUTPUT The current line index
@param poObject The JsonObject to populate
*/
|
|
|
|
Progress.Json.ObjectModel.JsonArray ParseRootArray (longchar, integer, integer)
|
Parses an array rooted TOON document into a JsonArray
Notes : Prefixes the header with an internal key and reuses the named
array parser, so the tabular, inline and list item forms are
handled by exactly the same code as for a named array
@param plcLines The full TOON content split by LF
@param piTotal The total number of lines
@param piLine INPUT-OUTPUT The current line index
@return The parsed JsonArray
*/
|
|
|
|
ParseTabularRows (longchar, integer, integer, integer, character, integer, JsonArray)
|
Parses tabular rows into an array of objects
Notes :
@param plcLines The full TOON content
@param piTotal The total number of lines
@param piDepth The expected indentation depth for rows
@param piCount The declared row count
@param pcFields Comma-separated field names
@param piLine INPUT-OUTPUT The current line index
@param poArray The JsonArray to populate
*/
|
|
|
|
LONGCHAR RemoveTrailingNewLine (longchar)
|
Removes a single trailing newline from a TOON document
Notes : The spec does not allow a trailing newline on the document
@param plcToon The TOON document to trim
@return The TOON document without its trailing newline
*/
|
|
|
|
CHARACTER SplitValues (character)
|
Splits a comma-separated TOON value list (a tabular row or the
values of an inline array) into its values
Notes : SCL-5976. Only commas outside of quoted values separate the
values. Inside a quoted value the character following a
backslash is skipped, so an escaped double quote does not end
the quoted value. The values are returned as they are written
(quoted values keep their quotes and escape sequences). An
empty list returns a single empty value
@param pcValues The comma-separated values
@return The values
*/
|
|
|
|
Progress.Json.ObjectModel.JsonConstruct ToJson (longchar)
|
Parses a TOON string and returns the JSON construct at its root
Notes : Returns a JsonObject for an object rooted document and a
JsonArray for an array rooted document. Callers that know which
of the two to expect should use ToJsonObject or ToJsonArray
@param plcToon The TOON string to parse
@return The parsed JsonObject or JsonArray
*/
|
|
|
|
Progress.Json.ObjectModel.JsonArray ToJsonArray (longchar)
|
Parses a TOON string and returns the JsonArray at its root
Notes : Thin wrapper around ToJson for array rooted documents
@param plcToon The TOON string to parse
@return The parsed JsonArray
*/
|
|
|
|
Progress.Json.ObjectModel.JsonObject ToJsonObject (longchar)
|
Parses a TOON string and returns the JsonObject at its root
Notes : Thin wrapper around ToJson for object rooted documents
@param plcToon The TOON string to parse
@return The parsed JsonObject
*/
|
|
|
|
CHARACTER UnquoteString (character)
|
Removes surrounding quotes and unescapes a TOON quoted string
Notes : SCL-5973. The escape sequences are resolved in a single left to
right scan - chained replace calls would decode an escaped
backslash followed by an n as a newline. An unknown escape
sequence and a trailing backslash are kept as they are
@param pcValue The quoted string value
@return The unquoted and unescaped string
*/
|
|
|
|
WriteArray (JsonArray, character, integer, longchar)
|
Writes a JsonArray in TOON format
Notes : Determines the appropriate encoding: inline primitive,
tabular (uniform objects), or mixed list items
@param poArray The JsonArray to write
@param pcName The property name for the array
@param piDepth The current indentation depth
@param pcResult OUTPUT The accumulated TOON string
*/
|
|
|
|
WriteInlineArrayAsListItem (JsonArray, integer, longchar)
|
Writes an inline array as a list item
Notes :
@param poArray The JsonArray to write
@param piDepth The current list item depth
@param pcResult OUTPUT The accumulated TOON string
*/
|
|
|
|
WriteInlinePrimitiveArray (JsonArray, character, integer, longchar)
|
Writes a primitive array inline: key[N]: v1,v2,v3
Notes :
@param poArray The JsonArray to write
@param pcName The property name for the array
@param piDepth The current indentation depth
@param pcResult OUTPUT The accumulated TOON string
*/
|
|
|
|
WriteListItemObject (JsonObject, integer, longchar)
|
Writes a JsonObject as a list item (with - prefix for first field)
Notes :
@param poObj The JsonObject to write
@param piDepth The current list item depth
@param pcResult OUTPUT The accumulated TOON string
*/
|
|
|
|
WriteMixedArray (JsonArray, character, integer, longchar)
|
Writes a mixed array using list items
Notes :
@param poArray The JsonArray to write
@param pcName The property name for the array
@param piDepth The current indentation depth
@param pcResult OUTPUT The accumulated TOON string
*/
|
|
|
|
WriteObject (JsonObject, integer, longchar)
|
Writes a JsonObject's properties at the given indentation depth
Notes :
@param poJson The JsonObject to write
@param piDepth The current indentation depth
@param pcResult OUTPUT The accumulated TOON string
*/
|
|
|
|
WriteTabularArray (JsonArray, character, integer, longchar)
|
Writes a tabular array of uniform objects
Notes : Format: key[N]~{f1,f2,f3~}:
v1,v2,v3
v4,v5,v6
@param poArray The JsonArray of uniform objects
@param pcName The property name for the array
@param piDepth The current indentation depth
@param pcResult OUTPUT The accumulated TOON string
*/
|