File.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #include <etk/types.hpp>
8 
9 namespace zeus {
13  class File {
14  private:
15  std::string m_mineType;
16  int32_t m_fileSize;
17  std::vector<uint8_t> m_data;
18  public:
22  File();
27  File(const std::string& _filename);
34  File(const std::string& _mineType, std::vector<uint8_t> _data, int32_t _fileSize = -1);
40  File(const std::string& _mineType, int32_t _size);
45  int32_t getTheoricFileSize() const {
46  return m_fileSize;
47  }
52  void storeIn(const std::string& _filename) const;
57  const std::string& getMineType() const {
58  return m_mineType;
59  }
64  void setMineType(const std::string& _type) {
65  m_mineType = _type;
66  }
71  void preSetDataSize(uint64_t _size) {
72  m_data.resize(_size, 0);
73  }
78  const std::vector<uint8_t>& getData() const {
79  return m_data;
80  }
86  void setData(uint64_t _offset, const std::vector<uint8_t>& _data);
93  void setData(uint64_t _offset, const uint8_t* _data, uint32_t _size);
94  };
99  class FileServer {
100  private:
101  std::string m_name;
102  public:
106  FileServer();
111  FileServer(const std::string& _filename);
116  const std::string& getFileName() const {
117  return m_name;
118  }
119  };
120 }
121 
const std::string & getMineType() const
Get the mine type of the file.
Definition: File.hpp:57
const std::vector< uint8_t > & getData() const
get a rérérence of the data
Definition: File.hpp:78
File server interface.
Definition: File.hpp:99
int32_t getTheoricFileSize() const
get the théoric file size
Definition: File.hpp:45
File inetrface.
Definition: File.hpp:13
void preSetDataSize(uint64_t _size)
préallocate the data
Definition: File.hpp:71
File()
Contructor of an empty file.
Main zeus library namespace.
Definition: AbstractFunction.hpp:15
const std::string & getFileName() const
Get the filename registered.
Definition: File.hpp:116
void setMineType(const std::string &_type)
Set the mine type of the file.
Definition: File.hpp:64
void storeIn(const std::string &_filename) const
Store data in the specify file.
void setData(uint64_t _offset, const std::vector< uint8_t > &_data)
Set data on the buffer.