Line data Source code
1 : ///
2 : /// @file ar/internal/files/filesystem_file.h
3 : /// @copyright (c) 2015 by Petr Zemek (s3rvac@gmail.com) and contributors
4 : /// @license MIT, see the @c LICENSE file for more details
5 : /// @brief File stored in a filesystem.
6 : ///
7 :
8 : #ifndef AR_INTERNAL_FILES_FILESYSTEM_FILE_H
9 : #define AR_INTERNAL_FILES_FILESYSTEM_FILE_H
10 :
11 : #include <string>
12 :
13 : #include "ar/file.h"
14 :
15 : namespace ar {
16 : namespace internal {
17 :
18 : ///
19 : /// File stored in a filesystem.
20 : ///
21 8 : class FilesystemFile: public File {
22 : public:
23 : explicit FilesystemFile(const std::string& path);
24 : FilesystemFile(const std::string& path, const std::string& name);
25 : virtual ~FilesystemFile() override;
26 :
27 : virtual std::string getName() const override;
28 : virtual std::string getContent() override;
29 : virtual void saveCopyTo(const std::string& directoryPath) override;
30 : virtual void saveCopyTo(const std::string& directoryPath,
31 : const std::string& name) override;
32 :
33 : private:
34 : /// Path to the file in a filesystem.
35 : std::string path;
36 :
37 : /// Name of the file to be used.
38 : std::string name;
39 : };
40 :
41 : } // namespace internal
42 : } // namespace ar
43 :
44 : #endif
|