-
Notifications
You must be signed in to change notification settings - Fork 0
/
strlib.h
45 lines (39 loc) · 1.65 KB
/
strlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
///////////////////////////////////////////////////////////////////////////////////
// School: Brno University of Technology, Faculty of Information Technology //
// Course: Formal Languages and Compilers //
// Project: IFJ17 //
// Module: Header file of work with strings //
// Authors: Kristián Liščinský (xlisci01) //
// Matúš Liščinský (xlisci02) //
// Šimon Stupinský (xstupi00) //
// Vladimír Marcin (xmarci10) //
///////////////////////////////////////////////////////////////////////////////////
#ifndef STR_LIB_H
#define STR_LIB_H
#define STR_INIT 128
/**
* @brief this structure represents string with metadata
*/
typedef struct string_t{
char * string; ///< string allocated on heap
size_t capacity; ///< allocated space for string
size_t length; ///< actual length of string
}string_t;
/**
* @brief Function initializes string structure
*
* @param[in] size Size of usable space
*
* @return Pointer to initialized string structure
*/
string_t * strInit(size_t size);
/**
* @brief Function to extend string
*
* @param str Pointer to string structure
* @param[in] new_size New size of usable space
*
* @return Pointer to string structure with extended string
*/
bool extendStr(string_t * str, size_t new_size);
#endif