cgv
Loading...
Searching...
No Matches
file.h
1#pragma once
2
3#include <string>
4#include <stdio.h>
5
6#include <cgv/utils/lib_begin.h>
7
8
9namespace cgv {
10 namespace utils {
11 namespace file {
13 CGV_API void* open(const std::string& file_name, const std::string& mode, void* buf, int length);
15 CGV_API bool exists(const std::string& file_name);
17 CGV_API bool remove(const std::string& file_name);
19 CGV_API bool rename(const std::string& before, const char* after);
21 CGV_API std::string find_in_paths(
22 const std::string& file_name, // file name without path
23 const std::string& path_list, // semicolon separated list of paths
24 bool recursive = true, // whether to search subdirectories of paths
25 const std::string& sub_dir = ""); // sub directory to which search in paths is restricted
27 CGV_API bool copy(const std::string& from, const std::string& to);
29 CGV_API size_t size(const std::string& file_name, bool ascii = false);
31 CGV_API bool read(const std::string& file_name, std::string& content, bool ascii = false);
33 CGV_API char* read(const std::string& file_name, bool ascii = false, size_t* size_ptr = 0, size_t add_nr_bytes_to_buffer=0);
35 CGV_API bool read(const std::string& filename, char* ptr, size_t size, bool ascii = false, size_t file_offset = 0);
37 CGV_API bool write(const std::string& filename, const std::string& content, bool ascii = false);
39 CGV_API bool write(const std::string& filename, const char* ptr, size_t size, bool ascii = false);
41 CGV_API bool append(const std::string& filename, const char* ptr, size_t size, bool ascii = false);
43 CGV_API bool append(const std::string& file_name_1, const std::string& file_name_2, bool ascii = false);
45 enum Result { EQUAL, DIFFERENT, FILE_ERROR };
47 CGV_API Result cmp(const std::string& what, const std::string& with);
49 CGV_API void* find_first(const std::string& filter);
51 CGV_API void* find_next(void* handle);
53 CGV_API void find_close(void* handle);
55 CGV_API std::string find_name(void* handle);
57 CGV_API long long find_last_write_time(const void* handle);
59 CGV_API bool find_read_only(const void* handle);
61 CGV_API bool find_directory(const void* handle);
63 CGV_API bool find_system(const void* handle);
65 CGV_API bool find_hidden(const void* handle);
67 CGV_API bool find_archive(const void* handle);
69 CGV_API bool find_normal(const void* handle);
71 CGV_API size_t find_size(void* handle);
73 CGV_API long long get_last_write_time(const std::string& file_path);
75 CGV_API std::string get_extension(const std::string& file_path);
77 CGV_API std::string drop_extension(const std::string& file_path);
79 CGV_API std::string get_file_name(const std::string& file_path);
81 CGV_API std::string get_path(const std::string& file_path);
83 CGV_API bool is_relative_path(const std::string& file_path);
85 CGV_API std::string platform_path(const std::string& file_path);
87 CGV_API std::string clean_path(const std::string& file_path);
89 CGV_API bool shorten_path(std::string& file_path, const std::string& prefix_path);
91 CGV_API bool read_string_bin(std::string& s, FILE* fp);
93 CGV_API bool write_string_bin(const std::string& s, FILE* fp);
94 }
95 }
96}
97
98#include <cgv/config/lib_end.h>
99
the cgv namespace
Definition print.h:11