diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-01-10 21:54:34 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-01-11 00:27:49 +0100 |
| commit | f6c424165264eec06af2504800ebfdd5d701efae (patch) | |
| tree | 5512b667a9bd7c751c96990ec32082b8564c916b /src/filemanager.hpp | |
| parent | 90b6685a990b8c4931aafb508853401a89163e78 (diff) | |
| download | PROJ-f6c424165264eec06af2504800ebfdd5d701efae.tar.gz PROJ-f6c424165264eec06af2504800ebfdd5d701efae.zip | |
Use Win32 Unicode APIs and expect all strings to be UTF-8 (fixes #1765)
For backward compatibility, if PROJ_LIB content is found to be not UTF-8 or
pointing to a non existing directory, then an attempt at interpretating it
in the ANSI page encoding is done.
proj_context_set_search_paths() now assumes strings to be in UTF-8, and
functions returning paths will also return values in UTF-8.
Diffstat (limited to 'src/filemanager.hpp')
| -rw-r--r-- | src/filemanager.hpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/filemanager.hpp b/src/filemanager.hpp index 9793267c..bc12a303 100644 --- a/src/filemanager.hpp +++ b/src/filemanager.hpp @@ -39,13 +39,26 @@ NS_PROJ_START class File; +enum class FileAccess { + READ_ONLY, // "rb" + READ_UPDATE, // "r+b" + CREATE, // "w+b" +}; + class FileManager { private: FileManager() = delete; public: // "Low-level" interface. - static std::unique_ptr<File> open(PJ_CONTEXT *ctx, const char *filename); + static std::unique_ptr<File> open(PJ_CONTEXT *ctx, const char *filename, + FileAccess access); + static bool exists(PJ_CONTEXT *ctx, const char *filename); + static bool mkdir(PJ_CONTEXT *ctx, const char *filename); + static bool unlink(PJ_CONTEXT *ctx, const char *filename); + static bool rename(PJ_CONTEXT *ctx, const char *oldPath, + const char *newPath); + static std::string getProjLibEnvVar(PJ_CONTEXT *ctx); // "High-level" interface, honoring PROJ_LIB and the like. static std::unique_ptr<File> open_resource_file(PJ_CONTEXT *ctx, @@ -66,6 +79,7 @@ class File { public: virtual ~File(); virtual size_t read(void *buffer, size_t sizeBytes) = 0; + virtual size_t write(const void *buffer, size_t sizeBytes) = 0; virtual bool seek(unsigned long long offset, int whence = SEEK_SET) = 0; virtual unsigned long long tell() = 0; virtual void reassign_context(PJ_CONTEXT *ctx) = 0; @@ -78,4 +92,4 @@ NS_PROJ_END //! @endcond Doxygen_Suppress -#endif // FILEMANAGER_HPP_INCLUDED
\ No newline at end of file +#endif // FILEMANAGER_HPP_INCLUDED |
