sg_path.hxx

Go to the documentation of this file.
00001 
00007 // Written by Curtis L. Olson, started April 1999.
00008 //
00009 // Copyright (C) 1999  Curtis L. Olson - http://www.flightgear.org/~curt
00010 //
00011 // This library is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU Library General Public
00013 // License as published by the Free Software Foundation; either
00014 // version 2 of the License, or (at your option) any later version.
00015 //
00016 // This library is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU General Public License
00022 // along with this program; if not, write to the Free Software
00023 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024 //
00025 // $Id: sg__path_8hxx-source.html,v 1.15 2007-12-17 15:37:10 curt Exp $
00026 
00027 
00028 #ifndef _SG_PATH_HXX
00029 #define _SG_PATH_HXX
00030 
00031 #include <sys/types.h>
00032 
00033 #include <simgear/compiler.h>
00034 #include STL_STRING
00035 
00036 #include <simgear/math/sg_types.hxx>
00037 
00038 SG_USING_STD(string);
00039 
00040 #ifdef _MSC_VER
00041   typedef int mode_t;
00042 #endif
00043 
00052 class SGPath {
00053 
00054 private:
00055 
00056     string path;
00057 
00058 public:
00059 
00061     SGPath();
00062 
00067     SGPath( const string& p );
00068 
00070     ~SGPath();
00071 
00076     void set( const string& p );
00077     SGPath& operator= ( const char* p ) { this->set(p); return *this; }
00078 
00083     void append( const string& p );
00084 
00089     void add( const string& p );
00090 
00096     void concat( const string& p );
00097 
00102     string file() const;
00103   
00108     string dir() const;
00109   
00114     string base() const;
00115 
00120     string extension() const;
00121 
00126     string str() const { return path; }
00127 
00132     const char* c_str() { return path.c_str(); }
00133 
00138     bool exists() const;
00139 
00143     void create_dir(mode_t mode);
00144 
00145 private:
00146 
00147     void fix();
00148 
00149 };
00150 
00151 
00155 string_list sgPathBranchSplit( const string &path );
00156 
00160 string_list sgPathSplit( const string &search_path );
00161 
00162 
00163 #endif // _SG_PATH_HXX
00164 
00165 

Generated on Mon Dec 17 09:30:55 2007 for SimGear by  doxygen 1.5.1