C++ TargetRTS
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
RTAsciiEncoding Class Reference

The default encoding implementation that is used for all default type descriptors. More...

#include <RTAsciiEncoding.h>

Inheritance diagram for RTAsciiEncoding:
RTEncoding RTJsonEncoding RTVAsciiEncoding

Public Member Functions

 RTAsciiEncoding (RTOBuffer *buffer)
 Construct an ASCII encoder object.
 
int getError (void)
 
virtual int flush (void) override
 Flush the output buffer.
 
virtual int put (const void *data, const RTObject_class *type) override
 Encode a data object and write the encoding to the output buffer.
 
virtual int put_address (const void *) override
 
virtual int put_bool (bool) override
 
virtual int put_char (char) override
 
virtual int put_int (int) override
 
virtual int put_long (long) override
 
virtual int put_long_long (long long) override
 
virtual int put_short (short) override
 
virtual int put_uchar (unsigned char) override
 
virtual int put_unsigned (unsigned) override
 
virtual int put_ulong (unsigned long) override
 
virtual int put_ushort (unsigned short) override
 
virtual int put_unsignedint (unsigned int) override
 
virtual int put_unsignedlong (unsigned long) override
 
virtual int put_unsignedlonglong (unsigned long long) override
 
virtual int put_unsignedshort (unsigned short) override
 
virtual int put_unsignedchar (unsigned char) override
 
virtual int put_string (const char *) override
 
virtual int put_opaque (int, const char *) override
 
virtual int put_enum (int, int, const RTFieldDescriptor *) override
 
virtual int put_array (const void *, int, const RTObject_class *) override
 
virtual int put_indirect (const void *, const RTObject_class *) override
 
virtual int put_struct (const void *, const RTObject_class *) override
 
virtual int write_string (const char *str) override
 Write a string verbatimely to the output buffer of the encoder.
 
virtual int flush (void)=0
 
virtual int put (const void *, const RTObject_class *)=0
 
virtual int put_address (const void *)=0
 
virtual int put_bool (bool)=0
 
virtual int put_char (char)=0
 
virtual int put_int (int)=0
 
virtual int put_long (long)=0
 
virtual int put_long_long (long long)=0
 
virtual int put_short (short)=0
 
virtual int put_uchar (unsigned char)=0
 
virtual int put_unsigned (unsigned)=0
 
virtual int put_ulong (unsigned long)=0
 
virtual int put_ushort (unsigned short)=0
 
virtual int put_unsignedint (unsigned int)=0
 
virtual int put_unsignedlong (unsigned long)=0
 
virtual int put_unsignedlonglong (unsigned long long)=0
 
virtual int put_unsignedshort (unsigned short)=0
 
virtual int put_unsignedchar (unsigned char)=0
 
virtual int put_string (const char *)=0
 
virtual int put_opaque (int, const char *)=0
 
virtual int put_enum (int value, int numChoices, const RTFieldDescriptor *choices)=0
 
virtual int put_array (const void *array_base, int numElements, const RTObject_class *elementType)=0
 
virtual int put_indirect (const void *pointer, const RTObject_class *targetType)=0
 
virtual int put_struct (const void *record, const RTObject_class *recordType)=0
 
virtual int write_string (const char *)
 

Protected Types

enum  Spacing { SpaceNone , SpaceAround }
 

Protected Member Functions

virtual int putType (const RTObject_class *)
 
int putName (const char *)
 
virtual int putFields (const void *, const RTObject_class *, int &first)
 
int putAddress (const void *)
 
int putFieldListStart (void)
 
int putFieldSeparator (void)
 
int putFieldListFinish (void)
 
int putCode (const char *, int, Spacing)
 

Protected Attributes

RTOBufferoutput
 
Spacing before
 

Detailed Description

The default encoding implementation that is used for all default type descriptors.

Types are encoded as ASCII strings by printing the type name followed by the typed value. Examples: int 8 double 2.7 MyClass{a 8, b false}

Constructor & Destructor Documentation

◆ RTAsciiEncoding()

RTAsciiEncoding::RTAsciiEncoding ( RTOBuffer buffer)
explicit

Construct an ASCII encoder object.

Parameters
bufferThe output buffer to which the encoded string should be written.

Member Function Documentation

◆ flush()

virtual int RTAsciiEncoding::flush ( void  )
overridevirtual

Flush the output buffer.

Everything this encoder has written so far will appear in the output.

Implements RTEncoding.

◆ put()

virtual int RTAsciiEncoding::put ( const void *  data,
const RTObject_class type 
)
overridevirtual

Encode a data object and write the encoding to the output buffer.

Parameters
dataData object to encode.
typeType descriptor describing the type of the data object.
Returns
1 if successfully encoded and written to the output buffer, 0 otherwise

Implements RTEncoding.

Reimplemented in RTJsonEncoding.

◆ put_address()

virtual int RTAsciiEncoding::put_address ( const void *  )
overridevirtual

Implements RTEncoding.

◆ put_array()

virtual int RTAsciiEncoding::put_array ( const void *  ,
int  ,
const RTObject_class  
)
overridevirtual

Implements RTEncoding.

◆ put_bool()

virtual int RTAsciiEncoding::put_bool ( bool  )
overridevirtual

Implements RTEncoding.

◆ put_char()

virtual int RTAsciiEncoding::put_char ( char  )
overridevirtual

Implements RTEncoding.

◆ put_enum()

virtual int RTAsciiEncoding::put_enum ( int  ,
int  ,
const RTFieldDescriptor  
)
overridevirtual

Implements RTEncoding.

◆ put_indirect()

virtual int RTAsciiEncoding::put_indirect ( const void *  ,
const RTObject_class  
)
overridevirtual

Implements RTEncoding.

◆ put_int()

virtual int RTAsciiEncoding::put_int ( int  )
overridevirtual

Implements RTEncoding.

◆ put_long()

virtual int RTAsciiEncoding::put_long ( long  )
overridevirtual

Implements RTEncoding.

◆ put_long_long()

virtual int RTAsciiEncoding::put_long_long ( long long  )
overridevirtual

Implements RTEncoding.

◆ put_opaque()

virtual int RTAsciiEncoding::put_opaque ( int  ,
const char *   
)
overridevirtual

Implements RTEncoding.

◆ put_short()

virtual int RTAsciiEncoding::put_short ( short  )
overridevirtual

Implements RTEncoding.

◆ put_string()

virtual int RTAsciiEncoding::put_string ( const char *  )
overridevirtual

Implements RTEncoding.

◆ put_struct()

virtual int RTAsciiEncoding::put_struct ( const void *  ,
const RTObject_class  
)
overridevirtual

Implements RTEncoding.

◆ put_uchar()

virtual int RTAsciiEncoding::put_uchar ( unsigned char  )
overridevirtual

Implements RTEncoding.

◆ put_ulong()

virtual int RTAsciiEncoding::put_ulong ( unsigned long  )
overridevirtual

Implements RTEncoding.

◆ put_unsigned()

virtual int RTAsciiEncoding::put_unsigned ( unsigned  )
overridevirtual

Implements RTEncoding.

◆ put_unsignedchar()

virtual int RTAsciiEncoding::put_unsignedchar ( unsigned char  )
overridevirtual

Implements RTEncoding.

◆ put_unsignedint()

virtual int RTAsciiEncoding::put_unsignedint ( unsigned int  )
overridevirtual

Implements RTEncoding.

◆ put_unsignedlong()

virtual int RTAsciiEncoding::put_unsignedlong ( unsigned long  )
overridevirtual

Implements RTEncoding.

◆ put_unsignedlonglong()

virtual int RTAsciiEncoding::put_unsignedlonglong ( unsigned long long  )
overridevirtual

Implements RTEncoding.

◆ put_unsignedshort()

virtual int RTAsciiEncoding::put_unsignedshort ( unsigned short  )
overridevirtual

Implements RTEncoding.

◆ put_ushort()

virtual int RTAsciiEncoding::put_ushort ( unsigned short  )
overridevirtual

Implements RTEncoding.

◆ write_string()

virtual int RTAsciiEncoding::write_string ( const char *  str)
overridevirtual

Write a string verbatimely to the output buffer of the encoder.

Parameters
strString to write to the output buffer. It must not contain any unprintable characters.
Returns
1 if successful, 0 otherwise

Reimplemented from RTEncoding.


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