ClanLib  2.3.7
path_help.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_core.h"
35 #include <vector>
36 
41 {
44 
45 public:
47  enum PathType
48  {
51 
53  path_type_virtual
54  };
55 
102  static CL_String make_absolute(
103  const CL_String &base_path,
104  const CL_String &relative_path,
105  PathType path_type = path_type_file);
106 
126  static CL_String make_relative(
127  const CL_String &base_path,
128  const CL_String &absolute_path,
129  PathType path_type = path_type_file);
130 
136  static bool is_absolute(
137  const CL_String &path,
138  PathType path_type = path_type_file);
139 
145  static bool is_relative(
146  const CL_String &path,
147  PathType path_type = path_type_file);
148 
158  static CL_String normalize(
159  const CL_String &path,
160  PathType path_type = path_type_file);
161 
169  static CL_String add_trailing_slash(
170  const CL_String &path,
171  PathType path_type = path_type_file);
172 
179  static CL_String remove_trailing_slash(
180  const CL_String &path);
181 
188  static CL_String get_location(
189  const CL_String &fullname,
190  PathType path_type = path_type_file);
191 
199  static CL_String get_basepath(
200  const CL_String &fullname,
201  PathType path_type = path_type_file);
202 
204 
207  static std::vector<CL_String> split_basepath(
208  const CL_String &fullname,
209  PathType path_type = path_type_file);
210 
212 
215  static CL_String get_fullpath(
216  const CL_String &fullname,
217  PathType path_type = path_type_file);
218 
220 
223  static CL_String get_filename(
224  const CL_String &fullname,
225  PathType path_type = path_type_file);
226 
228 
231  static CL_String get_basename(
232  const CL_String &fullname,
233  PathType path_type = path_type_file);
234 
236 
240  static CL_String get_extension(
241  const CL_String &fullname,
242  PathType path_type = path_type_file);
243 
245 
249  static CL_String get_fullname(
250  const CL_String &fullpath,
251  const CL_String &filename,
252  PathType path_type = path_type_file);
253 
255 
260  static CL_String get_fullname(
261  const CL_String &fullpath,
262  const CL_String &filename,
263  const CL_String &extension,
264  PathType path_type = path_type_file);
265 
267 
273  static CL_String get_fullname(
274  const CL_String &location,
275  const CL_String &basepath,
276  const CL_String &filename,
277  const CL_String &extension,
278  PathType path_type = path_type_file);
279 
284  static CL_String combine(const CL_String &part1, const CL_String &part2, PathType path_type = path_type_file);
286 };
287