| | 42 | |
|---|
| | 43 | const char *stream_type_format_parameter(bool); |
|---|
| | 44 | const char *stream_type_format_parameter(int); |
|---|
| | 45 | const char *stream_type_format_parameter(uint32_t); |
|---|
| | 46 | const char *stream_type_format_parameter(uint64_t); |
|---|
| | 47 | const char *stream_type_format_parameter(const char *); |
|---|
| | 48 | const char *stream_type_format_parameter(const void *); |
|---|
| | 49 | void stream_push_formated_type(base_stream &, bool val); |
|---|
| | 50 | void stream_push_formated_type(base_stream &, int val); |
|---|
| | 51 | void stream_push_formated_type(base_stream &, uint32_t val); |
|---|
| | 52 | void stream_push_formated_type(base_stream &, uint64_t val); |
|---|
| | 53 | void stream_push_formated_type(base_stream &, const char *val); |
|---|
| | 54 | void stream_push_formated_type(base_stream &, const void *val); |
|---|
| 223 | | static inline const char *stream_type_format_parameter(bool) { |
|---|
| 224 | | return "b"; |
|---|
| 225 | | } |
|---|
| 226 | | |
|---|
| 227 | | static inline const char *stream_type_format_parameter(int) { |
|---|
| 228 | | return "i"; |
|---|
| 229 | | } |
|---|
| 230 | | |
|---|
| 231 | | static inline const char *stream_type_format_parameter(uint32_t) { |
|---|
| 232 | | return "u"; |
|---|
| 233 | | } |
|---|
| 234 | | |
|---|
| 235 | | static inline const char *stream_type_format_parameter(uint64_t) { |
|---|
| 236 | | return "llu"; |
|---|
| 237 | | } |
|---|
| 238 | | |
|---|
| 239 | | static inline const char *stream_type_format_parameter(const char *) { |
|---|
| 240 | | return "s"; |
|---|
| 241 | | } |
|---|
| 242 | | |
|---|
| 243 | | static inline const char *stream_type_format_parameter(const void *) { |
|---|
| 244 | | return "p"; |
|---|
| 245 | | } |
|---|
| 246 | | |
|---|
| 247 | | static inline void stream_push_formated_type(base_stream &os, bool val) { |
|---|
| 248 | | os.append_chunk(val ? "true" : "false"); |
|---|
| 249 | | } |
|---|
| 250 | | |
|---|
| 251 | | static inline void stream_push_formated_type(base_stream &os, int val) { |
|---|
| 252 | | char *p = os.req_buffer(32); |
|---|
| 253 | | snprintf(p, 32, "%i", val); |
|---|
| 254 | | os.commit_change(strlen(p)); |
|---|
| 255 | | } |
|---|
| 256 | | |
|---|
| 257 | | static inline void stream_push_formated_type(base_stream &os, uint32_t val) { |
|---|
| 258 | | char *p = os.req_buffer(32); |
|---|
| 259 | | snprintf(p, 32, "%u", val); |
|---|
| 260 | | os.commit_change(strlen(p)); |
|---|
| 261 | | } |
|---|
| 262 | | |
|---|
| 263 | | static inline void stream_push_formated_type(base_stream &os, uint64_t val) { |
|---|
| 264 | | char *p = os.req_buffer(64); |
|---|
| 265 | | snprintf(p, 64, "%llu", val); |
|---|
| 266 | | os.commit_change(strlen(p)); |
|---|
| 267 | | } |
|---|
| 268 | | |
|---|
| 269 | | static inline void stream_push_formated_type(base_stream &os, const char *val) { |
|---|
| 270 | | os.append_chunk(val ? val : "(null)"); |
|---|
| 271 | | } |
|---|
| 272 | | |
|---|
| 273 | | static inline void stream_push_formated_type(base_stream &os, const void *val) { |
|---|
| 274 | | char *p = os.req_buffer(32); |
|---|
| 275 | | snprintf(p, 32, "%p", val); |
|---|
| 276 | | os.commit_change(strlen(p)); |
|---|
| 277 | | } |
|---|
| 278 | | |
|---|