3 * Routines to abstract out path separator differences between MacOS
4 * and the rest of the world.
7 // Written by Curtis L. Olson, started April 1999.
9 // Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU Library General Public
13 // License as published by the Free Software Foundation; either
14 // version 2 of the License, or (at your option) any later version.
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // Library General Public License for more details.
21 // You should have received a copy of the GNU Library General Public
22 // License along with this library; if not, write to the
23 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 // Boston, MA 02111-1307, USA.
37 #include <simgear/compiler.h>
45 # define SG_PATH_SEP ':'
46 # define SG_BAD_PATH_SEP '/'
48 # define SG_PATH_SEP '/'
49 # define SG_BAD_PATH_SEP ':'
54 * A class to hide path separator difference across platforms and assist
55 * in managing file system path names.
57 * Paths can be input in any platform format and will be converted
58 * automatically to the proper format.
69 /** Default constructor */
73 * Construct a path based on the starting path provided.
74 * @param p initial path
76 SGPath( const string p );
82 * Set path to a new value
85 void set( const string p );
88 * Append another piece to the existing path. Inserts a path
89 * separator between the existing component and the new component.
90 * @param p additional path component */
91 void append( const string p );
94 * Concatenate a string to the end of the path without inserting a
96 * @param p addtional path suffix
98 void concat( const string p );
101 * Get the directory part of the path.
102 * @return directory string
106 /** Get the path string
107 * @return path string
109 inline string str() const { return path; }
111 /** Get the path string
112 * @return path in "C" string (ptr to char array) form.
114 inline const char *c_str() { return path.c_str(); }
118 #endif // _SG_PATH_HXX