My Project
 All Classes Functions Variables Pages
File.h
1 /*
2  * File.h
3  *
4  * Created on: Jun 1, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_CPP_UTILS_FILE_H_
9 #define COMPONENTS_CPP_UTILS_FILE_H_
10 #include <string>
11 #include <dirent.h>
12 
16 class File {
17 public:
18  File(std::string name, uint8_t type = DT_UNKNOWN);
19 
20  std::string getContent(bool base64Encode = false);
21  std::string getContent(uint32_t offset, uint32_t size);
22  std::string getName();
23  std::string getPath();
24  uint8_t getType();
25  bool isDirectory();
26  uint32_t length();
27 
28 private:
29  std::string m_path;
30  uint8_t m_type;
31 };
32 
33 #endif /* COMPONENTS_CPP_UTILS_FILE_H_ */
uint8_t getType()
Get the type of the file. The type of a file can be DT_REGULAR, DT_DIRECTORY or DT_UNKNOWN.
Definition: File.cpp:101
uint32_t length()
Get the length of the file in bytes.
Definition: File.cpp:110
File(std::string name, uint8_t type=DT_UNKNOWN)
Construct a file.
Definition: File.cpp:22
std::string getContent(bool base64Encode=false)
Retrieve the content of the file.
Definition: File.cpp:33
std::string getName()
Get the name of the file.
Definition: File.cpp:89
bool isDirectory()
Determine if the type of the file is a directory.
Definition: File.cpp:122
A logical representation of a file.
Definition: File.h:16