FXPath.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  P a t h   N a m e   M a n i p u l a t i o n                  *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXPath.h,v 1.11 2006/01/23 06:03:15 fox Exp $                            *
00023 ********************************************************************************/
00024 #ifndef FXPATH_H
00025 #define FXPATH_H
00026 
00027 
00028 namespace FX {
00029 
00030 
00031 namespace FXPath {
00032 
00034     inline FXString join(const FXString &a, const FXString &b)
00035     {
00036         FXString ret(a);
00037         if(PATHSEP!=a[a.length()-1] && PATHSEP!=b[0])
00038             return ret.append(PATHSEP).append(b);
00039         else
00040             return ret.append(b);
00041     }
00043     inline FXString join(const FXString &a, const FXString &b, const FXString &c) { return join(join(a,b), c); }
00045     inline FXString join(const FXString &a, const FXString &b, const FXString &c, const FXString &d) { return join(join(join(a,b), c), d); }
00046 
00047 
00053   FXString FXAPI root(const FXString& file);
00054 
00060   FXString FXAPI directory(const FXString& file);
00061 
00067   FXString FXAPI name(const FXString& file);
00068 
00070   FXString FXAPI title(const FXString& file);
00071 
00073   FXString FXAPI extension(const FXString& file);
00074 
00076   FXString FXAPI stripExtension(const FXString& file);
00077 
00079   FXString FXAPI drive(const FXString& file);
00080 
00082   FXString FXAPI expand(const FXString& file);
00083 
00085   FXString FXAPI contract(const FXString& file,const FXString& user=FXString::null,const FXString& var=FXString::null);
00086 
00093   FXString FXAPI simplify(const FXString& file);
00094 
00096   FXString FXAPI absolute(const FXString& file);
00097 
00099   FXString FXAPI absolute(const FXString& base,const FXString& file);
00100 
00102   FXString FXAPI relative(const FXString& file);
00103 
00105   FXString FXAPI relative(const FXString& base,const FXString& file);
00106 
00108   FXString FXAPI convert(const FXString& path);
00109 
00111   FXString FXAPI upLevel(const FXString& file);
00112 
00114   bool FXAPI isAbsolute(const FXString& file);
00115 
00117   bool FXAPI isTopDirectory(const FXString& file);
00118 
00120   bool FXAPI isShare(const FXString& file);
00121 
00123   FXString FXAPI enquote(const FXString& file,bool forcequotes=false);
00124 
00126   FXString FXAPI dequote(const FXString& file);
00127 
00155   bool FXAPI match(const FXString& pattern,const FXString& file,FXuint flags=(FILEMATCH_NOESCAPE|FILEMATCH_FILE_NAME));
00156 
00162   FXString FXAPI unique(const FXString& file);
00163 
00167   FXString FXAPI search(const FXString& pathlist,const FXString& file);
00168 
00169   }
00170 
00171 }
00172 
00173 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:23 2009 for TnFOX by doxygen v1.4.7