MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / SafeArg

Class SafeArg

src/common/classes/SafeArg.h:142–177  ·  view source on GitHub ↗

This is the main class that does the magic of receiving a chain of type-safe parameters. All parameters should be appended to it using the << operator. Only basic data types are supported. The allowed types are char, UCHAR, all lengths of signed/unsigned integral values, the SINT128 fake type (a struct, really), double, strings, UCHAR strings and the (non-const) void pointer. Care should be taken

Source from the content-addressed store, hash-verified

140// contains rather simple format strings.
141// Usage examples appear in the MsgPrint.h file.
142class SafeArg
143{
144public:
145 SafeArg();
146 SafeArg(const int val[], FB_SIZE_T v_size);
147 SafeArg& clear();
148 SafeArg& operator<<(char c);
149 SafeArg& operator<<(unsigned char c);
150 //SafeArg& operator<<(int16_t c);
151 SafeArg& operator<<(short c);
152 SafeArg& operator<<(unsigned short c);
153 //SafeArg& operator<<(int32_t c);
154 SafeArg& operator<<(int c);
155 SafeArg& operator<<(unsigned int c);
156 SafeArg& operator<<(long int c);
157 SafeArg& operator<<(unsigned long int c);
158 SafeArg& operator<<(SINT64 c);
159 SafeArg& operator<<(FB_UINT64 c);
160 //SafeArg& operator<<(long c);
161 SafeArg& operator<<(SINT128 c);
162 SafeArg& operator<<(double c);
163 SafeArg& operator<<(const char* c);
164 SafeArg& operator<<(const unsigned char* c);
165 SafeArg& operator<<(void* c);
166 void dump(const TEXT* target[], FB_SIZE_T v_size) const;
167 const safe_cell& getCell(FB_SIZE_T index) const;
168 FB_SIZE_T getCount() const throw();
169
170private:
171 FB_SIZE_T m_count;
172 safe_cell m_arguments[SAFEARG_MAX_ARG];
173 const void* m_extras; // Formatting, etc.
174
175 friend int MsgPrint(BaseStream& out_stream, const char* format, const SafeArg& arg,
176 bool userFormatting);
177};
178
179inline SafeArg::SafeArg()
180 : m_count(0), m_extras(0)

Callers 1

MsgPrintFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected