path_help.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2009 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_core.h"
00035 #include <vector>
00036 
00040 class CL_API_CORE CL_PathHelp
00041 {
00044 
00045 public:
00047         enum PathType
00048         {
00050                 path_type_file,
00051 
00053                 path_type_virtual
00054         };
00055 
00102         static CL_String make_absolute(
00103                 const CL_String &base_path,
00104                 const CL_String &relative_path,
00105                 PathType path_type = path_type_file);
00106 
00126         static CL_String make_relative(
00127                 const CL_String &base_path,
00128                 const CL_String &absolute_path,
00129                 PathType path_type = path_type_file);
00130 
00136         static bool is_absolute(
00137                 const CL_String &path,
00138                 PathType path_type = path_type_file);
00139 
00145         static bool is_relative(
00146                 const CL_String &path,
00147                 PathType path_type = path_type_file);
00148 
00158         static CL_String normalize(
00159                 const CL_String &path,
00160                 PathType path_type = path_type_file);
00161 
00169         static CL_String add_trailing_slash(
00170                 const CL_String &path,
00171                 PathType path_type = path_type_file);
00172 
00180         static CL_String remove_trailing_slash(
00181                 const CL_String &path,
00182                 PathType path_type = path_type_file);
00183 
00190         static CL_String get_location(
00191                 const CL_String &fullname,
00192                 PathType path_type = path_type_file);
00193 
00201         static CL_String get_basepath(
00202                 const CL_String &fullname,
00203                 PathType path_type = path_type_file);
00204 
00206 
00209         static std::vector<CL_String> split_basepath(
00210                 const CL_String &fullname,
00211                 PathType path_type = path_type_file);
00212 
00214 
00217         static CL_String get_fullpath(
00218                 const CL_String &fullname,
00219                 PathType path_type = path_type_file);
00220 
00222 
00225         static CL_String get_filename(
00226                 const CL_String &fullname,
00227                 PathType path_type = path_type_file);
00228 
00230 
00233         static CL_String get_basename(
00234                 const CL_String &fullname,
00235                 PathType path_type = path_type_file);
00236 
00238 
00242         static CL_String get_extension(
00243                 const CL_String &fullname,
00244                 PathType path_type = path_type_file);
00245 
00247 
00251         static CL_String get_fullname(
00252                 const CL_String &fullpath,
00253                 const CL_String &filename,
00254                 PathType path_type = path_type_file);
00255 
00257 
00262         static CL_String get_fullname(
00263                 const CL_String &fullpath,
00264                 const CL_String &filename,
00265                 const CL_String &extension,
00266                 PathType path_type = path_type_file);
00267 
00269 
00275         static CL_String get_fullname(
00276                 const CL_String &location,
00277                 const CL_String &basepath,
00278                 const CL_String &filename,
00279                 const CL_String &extension,
00280                 PathType path_type = path_type_file);
00282 };
00283 

Generated on Thu Dec 3 02:39:30 2009 for ClanLib by  doxygen 1.4.6