O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
getters.c
1/* ************************************************************************** */
2/* ____ _ _____ ____ _ _ _ _____ _ _ ____ ____ */
3/* / ___| / \ | ___| _ \ / \ | \ | | |_ _| || | | _ \/ ___| */
4/* \___ \ / _ \ | |_ | |_) | / _ \ | \| | | | | || |_| | | \___ \ */
5/* ___) / ___ \| _| | _ < / ___ \| |\ | | | |__ _| |_| |___) | */
6/* |____/_/ \_|_| |_| \_/_/ \_|_| \_| |_| |_| |____/|____/ */
7/* */
8/* Copyright 2023, SAFRAN T4DS, ALL RIGHTS RESERVED */
9/* */
10/* @file getters.c */
11/* @author Antoine GAGNIERE */
12/* */
13/* ************************************************************************** */
14
15#include "o2s/string.h"
16
18size_t string_length(const string_t* self)
19{
20 return array_count(self);
21}
22
27char* string_get(const string_t* self, size_t index)
28{
29 return (char*)array_get(self, index);
30}
31
33bool string_is_empty(const string_t* self)
34{
35 return array_is_empty(self);
36}
37
39char* string_end(const string_t* self)
40{
41 return array_end(self);
42}
bool array_is_empty(const array_t *self)
True if the array contains no element.
Definition getters.c:64
void * array_end(const array_t *self)
One-past-the-end pointer of the array.
Definition getters.c:25
void * array_get(const array_t *self, size_t index)
Pointer of the element at position index of the array.
Definition getters.c:56
size_t array_count(const array_t *self)
Number of elements stored.
Definition getters.c:70
Dynamic string implementation.
array_t string_t
A string is an array of char.
Definition string.h:30