#include "config.h"
#include "mobi.h"
Go to the source code of this file.
|
MOBIArray * | array_init (const size_t len) |
| Initializer for MOBIArray structure. More...
|
|
MOBI_RET | array_insert (MOBIArray *arr, const uint32_t value) |
| Inserts value into MOBIArray array. More...
|
|
void | array_sort (MOBIArray *arr, const bool unique) |
| Sort MOBIArray in ascending order. More...
|
|
size_t | array_size (MOBIArray *arr) |
| Get size of the array. More...
|
|
void | array_free (MOBIArray *arr) |
| Free MOBIArray structure and contained data. More...
|
|
MOBI_RET | mobi_trie_insert_reversed (MOBITrie **root, char *string, char *value) |
| Insert reversed string into MOBITrie trie. More...
|
|
MOBITrie * | mobi_trie_get_next (char ***values, size_t *values_count, const MOBITrie *node, const char c) |
| Fetch values for key c from MOBITrie trie's current level starting at node. More...
|
|
void | mobi_trie_free (MOBITrie *node) |
| Recursively free MOBITrie trie starting from node. More...
|
|
MOBIFragment * | mobi_list_add (MOBIFragment *curr, size_t raw_offset, unsigned char *fragment, const size_t size, const bool is_malloc) |
| Allocate fragment, fill with data, append to linked list. More...
|
|
MOBIFragment * | mobi_list_del (MOBIFragment *curr) |
| Delete fragment from linked list. More...
|
|
MOBI_RET | mobi_list_insert (MOBIFragment **curr, size_t raw_offset, unsigned char *fragment, const size_t size, const bool is_malloc, const size_t offset) |
| Allocate fragment, fill with data, insert into linked list at given offset. More...
|
|
void | mobi_list_del_all (MOBIFragment *first) |
| Delete all fragments from linked list. More...
|
|
Copyright (c) 2014 Bartek Fabiszewski http://www.fabiszewski.net
This file is part of libmobi. Licensed under LGPL, either version 3, or any later. See http://www.gnu.org/licenses/
◆ MOBIFragment
Structure for links reconstruction.
Linked list of Fragment structures forms whole document part
◆ array_free()
◆ array_init()
Initializer for MOBIArray structure.
It allocates memory for structure and for data: array of uint32_t variables. Memory should be freed with array_free().
- Parameters
-
[in] | len | Initial size of the array |
- Returns
- MOBIArray on success, NULL otherwise
◆ array_insert()
Inserts value into MOBIArray array.
- Parameters
-
[in,out] | arr | MOBIArray array |
[in] | value | Value to be inserted |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)
◆ array_size()
Get size of the array.
- Parameters
-
- Returns
- Array size
◆ array_sort()
void array_sort |
( |
MOBIArray * |
arr, |
|
|
const bool |
unique |
|
) |
| |
Sort MOBIArray in ascending order.
When unique is set to true, duplicate values are discarded.
- Parameters
-
[in,out] | arr | MOBIArray array |
[in] | unique | Discard duplicate values if true |
◆ mobi_list_add()
MOBIFragment* mobi_list_add |
( |
MOBIFragment * |
curr, |
|
|
size_t |
raw_offset, |
|
|
unsigned char * |
fragment, |
|
|
const size_t |
size, |
|
|
const bool |
is_malloc |
|
) |
| |
Allocate fragment, fill with data, append to linked list.
- Parameters
-
[in] | curr | Last fragment in linked list |
[in] | raw_offset | Fragment offset in raw markup, SIZE_MAX if not present in original markup |
[in] | fragment | Fragment data |
[in] | size | Size data |
[in] | is_malloc | is_maloc data |
- Returns
- Fragment structure filled with data
◆ mobi_list_del()
Delete fragment from linked list.
- Parameters
-
[in] | curr | Fragment to be deleted |
- Returns
- Next fragment in the linked list or NULL if absent
◆ mobi_list_del_all()
Delete all fragments from linked list.
- Parameters
-
[in] | first | First fragment from the list |
◆ mobi_list_insert()
MOBI_RET mobi_list_insert |
( |
MOBIFragment ** |
fragment, |
|
|
size_t |
raw_offset, |
|
|
unsigned char * |
data, |
|
|
const size_t |
size, |
|
|
const bool |
is_malloc, |
|
|
const size_t |
offset |
|
) |
| |
Allocate fragment, fill with data, insert into linked list at given offset.
Starts to search for offset at given fragment. The pointer to input fragment will be replaced by newly added one.
- Parameters
-
[in,out] | fragment | Fragment where search starts, on success pointer to new fragment structure filled with data |
[in] | raw_offset | Fragment offset in raw markup, SIZE_MAX if not present in original markup |
[in] | data | Fragment data |
[in] | size | Size data |
[in] | is_malloc | is_maloc data |
[in] | offset | offset where new chunk will be inserted |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS, on offset not found MOBI_DATA_CORRUPT)
◆ mobi_trie_free()
Recursively free MOBITrie trie starting from node.
- Parameters
-
◆ mobi_trie_get_next()
MOBITrie* mobi_trie_get_next |
( |
char *** |
values, |
|
|
size_t * |
values_count, |
|
|
const MOBITrie * |
node, |
|
|
const char |
c |
|
) |
| |
Fetch values for key c from MOBITrie trie's current level starting at node.
- Parameters
-
[in,out] | values | Array of values to be fetched |
[in,out] | values_count | Array size |
[in] | node | MOBITrie node to start search |
[in] | c | Key character |
- Returns
- MOBITrie children node of the node with c key or NULL if not found
◆ mobi_trie_insert_reversed()
MOBI_RET mobi_trie_insert_reversed |
( |
MOBITrie ** |
root, |
|
|
char * |
string, |
|
|
char * |
value |
|
) |
| |
Insert reversed string into MOBITrie trie.
- Parameters
-
[in,out] | root | Root node |
[in] | string | String to be inserted |
[in] | value | Value associated with the string |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)