C++ TargetRTS
Loading...
Searching...
No Matches
RTAsciiEncoding.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTAsciiEncoding_h__
11#define __RTAsciiEncoding_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTEncoding_h__
18#include <RTEncoding.h>
19#endif
20
21#if OBJECT_ENCODE
22
23class RTOBuffer;
24
25#if OBJECT_DECODE && ! defined( __RTAsciiDecoding_h__ )
26#include <RTAsciiDecoding.h>
27#endif
28
34{
35public:
39 explicit RTAsciiEncoding( RTOBuffer * buffer);
40 virtual ~RTAsciiEncoding( void );
41
42 // All the get/put functions return an int which is non-zero
43 // if the operation was successful. Otherwise, the following
44 // function may be called to discover the reason for the
45 // failure.
46 int getError( void );
47
51 virtual int flush( void ) override;
52
58 virtual int put( const void * data, const RTObject_class * type) override;
59
60 // Functions which deal with the basic data types.
61 virtual int put_address ( const void * ) override;
62 virtual int put_bool ( bool ) override;
63 virtual int put_char ( char ) override;
64#if RTUseFloatingPoint
65 virtual int put_double ( double ) override;
66 virtual int put_float ( float ) override;
67#endif
68 virtual int put_int ( int ) override;
69 virtual int put_long ( long ) override;
70 virtual int put_long_long( long long ) override;
71 virtual int put_short ( short ) override;
72 virtual int put_uchar ( unsigned char ) override;
73 virtual int put_unsigned( unsigned ) override;
74 virtual int put_ulong ( unsigned long ) override;
75 virtual int put_ushort ( unsigned short ) override;
76
77 virtual int put_unsignedint( unsigned int) override;
78 virtual int put_unsignedlong( unsigned long) override;
79 virtual int put_unsignedlonglong( unsigned long long) override;
80 virtual int put_unsignedshort( unsigned short) override;
81 virtual int put_unsignedchar( unsigned char) override;
82 virtual int put_string( const char * ) override;
83
84 virtual int put_opaque( int, const char * ) override;
85
86 virtual int put_enum( int, int, const RTFieldDescriptor * ) override;
87
88 virtual int put_array( const void *, int, const RTObject_class * ) override;
89
90 virtual int put_indirect( const void *, const RTObject_class * ) override;
91
92 virtual int put_struct( const void *, const RTObject_class * ) override;
93
99 virtual int write_string( const char* str) override;
100
101protected:
102 enum Spacing { SpaceNone, SpaceAround };
103
104 RTOBuffer * output;
105 Spacing before;
106
107 virtual int putType( const RTObject_class * );
108 int putName( const char * );
109
110 virtual int putFields( const void *, const RTObject_class *, int & first );
111 int putAddress ( const void * );
112 int putFieldListStart( void );
113 int putFieldSeparator( void );
114 int putFieldListFinish( void );
115
116 int putCode( const char *, int, Spacing );
117
118private:
119 // unavailable methods
121 RTAsciiEncoding & operator=( const RTAsciiEncoding & );
122}; //lint !e1712
123
124#endif // OBJECT_ENCODE
125
126#endif // __RTAsciiEncoding_h__
The default encoding implementation that is used for all default type descriptors.
Definition: RTAsciiEncoding.h:34
virtual int flush(void) override
Flush the output buffer.
RTAsciiEncoding(RTOBuffer *buffer)
Construct an ASCII encoder object.
virtual int write_string(const char *str) override
Write a string verbatimely to the output buffer of the encoder.
virtual int put(const void *data, const RTObject_class *type) override
Encode a data object and write the encoding to the output buffer.
Definition: RTEncoding.h:27
Represents an output buffer.
Definition: RTOBuffer.h:23
Definition: RTFieldDescriptor.h:40
A type descriptor providing information about a type.
Definition: RTObject_class.h:64