ParserInterface Class Reference

#include <parser.h>

Inheritance diagram for ParserInterface:

Public Types

using RESTRICT_DICTIONARY_PROPS = PARSERPARAMETERS::RESTRICT
 

Public Member Functions

MAXON_METHOD Result< void > Read (UrlOrInputStream &&nameOrStream, PARSERFLAGS flags, const StringDecodingRef &stringDecoding, const ValueReceiver< const DataDictionary & > &objects, BaseArray< Char > *originalToken=nullptr)
 
MAXON_FUNCTION Result< void > ReadString (const Block< const Char > &parserData, PARSERFLAGS flags, const StringDecodingRef &stringDecoding, const ValueReceiver< const DataDictionary & > &objects)
 
MAXON_FUNCTION Result< void > ReadString (const String &text, PARSERFLAGS flags, const StringDecodingRef &stringDecoding, const ValueReceiver< const DataDictionary & > &objects)
 
MAXON_METHOD Result< void > Write (const DataDictionary &object, String &string, Bool niceFormatting)
 
MAXON_METHOD Result< void > WriteFile (UrlOrOutputStream &&out, const StringEncodingRef &stringEncoding, const DataDictionary &dict, Bool niceFormatting)
 
MAXON_METHOD String GetFileExtension () const
 

Private Member Functions

 MAXON_INTERFACE (ParserInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.parser")
 

Member Typedef Documentation

◆ RESTRICT_DICTIONARY_PROPS

using RESTRICT_DICTIONARY_PROPS = PARSERPARAMETERS::RESTRICT

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( ParserInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.parser"   
)
private

◆ Read()

MAXON_METHOD Result<void> Read ( UrlOrInputStream &&  nameOrStream,
PARSERFLAGS  flags,
const StringDecodingRef &  stringDecoding,
const ValueReceiver< const DataDictionary & > &  objects,
BaseArray< Char > *  originalToken = nullptr 
)

ConvertFromJWT converts a JWT token into a json DataDictionary. For more details of JWT see https://jwt.io/

Parameters
[in]nameOrStreamJSON formated input stream or file url.
[in]flagsSee JWTPARSERFLAGS.
[in]objectsValueReceiver which receives all processed DataDictionaries.
[out]originalToken[Optional] Returns the original token memory read from the stream.
Returns
OK on success. If successful it's guaranteed that at least one DataDictionary was found.

◆ ReadString() [1/2]

MAXON_FUNCTION Result<void> ReadString ( const Block< const Char > &  parserData,
PARSERFLAGS  flags,
const StringDecodingRef &  stringDecoding,
const ValueReceiver< const DataDictionary & > &  objects 
)

ConvertFromJSON parses a json string into DataDictionary representation.

Parameters
[in]parserDataJSON formated string to precess.
[in]flagsSee JSONPARSERFLAGS.
[in]stringDecodingValueReceiver which receives all processed DataDictionaries.
[in]objectsValueReceiver which receives all processed DataDictionaries.
Returns
OK on success. If successful it's guaranteed that at least one DataDictionary was found.

◆ ReadString() [2/2]

MAXON_FUNCTION Result<void> ReadString ( const String text,
PARSERFLAGS  flags,
const StringDecodingRef &  stringDecoding,
const ValueReceiver< const DataDictionary & > &  objects 
)

◆ Write()

MAXON_METHOD Result<void> Write ( const DataDictionary &  object,
String string,
Bool  niceFormatting 
)

ConvertToJSON converts a data dictionary into a JSON string.

Parameters
[in]objectDataDictionary to convert.
[out]stringResult string.
[in]niceFormattingTrue to have nice formatting with indents and new lines. False to get compact format (smaller filesize).
Returns
OK on success.

◆ WriteFile()

MAXON_METHOD Result<void> WriteFile ( UrlOrOutputStream &&  out,
const StringEncodingRef &  stringEncoding,
const DataDictionary &  dict,
Bool  niceFormatting 
)

WriteFile writes a object into a file or url.

Parameters
[in]outUrl or stream to write.
[in]stringEncodingString encoding to use.
[in]dictData to write.
[in]niceFormattingTrue to have nice formatting with indents and new lines. False to get compact format (smaller filesize).
Returns
OK on success.

◆ GetFileExtension()

MAXON_METHOD String GetFileExtension ( ) const

GetFileExtension gives the file extension of the parser.

Returns
the file extension as a string.