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 File Reference

Create strings from data structures. More...

#include "o2s/array.h"
#include "o2s/deque.h"
#include "o2s/queue.h"
#include "o2s/stack.h"
#include "o2s/string.h"

Go to the source code of this file.

Typedefs

typedef string_t(* string_conversion_t) (const void *element)
 Designate functions that create a string from the address of a value.

Functions

const char * boolean_to_cstring (bool value)
 Null-temrminated string from a boolean.
Integers
string_t int_to_string (const int *value)
 Create a string from an integer.
string_t unsigned_to_string (const unsigned *value)
 Create a string from an unsigned integer.
string_t short_to_string (const short *value)
 Create a string from a short integer.
string_t long_to_string (const long *value)
 Create a string from a long integer.
Floating point numbers
string_t float_to_string (const float *value)
 Create a sring from a float.
string_t double_to_string (const double *value)
 Create a string from a double.
Strings
string_t cstring_to_string (const char *const *value)
 Create a string from a null-terminated character string.
string_t char_to_string (const char *c)
 Creates a string to represent the char pointed to by c.
Structures
string_t array_to_string (const array_t *self, string_conversion_t convert_element)
 Create a string from an array.
string_t deque_to_string (const deque_t *self, string_conversion_t convert_element)
 Create a string that represents a deque.
string_t queue_to_string (const queue_t *self, string_conversion_t convert_element)
 Create a string from a queue.
string_t stack_to_string (const o2s_stack_t *self, string_conversion_t convert_element)
 Create a string from a stack.

Detailed Description

Create strings from data structures.

Author
Antoine GAGNIERE

Definition in file to_string.h.

Function Documentation

◆ boolean_to_cstring()

const char * boolean_to_cstring ( bool value)

Null-temrminated string from a boolean.

Returns
  • "true" if the parameter is true
  • "false" otherwise

Definition at line 167 of file to_string.c.

◆ char_to_string()

string_t char_to_string ( const char * c)

Creates a string to represent the char pointed to by c.

If c is printable, it will be included directly, else a escape sequence. In both cases surrounded by single quotes

Definition at line 126 of file to_string.c.

◆ cstring_to_string()

string_t cstring_to_string ( const char *const * value)

Create a string from a null-terminated character string.

If the parameter is the NULL pointer, the returned string is "(null)".

Definition at line 114 of file to_string.c.