Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLJsonWriter Class Reference

Writes properties into a JSON stream. More...

#include <Libs/MRML/Core/vtkMRMLJsonElement.h>

Inheritance diagram for vtkMRMLJsonWriter:
Collaboration diagram for vtkMRMLJsonWriter:

Public Types

typedef vtkObject Superclass
 

Public Member Functions

std::string ConvertXMLToJson (vtkXMLDataElement *xmlElement, const std::string &nodeTagName)
 
virtual const char * GetClassName ()
 
virtual vtkMRMLMessageCollection * GetUserMessages ()
 Returns user-displayable messages that may contain details about any failed operation.
 
bool HasErrors ()
 Returns true if user messages contain error messages.
 
virtual int IsA (const char *type)
 
bool isBool (const std::string &str)
 Utility functions to check string type.
 
bool isDouble (const std::string &str)
 
bool isInt (const std::string &str)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
std::string toLower (const std::string &str)
 Utility function to convert string to lower case.
 
void WriteArrayPropertyEnd ()
 This method must be called when all array items are written.
 
void WriteArrayPropertyStart (const std::string &propertyName)
 This method creates a new array as a property.
 
void WriteNullProperty (const std::string &propertyName)
 Write null as a property value.
 
void WriteObjectEnd ()
 This method must be called when all properties of the object are written.
 
void WriteObjectPropertyEnd ()
 This method must be called when all properties of the object are written.
 
void WriteObjectPropertyStart (const std::string &propertyName)
 This method creates a new object as a property.
 
void WriteObjectStart ()
 This method creates a new object in an array.
 
bool WriteToFileBegin (const char *filePath, const char *schema)
 
bool WriteToFileEnd ()
 
bool WriteToStringBegin ()
 
bool WriteToStringBegin (const char *nodeTagName)
 
std::string WriteToStringEnd ()
 
void WriteVariantProperty (const std::string &propertyName, const vtkVariant &propertyValue)
 
void WriteStringProperty (const std::string &propertyName, const std::string &propertyValue)
 
void WriteStringVectorProperty (const std::string &propertyName, const std::vector< std::string > &arrayValues)
 
void WriteCodedEntryProperty (const std::string &propertyName, vtkCodedEntry *codedEntry)
 
void WriteStringPropertyIfNotEmpty (const std::string &propertyName, const std::string &propertyValue)
 
void WriteBoolProperty (const std::string &propertyName, bool propertyValue)
 
void WriteIntProperty (const std::string &propertyName, int propertyValue)
 
void WriteDoubleProperty (const std::string &propertyName, double propertyValue)
 
void WriteVectorProperty (const std::string &propertyName, double *v, int numberOfComponents=3)
 
void WriteMatrix4x4Property (const std::string &propertyName, double v[16], bool flipRasLps)
 
void WriteDoubleArrayProperty (const char *propertyName, vtkDoubleArray *doubleArray)
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkMRMLJsonWriter * New ()
 
static vtkMRMLJsonWriter * SafeDownCast (vtkObject *o)
 

Protected Member Functions

void operator= (const vtkMRMLJsonWriter &)
 
void processXMLElement (vtkXMLDataElement *xmlElement)
 
 vtkMRMLJsonWriter ()
 
 vtkMRMLJsonWriter (const vtkMRMLJsonWriter &)
 
 ~vtkMRMLJsonWriter () override
 

Protected Attributes

vtkInternal * Internal
 
vtkNew< vtkMRMLMessageCollection > UserMessages
 

Friends

class vtkInternal
 

Detailed Description

Writes properties into a JSON stream.

Definition at line 232 of file vtkMRMLJsonElement.h.

Member Typedef Documentation

◆ Superclass

typedef vtkObject vtkMRMLJsonWriter::Superclass

Definition at line 236 of file vtkMRMLJsonElement.h.

Constructor & Destructor Documentation

◆ vtkMRMLJsonWriter() [1/2]

vtkMRMLJsonWriter::vtkMRMLJsonWriter ( )
protected

◆ ~vtkMRMLJsonWriter()

vtkMRMLJsonWriter::~vtkMRMLJsonWriter ( )
overrideprotected

◆ vtkMRMLJsonWriter() [2/2]

vtkMRMLJsonWriter::vtkMRMLJsonWriter ( const vtkMRMLJsonWriter & )
protected

Member Function Documentation

◆ ConvertXMLToJson()

std::string vtkMRMLJsonWriter::ConvertXMLToJson ( vtkXMLDataElement * xmlElement,
const std::string & nodeTagName )

Convert XML to JSON return string

◆ GetClassName()

virtual const char * vtkMRMLJsonWriter::GetClassName ( )
virtual

Reimplemented in vtkMRMLMarkupsJsonWriter.

◆ GetUserMessages()

virtual vtkMRMLMessageCollection * vtkMRMLJsonWriter::GetUserMessages ( )
virtual

Returns user-displayable messages that may contain details about any failed operation.

◆ HasErrors()

bool vtkMRMLJsonWriter::HasErrors ( )

Returns true if user messages contain error messages.

◆ IsA()

virtual int vtkMRMLJsonWriter::IsA ( const char * type)
virtual

Reimplemented in vtkMRMLMarkupsJsonWriter.

◆ isBool()

bool vtkMRMLJsonWriter::isBool ( const std::string & str)

Utility functions to check string type.

◆ isDouble()

bool vtkMRMLJsonWriter::isDouble ( const std::string & str)

◆ isInt()

bool vtkMRMLJsonWriter::isInt ( const std::string & str)

◆ IsTypeOf()

static int vtkMRMLJsonWriter::IsTypeOf ( const char * type)
static

◆ New()

static vtkMRMLJsonWriter * vtkMRMLJsonWriter::New ( )
static

◆ operator=()

void vtkMRMLJsonWriter::operator= ( const vtkMRMLJsonWriter & )
protected

◆ PrintSelf()

void vtkMRMLJsonWriter::PrintSelf ( ostream & os,
vtkIndent indent )
override

◆ processXMLElement()

void vtkMRMLJsonWriter::processXMLElement ( vtkXMLDataElement * xmlElement)
protected

◆ SafeDownCast()

static vtkMRMLJsonWriter * vtkMRMLJsonWriter::SafeDownCast ( vtkObject * o)
static

◆ toLower()

std::string vtkMRMLJsonWriter::toLower ( const std::string & str)

Utility function to convert string to lower case.

◆ WriteArrayPropertyEnd()

void vtkMRMLJsonWriter::WriteArrayPropertyEnd ( )

This method must be called when all array items are written.

◆ WriteArrayPropertyStart()

void vtkMRMLJsonWriter::WriteArrayPropertyStart ( const std::string & propertyName)

This method creates a new array as a property.

◆ WriteBoolProperty()

void vtkMRMLJsonWriter::WriteBoolProperty ( const std::string & propertyName,
bool propertyValue )

◆ WriteCodedEntryProperty()

void vtkMRMLJsonWriter::WriteCodedEntryProperty ( const std::string & propertyName,
vtkCodedEntry * codedEntry )

◆ WriteDoubleArrayProperty()

void vtkMRMLJsonWriter::WriteDoubleArrayProperty ( const char * propertyName,
vtkDoubleArray * doubleArray )

◆ WriteDoubleProperty()

void vtkMRMLJsonWriter::WriteDoubleProperty ( const std::string & propertyName,
double propertyValue )

◆ WriteIntProperty()

void vtkMRMLJsonWriter::WriteIntProperty ( const std::string & propertyName,
int propertyValue )

◆ WriteMatrix4x4Property()

void vtkMRMLJsonWriter::WriteMatrix4x4Property ( const std::string & propertyName,
double v[16],
bool flipRasLps )

◆ WriteNullProperty()

void vtkMRMLJsonWriter::WriteNullProperty ( const std::string & propertyName)

Write null as a property value.

◆ WriteObjectEnd()

void vtkMRMLJsonWriter::WriteObjectEnd ( )

This method must be called when all properties of the object are written.

◆ WriteObjectPropertyEnd()

void vtkMRMLJsonWriter::WriteObjectPropertyEnd ( )

This method must be called when all properties of the object are written.

◆ WriteObjectPropertyStart()

void vtkMRMLJsonWriter::WriteObjectPropertyStart ( const std::string & propertyName)

This method creates a new object as a property.

◆ WriteObjectStart()

void vtkMRMLJsonWriter::WriteObjectStart ( )

This method creates a new object in an array.

◆ WriteStringProperty()

void vtkMRMLJsonWriter::WriteStringProperty ( const std::string & propertyName,
const std::string & propertyValue )

Write simple value as an object property.

◆ WriteStringPropertyIfNotEmpty()

void vtkMRMLJsonWriter::WriteStringPropertyIfNotEmpty ( const std::string & propertyName,
const std::string & propertyValue )

◆ WriteStringVectorProperty()

void vtkMRMLJsonWriter::WriteStringVectorProperty ( const std::string & propertyName,
const std::vector< std::string > & arrayValues )

◆ WriteToFileBegin()

bool vtkMRMLJsonWriter::WriteToFileBegin ( const char * filePath,
const char * schema )

This method must be called before writing any properties to the output file. Returns true on success.

◆ WriteToFileEnd()

bool vtkMRMLJsonWriter::WriteToFileEnd ( )

This method must be called after writing all properties to the output file. Returns true on success.

◆ WriteToStringBegin() [1/2]

bool vtkMRMLJsonWriter::WriteToStringBegin ( )

Start writing a JSON document into a string. The top-level element is an object and properties are written directly into it (no wrapper object). This method must be called before writing any properties. Returns true on success.

◆ WriteToStringBegin() [2/2]

bool vtkMRMLJsonWriter::WriteToStringBegin ( const char * nodeTagName)

Start writing a JSON document into a string. Properties are written into an object that is wrapped in the top-level object: {"<nodeTagName>": {...}}. This method must be called before writing any properties. Returns true on success.

◆ WriteToStringEnd()

std::string vtkMRMLJsonWriter::WriteToStringEnd ( )

This method must be called after writing all properties into the string. Returns string representation of the JSON document.

◆ WriteVariantProperty()

void vtkMRMLJsonWriter::WriteVariantProperty ( const std::string & propertyName,
const vtkVariant & propertyValue )

Write a vtkVariant value as a property: string, integer (64-bit), or floating-point number. Invalid variants and non-finite numbers (NaN, infinity) are written as null.

◆ WriteVectorProperty()

void vtkMRMLJsonWriter::WriteVectorProperty ( const std::string & propertyName,
double * v,
int numberOfComponents = 3 )

Friends And Related Symbol Documentation

◆ vtkInternal

friend class vtkInternal
friend

Definition at line 328 of file vtkMRMLJsonElement.h.

Member Data Documentation

◆ Internal

vtkInternal* vtkMRMLJsonWriter::Internal
protected

Definition at line 327 of file vtkMRMLJsonElement.h.

◆ UserMessages

vtkNew<vtkMRMLMessageCollection> vtkMRMLJsonWriter::UserMessages
protected

Definition at line 324 of file vtkMRMLJsonElement.h.


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