Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_path.h

Go to the documentation of this file.
00001 /* 00002 * $Id: gi_path.h,v 1.1.2.17 2004/05/11 20:37:22 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __GI_PATH_H 00018 #define __GI_PATH_H 00019 00020 /*****************************************************************************/ 00021 00032 /*****************************************************************************/ 00033 00037 enum gi_path_style 00038 { 00050 GI_PATH_UNIX, 00051 00063 GI_PATH_WIN32, 00064 00069 #ifdef WIN32 00070 GI_PATH_NATIVE = GI_PATH_WIN32, 00071 #else 00072 GI_PATH_NATIVE = GI_PATH_UNIX, 00073 #endif 00074 00078 GI_PATH_STD = GI_PATH_UNIX 00079 }; 00080 00085 typedef struct gi_path 00086 { 00093 enum gi_path_style style; 00094 00099 char *buf; 00100 00101 size_t size; 00102 size_t len; 00103 } GiPath; 00104 00105 /*****************************************************************************/ 00106 00107 #define GI_PATH_SEPARATOR_WIN32 '\\' 00108 #define GI_PATH_SEPARATOR_UNIX '/' 00109 00110 #ifdef WIN32 00111 #define GI_PATH_SEPARATOR GI_PATH_SEPARATOR_WIN32 00112 #else /* !WIN32 */ 00113 #define GI_PATH_SEPARATOR GI_PATH_SEPARATOR_UNIX 00114 #endif /* WIN32 */ 00115 00116 /*****************************************************************************/ 00117 00118 EXTERN_C_BEGIN 00119 00120 /*****************************************************************************/ 00121 00137 LIBGIFT_EXPORT 00138 GiPath *gi_path_new (enum gi_path_style style, const char *path); 00139 00145 LIBGIFT_EXPORT 00146 GiPath *gi_path_newn (enum gi_path_style style, const char *path, size_t len); 00147 00152 LIBGIFT_EXPORT 00153 void gi_path_free (GiPath *gipath); 00154 00155 /*****************************************************************************/ 00156 00161 LIBGIFT_EXPORT 00162 GiPath *gi_path_dup (GiPath *source); 00163 00164 /*****************************************************************************/ 00165 00177 LIBGIFT_EXPORT 00178 char *gi_path_set (GiPath *gipath, enum gi_path_style style, const char *path); 00179 00185 LIBGIFT_EXPORT 00186 char *gi_path_setn (GiPath *gipath, enum gi_path_style style, 00187 const char *path, size_t len); 00188 00189 /*****************************************************************************/ 00190 00197 LIBGIFT_EXPORT 00198 char *gi_path_expand (GiPath *gipath); 00199 00200 /*****************************************************************************/ 00201 00213 LIBGIFT_EXPORT 00214 GiPath *gi_path_dirname (GiPath *gipath); 00215 00225 LIBGIFT_EXPORT 00226 char *gi_path_basename (GiPath *gipath); 00227 00236 LIBGIFT_EXPORT 00237 char *gi_path_extname (GiPath *gipath); 00238 00239 /*****************************************************************************/ 00240 00259 LIBGIFT_EXPORT 00260 int gi_path_append (GiPath *gipath, const char *delem); 00261 00267 LIBGIFT_EXPORT 00268 int gi_path_appendn (GiPath *gipath, const char *delem, size_t len); 00269 00270 /*****************************************************************************/ 00271 00276 LIBGIFT_EXPORT 00277 char *gi_path_fmt (GiPath *gipath, enum gi_path_style style); 00278 00279 /* simple convenience macros */ 00280 #define gi_path_native(gipath) gi_path_fmt (gipath, GI_PATH_NATIVE) 00281 #define gi_path_std(gipath) gi_path_fmt (gipath, GI_PATH_STD) 00282 00293 LIBGIFT_EXPORT 00294 char *gi_path_native_s (GiPath *gipath); 00295 00300 LIBGIFT_EXPORT 00301 size_t gi_path_fmtlen (GiPath *gipath, enum gi_path_style style); 00302 00306 LIBGIFT_EXPORT 00307 size_t gi_path_len (GiPath *gipath); 00308 00309 /*****************************************************************************/ 00310 00315 LIBGIFT_EXPORT 00316 bool gi_path_eq (GiPath *a, GiPath *b); 00317 00322 LIBGIFT_EXPORT 00323 int gi_path_cmp (GiPath *a, GiPath *b); 00324 00330 LIBGIFT_EXPORT 00331 int gi_path_cmpn (GiPath *a, GiPath *b, size_t n); 00332 00337 LIBGIFT_EXPORT 00338 bool gi_path_leads_with (GiPath *path, GiPath *lead); 00339 00340 /*****************************************************************************/ 00341 00349 LIBGIFT_EXPORT 00350 bool gi_path_absolute (GiPath *gipath); 00351 00352 /*****************************************************************************/ 00353 00354 EXTERN_C_END 00355 00356 /*****************************************************************************/ 00357 00358 #endif /* __GI_PATH_H */

Generated on Sun Aug 22 07:56:40 2004 by doxygen 1.3.7