Stardock 0.0.1
File System Points Synchronizer
Loading...
Searching...
No Matches
index.hh
Go to the documentation of this file.
1#ifndef INDEX_HH
2#define INDEX_HH
4#include <cstdint>
5#include <ostream>
6#include <string>
7
8namespace stardock {
9 struct Index {
10 struct Entry {
11 uint64_t path_index;
12 uint64_t file_size;
13 uint64_t modified;
14 };
15 char* paths = nullptr;
16 Entry* entries = nullptr;
17 uint64_t n_of_entries = 0;
18 uint64_t n_of_chars = 0;
19 uint64_t entries_size = 0;
20 uint64_t paths_size = 0;
21
22 void push_back(std::string path, uint64_t file_size, uint64_t modified);
23
24 inline const char* path(uint64_t entry_index) const {
25 return paths + entries[entry_index].path_index;
26 }
27 bool dump(std::string path) const;
28 bool load(std::string path);
29 void clear();
30 void sort();
31 };
32}
33
34std::ostream& operator<<(std::ostream& out, const stardock::Index& index);
35#endif//INDEX_HH
std::ostream & operator<<(std::ostream &out, const stardock::Index &index)
Definition index.cc:43
Definition align.hh:5
Definition index.hh:10
uint64_t path_index
Definition index.hh:11
uint64_t file_size
Definition index.hh:12
uint64_t modified
Definition index.hh:13
Definition index.hh:9
void sort()
Definition index.cc:97
bool dump(std::string path) const
Definition index.cc:12
Entry * entries
Definition index.hh:16
char * paths
Definition index.hh:15
void clear()
Definition index.cc:83
uint64_t entries_size
Definition index.hh:19
bool load(std::string path)
Definition index.cc:25
uint64_t n_of_entries
Definition index.hh:17
void push_back(std::string path, uint64_t file_size, uint64_t modified)
Definition index.cc:57
const char * path(uint64_t entry_index) const
Definition index.hh:24
uint64_t paths_size
Definition index.hh:20
uint64_t n_of_chars
Definition index.hh:18