载入中...
搜索中...
未找到
FileData.h
浏览该文件的文档.
1#pragma once
2
3#include <string>
4#include <cstdint>
5#include "common/Data.h"
6#include "common/Exception.h"
7
8namespace eve {
9namespace filesystem {
10
12class FileData : public Data {
13public:
15 FileData(const std::string &filename, uint64_t size);
17 FileData(const FileData &c);
18
19 virtual ~FileData();
20
22 FileData *clone() const;
23 void * getData() const { return data; }
24 size_t getSize() const { return size; }
25
27 const std::string &getFilename() const { return filename; }
28 const std::string &getExtension() const { return extension; }
29 const std::string &getName() const { return name; }
30
31private:
32 // The actual data.
33 uint8_t *data;
34
35 // Size of the data.
36 uint64_t size;
37
38 // The filename used for error purposes.
39 std::string filename;
40
41 // The extension (without dot). Used to identify file type.
42 std::string extension;
43
44 // The file name without the extension (and without the dot).
45 std::string name;
46
47}; // FileData
48
49} // namespace filesystem
50} // namespace eve
uint32_t c
Data buffer paired with a filename (used for type identification).
Definition FileData.h:12
const std::string & getExtension() const
Definition FileData.h:28
const std::string & getName() const
Definition FileData.h:29
size_t getSize() const
Gets the size of the Data in bytes.
Definition FileData.h:24
void * getData() const
Gets a pointer to the data. This pointer will obviously not be valid if the Data object is destroyed.
Definition FileData.h:23
FileData * clone() const
Implements eve::Data.
Definition FileData.cpp:39
const std::string & getFilename() const
Filename, extension (without dot) and base name.
Definition FileData.h:27
Definition Build.cpp:11