forked from raphaelsc/ghostfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghost_file.h
50 lines (32 loc) · 1.02 KB
/
ghost_file.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
/*
Ghost File System, or simply GhostFS
Copyright (C) 2016 Raphael S. Carvalho
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#ifndef GHOST_FILE_H
#define GHOST_FILE_H
#include <unordered_map>
#include <vector>
#include "block_info.h"
struct ghost_file {
private:
const char *_data;
size_t _length;
std::unordered_map<std::string, std::string> _attributes;
std::vector<block_info> _file_blocks;
public:
ghost_file(const char* data);
ghost_file();
const char* data() const;
bool is_static() const;
size_t length() const;
void update_length(size_t new_length, size_t block_size);
void add_attribute(const char* attribute, const char* value);
void remove_attribute(const char* attribute);
bool attribute_exists(const char* attribute) const;
const std::unordered_map<std::string, std::string>& attributes() const;
std::vector<block_info>& get_file_blocks();
const char* get_url() const;
};
#endif // GHOST_FILE_H