]> git.mxchange.org Git - flightgear.git/blob - src/Main/util.hxx
Fix a typo breaking some takeoff-state logic.
[flightgear.git] / src / Main / util.hxx
1 // util.hxx - general-purpose utility functions.
2 // Copyright (C) 2002  Curtis L. Olson  - http://www.flightgear.org/~curt
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 //
18 // $Id$
19
20 #ifndef __UTIL_HXX
21 #define __UTIL_HXX 1
22
23 #include <string>
24 #include <simgear/misc/sg_path.hxx>
25
26 /**
27  * Move a value towards a target.
28  *
29  * This function was originally written by Alex Perry.
30  *
31  * @param current The current value.
32  * @param target The target value.
33  * @param timeratio The percentage of smoothing time that has passed 
34  *        (elapsed time/smoothing time)
35  * @return The new value.
36  */
37 double fgGetLowPass (double current, double target, double timeratio);
38
39 /**
40  * File access control, used by Nasal and fgcommands.
41  * @param path Path to be validated
42  * @param write True for write operations and false for read operations.
43  * @return The validated path on success or empty if access denied.
44  *
45  * Warning: because this always (not just on Windows) treats both \ and /
46  * as path separators, and accepts relative paths (check-to-use race if
47  * the current directory changes),
48  * always use the returned path not the original one
49  */
50 std::string fgValidatePath(const SGPath& path, bool write);
51 std::string fgValidatePath(const std::string& path, bool write);
52
53 /**
54  * Set allowed paths for fgValidatePath
55  */
56 void fgInitAllowedPaths();
57
58 #endif // __UTIL_HXX