48 {
49namespace internal {
50
51
52
53
54
55
56
57
58
59
60
61
63 public:
64 FilePath() : pathname_("") { }
65 FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
66
67 explicit FilePath(const std::string& pathname) : pathname_(pathname) {
69 }
70
71 FilePath& operator=(const FilePath& rhs) {
72 Set(rhs);
73 return *this;
74 }
75
76 void Set(const FilePath& rhs) {
77 pathname_ = rhs.pathname_;
78 }
79
80 const std::string& string() const { return pathname_; }
81 const char* c_str() const { return pathname_.c_str(); }
82
83
84 static FilePath GetCurrentDir();
85
86
87
88
89
90 static FilePath MakeFileName(const FilePath& directory,
91 const FilePath& base_name,
92 int number,
93 const char* extension);
94
95
96
97
98 static FilePath ConcatPaths(const FilePath& directory,
99 const FilePath& relative_path);
100
101
102
103
104
105
106
107
108
109 static FilePath GenerateUniqueFileName(const FilePath& directory,
110 const FilePath& base_name,
111 const char* extension);
112
113
114 bool IsEmpty() const { return pathname_.empty(); }
115
116
117
118
119 FilePath RemoveTrailingPathSeparator() const;
120
121
122
123
124
125
126
127 FilePath RemoveDirectoryName() const;
128
129
130
131
132
133
134
135 FilePath RemoveFileName() const;
136
137
138
139
140
141 FilePath RemoveExtension(const char* extension) const;
142
143
144
145
146
147 bool CreateDirectoriesRecursively() const;
148
149
150
151
152
153 bool CreateFolder() const;
154
155
156
157 bool FileOrDirectoryExists() const;
158
159
160
161 bool DirectoryExists() const;
162
163
164
165
166 bool IsDirectory() const;
167
168
169
170 bool IsRootDirectory() const;
171
172
173 bool IsAbsolutePath() const;
174
175 private:
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
197
198
199
200
201 const char* FindLastPathSeparator() const;
202
203 std::string pathname_;
204};
205
206}
207}
void Normalize(float *Values)