|
DCMTK
Version 3.7.0
OFFIS DICOM Toolkit
|
Class for handling JSON format options. More...
Inheritance diagram for DcmJsonFormat:Classes | |
| class | Indention |
| A class to create small proxy objects that ease indention handling. More... | |
Public Types | |
| enum | NumStringPolicy { NSP_auto , NSP_always_number , NSP_always_string } |
| an enumeration defining how to convert IS/DS elements to JSON More... | |
Public Member Functions | |
| DcmJsonFormat (const OFBool printMetaInfo) | |
| Constructor. More... | |
| virtual | ~DcmJsonFormat () |
| Virtual destructor, does nothing. | |
| virtual OFString | newline ()=0 |
| Method to return line break(s) More... | |
| virtual OFString | space ()=0 |
| Method to return whitespace(s) More... | |
| Indention | indent () |
| Method to return an indention proxy object for increasing, decreasing or printing indention. More... | |
| virtual OFBool | asBulkDataURI (const DcmTagKey &tag, Uint32 len) const |
| Check if an attribute should be exported as BulkDataURI. More... | |
| virtual void | getBulkDataDirectory (OFString &directory) const |
| return path of bulk data directory More... | |
| virtual void | getBulkDataURIPrefix (OFString &prefix) const |
| return the current bulk data URI prefix More... | |
| virtual void | printValuePrefix (STD_NAMESPACE ostream &out) |
| Print the Prefix which for JSON Values needed with indention and newlines as in the format Variable given. More... | |
| virtual void | printValueSuffix (STD_NAMESPACE ostream &out) |
| Print the Suffix which for JSON Values needed with indention and newlines as in the format Variable given. More... | |
| virtual void | printBulkDataURIPrefix (STD_NAMESPACE ostream &out) |
| Print the Prefix which for JSON BulkDataURI needed with indention and newlines as in the format Variable given. More... | |
| virtual void | printInlineBinaryPrefix (STD_NAMESPACE ostream &out) |
| Print the Prefix which for JSON InlineBinary needed with indention and newlines as the format specifies. More... | |
| virtual void | printNextArrayElementPrefix (STD_NAMESPACE ostream &out) |
| Print the prefix for array elements (except the first one), with indention and newlines as the format specifies. More... | |
| virtual OFBool | getJsonExtensionEnabled () const |
| return the flag indicating whether extended JSON number encoding is enabled. | |
| virtual void | setJsonExtensionEnabled (OFBool enabled) |
| set the flag indicating whether extended JSON number encoding is enabled. More... | |
| virtual NumStringPolicy | getJsonNumStringPolicy () const |
| return the flag defining how IS/DS elements should be converted to JSON. | |
| virtual void | setJsonNumStringPolicy (NumStringPolicy policy) |
| set the flag defining how IS/DS elements should be converted to JSON. More... | |
| virtual void | setMinBulkSize (ssize_t min_bulk_size) |
| set the minimum size of binary attributes stored as bulk data. More... | |
| virtual void | setBulkURIPrefix (const char *bulk_uri_prefix) |
| set the prefix for URIs generated for bulk data More... | |
| virtual void | setBulkDir (const char *bulk_dir) |
| set the directory to which bulk data files should be written More... | |
| virtual OFCondition | writeBulkData (STD_NAMESPACE ostream &out, const DcmTagKey &tagkey, Uint32 len, Uint8 *byteValues, const char *extension=".bin") |
| write an attribute as BulkDataURI. More... | |
| virtual OFCondition | writeBinaryAttribute (STD_NAMESPACE ostream &out, const DcmTagKey &tagkey, Uint32 len, Uint8 *byteValues, const char *extension=".bin") |
| write a binary attribute either as InlineBinary or as BulkDataURI. More... | |
Static Public Member Functions | |
| static void | escapeControlCharacters (STD_NAMESPACE ostream &out, OFString const &value) |
| Escapes all forbidden control characters in JSON. More... | |
| static void | normalizeDecimalString (OFString &value) |
| Normalize Decimal String to specific JSON format. More... | |
| static void | normalizeIntegerString (OFString &value) |
| Normalize Integer String to specific JSON format. More... | |
| static void | printString (STD_NAMESPACE ostream &out, const OFString &value) |
| Prints either null if empty or the string value (with all illegal characters escaped). More... | |
| static void | printValueString (STD_NAMESPACE ostream &out, const OFString &value) |
| Prints either null if empty or a quoted string (with leading and ending quotation marks and all illegal characters escaped). More... | |
| static void | printNumberInteger (STD_NAMESPACE ostream &out, OFString &value) |
| Print either null if empty or a Number as normalized IntegerString. More... | |
| static void | printNumberDecimal (STD_NAMESPACE ostream &out, OFString &value) |
| Print either null if empty or a Number as normalized IntegerDecimal. More... | |
Public Attributes | |
| const OFBool | printMetaheaderInformation |
| Option that defines if metaheader information should be printed. | |
Protected Member Functions | |
| virtual void | printIndention (STD_NAMESPACE ostream &out)=0 |
| Indent to the specific level. More... | |
| virtual void | increaseIndention ()=0 |
| Used for increasing the indention level. | |
| virtual void | decreaseIndention ()=0 |
| Used for decreasing the indention level. | |
Private Attributes | |
| OFBool | enableJsonExtension |
| Option that defines if the inofficial JSON extension should be permitted under which decimal numbers may have the values "-inf", "inf" or "nan". More... | |
| NumStringPolicy | numStringPolicy |
| Option that defines how IS/DS elements will be converted to JSON, as number or string. More... | |
| ssize_t | minBulkDataSize |
| minimum size of binary attributes to be written as bulk data, in kBytes. More... | |
| OFString | bulkDataURIPrefix |
| prefix for bulk data URIs to be generated. More... | |
| OFString | bulkDataDirectory |
| directory to which files for bulk data will be written. More... | |
Class for handling JSON format options.
Base class to implement custom formatting. Purpose:
an enumeration defining how to convert IS/DS elements to JSON
|
inline |
Constructor.
| printMetaInfo | parameter that defines if meta information should be written |
|
virtual |
Check if an attribute should be exported as BulkDataURI.
Override this function to implement bulk data URI output.
| tag | the tag of the attribute being printed, for letting the implementation decide how to handle it. |
| len | the length of the attribute value, in bytes |
|
static |
Escapes all forbidden control characters in JSON.
| out | output stream to which the escaped String is written |
| value | String that should be escaped |
|
virtual |
return path of bulk data directory
| directory | path returned in this parameter |
|
virtual |
return the current bulk data URI prefix
|
inline |
Method to return an indention proxy object for increasing, decreasing or printing indention.
|
pure virtual |
Method to return line break(s)
Implemented in DcmJsonFormatCompact, and DcmJsonFormatPretty.
|
static |
Normalize Decimal String to specific JSON format.
remove leading zeros, except before dot. Example:
| value | String that should be normalize |
|
static |
Normalize Integer String to specific JSON format.
remove leading zeros, except before dot. Example:
| value | String that should be normalize |
|
virtual |
Print the Prefix which for JSON BulkDataURI needed with indention and newlines as in the format Variable given.
Example:
| out | output stream to which the Value prefix is written |
|
protectedpure virtual |
Indent to the specific level.
| out | output stream to which the indention is written. |
Implemented in DcmJsonFormatCompact, and DcmJsonFormatPretty.
|
virtual |
Print the Prefix which for JSON InlineBinary needed with indention and newlines as the format specifies.
Example:
| out | output stream to which the Value prefix is written |
|
virtual |
Print the prefix for array elements (except the first one), with indention and newlines as the format specifies.
Example:
| out | output stream to which the Value prefix is written |
|
static |
Print either null if empty or a Number as normalized IntegerDecimal.
| out | output stream to which the Value prefix is written |
| value | String that should be printed |
|
static |
Print either null if empty or a Number as normalized IntegerString.
| out | output stream to which the Value prefix is written |
| value | String that should be printed |
|
static |
Prints either null if empty or the string value (with all illegal characters escaped).
| out | output stream to which the Value prefix is written |
| value | String that should be printed |
|
virtual |
Print the Prefix which for JSON Values needed with indention and newlines as in the format Variable given.
Example:
| out | output stream to which the Value prefix is written |
|
static |
Prints either null if empty or a quoted string (with leading and ending quotation marks and all illegal characters escaped).
| out | output stream to which the Value prefix is written |
| value | String that should be printed |
|
virtual |
Print the Suffix which for JSON Values needed with indention and newlines as in the format Variable given.
Example:
| out | output stream to which the Value prefix is written |
|
virtual |
set the directory to which bulk data files should be written
| bulk_dir | directory for bulk data files, must exist and be writable |
|
virtual |
set the prefix for URIs generated for bulk data
| bulk_uri_prefix | URI prefix string |
|
inlinevirtual |
set the flag indicating whether extended JSON number encoding is enabled.
| enabled | new value of the flag |
References enableJsonExtension.
|
inlinevirtual |
set the flag defining how IS/DS elements should be converted to JSON.
| policy | new value of the flag |
References numStringPolicy.
|
virtual |
set the minimum size of binary attributes stored as bulk data.
| min_bulk_size | minimum bulk data size in kBytes, negative number for no bulk data |
|
pure virtual |
Method to return whitespace(s)
Implemented in DcmJsonFormatCompact, and DcmJsonFormatPretty.
|
virtual |
write a binary attribute either as InlineBinary or as BulkDataURI.
| out | output stream |
| tagkey | tag key of the attribute |
| len | length of the attribute value |
| byteValues | pointer to the raw attribute value in little endian byte order |
| extension | file name extension |
|
virtual |
write an attribute as BulkDataURI.
| out | output stream |
| tagkey | tag key of the attribute |
| len | length of the attribute value |
| byteValues | pointer to the raw attribute value in little endian byte order |
| extension | file name extension |
|
private |
directory to which files for bulk data will be written.
Must exist and be writable.
|
private |
prefix for bulk data URIs to be generated.
The filename will be appended to this prefix.
|
private |
Option that defines if the inofficial JSON extension should be permitted under which decimal numbers may have the values "-inf", "inf" or "nan".
Default is OFFalse, in which case such values will lead to an error code being returned instead.
Referenced by getJsonExtensionEnabled(), and setJsonExtensionEnabled().
|
private |
minimum size of binary attributes to be written as bulk data, in kBytes.
A negative value means that no bulk data is written.
|
private |
Option that defines how IS/DS elements will be converted to JSON, as number or string.
Default is NSP_auto.
Referenced by getJsonNumStringPolicy(), and setJsonNumStringPolicy().