-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdstr.h
51 lines (40 loc) · 1.3 KB
/
dstr.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
46
47
48
49
50
51
/**
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Projekt IFJ *
* *
* Implementace překladače imperativního jazyka IFJ18. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
Súbor:
dstr.h
Popis:
Hlavickovy subor pre dstr.c, definicia typu DStr_t
Autori:
Marek Vaško (xvasko16)
Handzuš Daniel (xhandz01)
Alexaj Adam (xalexa07)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef DSTR_H
#define DSTR_H
#define DSTR_DEFAULT_SIZE 50
#define DSTR_REALOCATION_SIZE 50
typedef struct {
size_t size;
size_t strlen;
char str[];
} DStr_t;
void DStrInit(DStr_t **DStr, size_t size);
void DStrFree(DStr_t **DStr);
int DStrAddChar(DStr_t **DStr, char c);
int DStrCat(DStr_t **DStr, const char *str);
int DStrReplace(DStr_t **DStr, const char *str);
char DStrLast(DStr_t *DStr);
void DStrDeleteLast(DStr_t *DStr);
int DStrClear(DStr_t *DStr);
size_t DStrLen(DStr_t *DStr);
char *DStrStr(DStr_t *DStr);
#endif