O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
to_string.h
Go to the documentation of this file.
1#pragma once
2
3/* ************************************************************************** */
4/* ____ _ _____ ____ _ _ _ _____ _ _ ____ ____ */
5/* / ___| / \ | ___| _ \ / \ | \ | | |_ _| || | | _ \/ ___| */
6/* \___ \ / _ \ | |_ | |_) | / _ \ | \| | | | | || |_| | | \___ \ */
7/* ___) / ___ \| _| | _ < / ___ \| |\ | | | |__ _| |_| |___) | */
8/* |____/_/ \_|_| |_| \_/_/ \_|_| \_| |_| |_| |____/|____/ */
9/* */
16/* ************************************************************************** */
17
18#include "o2s/array.h"
19#include "o2s/deque.h"
20#include "o2s/queue.h"
21#include "o2s/stack.h"
22#include "o2s/string.h"
23
25typedef string_t (*string_conversion_t)(const void* element);
26
29string_t int_to_string(const int* value);
30string_t unsigned_to_string(const unsigned* value);
31string_t short_to_string(const short* value);
32string_t long_to_string(const long* value);
34
37string_t float_to_string(const float* value);
38string_t double_to_string(const double* value);
40
43string_t cstring_to_string(const char* const* value);
44string_t char_to_string(const char* c);
46
49string_t array_to_string(const array_t* self, string_conversion_t convert_element);
50string_t deque_to_string(const deque_t* self, string_conversion_t convert_element);
51
53inline string_t queue_to_string(const queue_t* self, string_conversion_t convert_element) { return deque_to_string(self, convert_element); }
54
56inline string_t stack_to_string(const o2s_stack_t* self, string_conversion_t convert_element) { return deque_to_string(self, convert_element); }
58
59const char* boolean_to_cstring(bool value);
Dynamic arrays.
Realtime double-ended queues.
Realtime FIFO buffer.
deque_t queue_t
A queue is First In First Out.
Definition queue.h:21
Realtime LIFO buffer.
deque_t o2s_stack_t
A stack is Last In First Out.
Definition stack.h:21
Dynamic string implementation.
array_t string_t
A string is an array of char.
Definition string.h:30
O2S array implementation.
Definition array.h:24
Double-ended queue.
Definition deque.h:27
string_t(* string_conversion_t)(const void *element)
Designate functions that create a string from the address of a value.
Definition to_string.h:25
string_t deque_to_string(const deque_t *self, string_conversion_t convert_element)
Create a string that represents a deque.
Definition to_string.c:21
string_t array_to_string(const array_t *self, string_conversion_t convert_element)
Create a string from an array.
Definition to_string.c:23
string_t stack_to_string(const o2s_stack_t *self, string_conversion_t convert_element)
Create a string from a stack.
Definition to_string.h:56
string_t int_to_string(const int *value)
Create a string from an integer.
Definition to_string.c:54
string_t float_to_string(const float *value)
Create a sring from a float.
Definition to_string.c:28
const char * boolean_to_cstring(bool value)
Null-temrminated string from a boolean.
Definition to_string.c:167
string_t queue_to_string(const queue_t *self, string_conversion_t convert_element)
Create a string from a queue.
Definition to_string.h:53
string_t double_to_string(const double *value)
Create a string from a double.
Definition to_string.c:41
string_t char_to_string(const char *c)
Creates a string to represent the char pointed to by c.
Definition to_string.c:126
string_t cstring_to_string(const char *const *value)
Create a string from a null-terminated character string.
Definition to_string.c:114
string_t short_to_string(const short *value)
Create a string from a short integer.
Definition to_string.c:68
string_t unsigned_to_string(const unsigned *value)
Create a string from an unsigned integer.
Definition to_string.c:96
string_t long_to_string(const long *value)
Create a string from a long integer.
Definition to_string.c:82