]> git.mxchange.org Git - simgear.git/blob - simgear/misc/fgpath.hxx
Math/bucket/tiling updates contributed by Norman Vine.
[simgear.git] / simgear / misc / fgpath.hxx
1 //
2 // fgpath.hxx -- routines to abstract out path separator differences
3 //               between MacOS and the rest of the world
4 //
5 // Written by Curtis L. Olson, started April 1999.
6 //
7 // Copyright (C) 1999  Curtis L. Olson - curt@flightgear.org
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 //
23 // $Id$
24
25
26 #ifndef _FGPATH_HXX
27 #define _FGPATH_HXX
28
29
30 #ifdef HAVE_CONFIG_H
31 #  include <config.h>
32 #endif
33
34 #include <simgear/compiler.h>
35
36 #include STL_STRING
37
38 FG_USING_STD(string);
39
40
41 #ifdef MACOS
42 #  define FG_PATH_SEP ':'
43 #  define FG_BAD_PATH_SEP '/'
44 #else
45 #  define FG_PATH_SEP '/'
46 #  define FG_BAD_PATH_SEP ':'
47 #endif
48
49
50 class FGPath {
51
52 private:
53
54     string path;
55
56 public:
57
58     // default constructor
59     FGPath();
60
61     // create a path based on "path"
62     FGPath( const string p );
63
64     // destructor
65     ~FGPath();
66
67     // set path
68     void set( const string p );
69
70     // append another piece to the existing path
71     void append( const string p );
72
73     // concatenate a string to the end of the path without inserting a
74     // path separator
75     void concat( const string p );
76
77     // get the path string
78     inline string str() const { return path; }
79     inline const char *c_str() { return path.c_str(); }
80 };
81
82
83 #endif // _FGPATH_HXX
84
85