summaryrefslogtreecommitdiff
path: root/src/piece-table.h
blob: 0182aadc62ba828ea791240931ef527cd738291d (plain)
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
/* parc
 * Copyright (C) 2025 Ekaitz Zarraga <ekaitz@elenq.tech>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef PIECE_TABLE_H
#define PIECE_TABLE_H

#include <stddef.h>

typedef struct _piece_table piece_table;

piece_table *piece_table_create (void);
piece_table * piece_table_create_from (char *orig, size_t size);
void piece_table_destroy (piece_table * piece_table);

char piece_table_index (piece_table *pt, size_t pos);
void piece_table_insert (piece_table *pt, size_t pos, char *in, size_t len);
void piece_table_delete (piece_table *pt, size_t pos, size_t len);

void piece_table_to_string (piece_table *pt, char *buf, size_t size);
size_t piece_table_length (piece_table *pt);

#endif