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 virtual int put_longdouble( long double ) override;
68#endif
69 virtual int put_int ( int ) override;
70 virtual int put_long ( long ) override;
71 virtual int put_long_long( long long ) override;
72 virtual int put_short ( short ) override;
73 virtual int put_uchar ( unsigned char ) override;
74 virtual int put_unsigned( unsigned ) override;
75 virtual int put_ulong ( unsigned long ) override;
76 virtual int put_ushort ( unsigned short ) override;
77
78 virtual int put_unsignedint( unsigned int) override;
79 virtual int put_unsignedlong( unsigned long) override;
80 virtual int put_unsignedlonglong( unsigned long long) override;
81 virtual int put_unsignedshort( unsigned short) override;
82 virtual int put_unsignedchar( unsigned char) override;
83 virtual int put_string( const char * ) override;
84
85 virtual int put_opaque( int, const char * ) override;
86
87 virtual int put_enum( int, int, const RTFieldDescriptor * ) override;
88
89 virtual int put_array( const void *, int, const RTObject_class * ) override;
90
91 virtual int put_indirect( const void *, const RTObject_class * ) override;
92
93 virtual int put_struct( const void *, const RTObject_class * ) override;
94
100 virtual int write_string( const char* str) override;
101
102protected:
103 enum Spacing { SpaceNone, SpaceAround };
104
105 RTOBuffer * output;
106 Spacing before;
107
108 virtual int putType( const RTObject_class * );
109 int putName( const char * );
110
111 virtual int putFields( const void *, const RTObject_class *, int & first );
112 int putAddress ( const void * );
113 int putFieldListStart( void );
114 int putFieldSeparator( void );
115 int putFieldListFinish( void );
116
117 int putCode( const char *, int, Spacing );
118
119private:
120 // unavailable methods
122 RTAsciiEncoding & operator=( const RTAsciiEncoding & );
123}; //lint !e1712
124
125#endif // OBJECT_ENCODE
126
127#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