Name space tweaks.
This commit is contained in:
parent
6c28bd884b
commit
baf25ca7a7
@ -17,37 +17,57 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef _COMPILER_H
|
/** \file compiler.h
|
||||||
#define _COMPILER_H
|
* A set of defines to encapsulate compiler and platform differences.
|
||||||
|
* What this file does.
|
||||||
|
*
|
||||||
|
* (1) Defines macros for some STL includes which may be affected
|
||||||
|
* by file name length limitations.
|
||||||
|
*
|
||||||
|
* (2) Defines macros for some features not supported by all C++ compilers.
|
||||||
|
*
|
||||||
|
* (3) Defines 'explicit' as a null macro if the compiler doesn't support
|
||||||
|
* the explicit keyword.
|
||||||
|
*
|
||||||
|
* (4) Defines 'typename' as a null macro if the compiler doesn't support
|
||||||
|
* the typename keyword.
|
||||||
|
*
|
||||||
|
* (5) Defines bool, true and false if the compiler doesn't do so.
|
||||||
|
*
|
||||||
|
* (6) Defines SG_EXPLICIT_FUNCTION_TMPL_ARGS if the compiler
|
||||||
|
* supports calling a function template by providing its template
|
||||||
|
* arguments explicitly.
|
||||||
|
*
|
||||||
|
* (7) Defines FG_NEED_AUTO_PTR if STL doesn't provide auto_ptr<>.
|
||||||
|
*
|
||||||
|
* (8) Defines FG_NO_ARROW_OPERATOR if the compiler is unable
|
||||||
|
* to support operator->() for iterators.
|
||||||
|
*
|
||||||
|
* (9) Defines FG_USE_EXCEPTIONS if the compiler supports exceptions.
|
||||||
|
* Note: no FlightGear code uses exceptions.
|
||||||
|
*
|
||||||
|
* (10) Define FG_NAMESPACES if the compiler supports namespaces.
|
||||||
|
*
|
||||||
|
* (11) FG_MATH_FN_IN_NAMESPACE_STD -- not used??
|
||||||
|
*
|
||||||
|
* (12) Define FG_HAVE_STD if std namespace is supported.
|
||||||
|
*
|
||||||
|
* (13) Defines FG_CLASS_PARTIAL_SPECIALIZATION if the compiler
|
||||||
|
* supports partial specialization of class templates.
|
||||||
|
*
|
||||||
|
* (14) Defines FG_HAVE_STD_INCLUDES to use ISO C++ Standard headers.
|
||||||
|
*
|
||||||
|
* (15) Defines FG_HAVE_STREAMBUF if <streambuf> of <streambuf.h> are present.
|
||||||
|
*
|
||||||
|
* (16) Define FG_MATH_EXCEPTION_CLASH if math.h defines an exception class
|
||||||
|
* that clashes with the one defined in <stdexcept>.
|
||||||
|
*/
|
||||||
|
|
||||||
// What this file does.
|
#ifndef _SG_COMPILER_H
|
||||||
// (1) Defines macros for some STL includes which may be affected
|
#define _SG_COMPILER_H
|
||||||
// by file name length limitations.
|
|
||||||
// (2) Defines macros for some features not supported by all C++ compilers.
|
|
||||||
// (3) Defines 'explicit' as a null macro if the compiler doesn't support
|
|
||||||
// the explicit keyword.
|
|
||||||
// (4) Defines 'typename' as a null macro if the compiler doesn't support
|
|
||||||
// the typename keyword.
|
|
||||||
// (5) Defines bool, true and false if the compiler doesn't do so.
|
|
||||||
// (6) Defines FG_EXPLICIT_FUNCTION_TMPL_ARGS if the compiler
|
|
||||||
// supports calling a function template by providing its template
|
|
||||||
// arguments explicitly.
|
|
||||||
// (7) Defines FG_NEED_AUTO_PTR if STL doesn't provide auto_ptr<>.
|
|
||||||
// (8) Defines FG_NO_ARROW_OPERATOR if the compiler is unable
|
|
||||||
// to support operator->() for iterators.
|
|
||||||
// (9) Defines FG_USE_EXCEPTIONS if the compiler supports exceptions.
|
|
||||||
// Note: no FlightGear code uses exceptions.
|
|
||||||
// (10) Define FG_NAMESPACES if the compiler supports namespaces.
|
|
||||||
// (11) FG_MATH_FN_IN_NAMESPACE_STD -- not used??
|
|
||||||
// (12) Define FG_HAVE_STD if std namespace is supported.
|
|
||||||
// (13) Defines FG_CLASS_PARTIAL_SPECIALIZATION if the compiler
|
|
||||||
// supports partial specialization of class templates.
|
|
||||||
// (14) Defines FG_HAVE_STD_INCLUDES to use ISO C++ Standard headers.
|
|
||||||
// (15) Defines FG_HAVE_STREAMBUF if <streambuf> of <streambuf.h> are present.
|
|
||||||
// (16) Define FG_MATH_EXCEPTION_CLASH if math.h defines an exception class
|
|
||||||
// that clashes with the one defined in <stdexcept>.
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
# if __GNUC__ == 2
|
# if __GNUC__ == 2
|
||||||
@ -71,7 +91,7 @@
|
|||||||
# elif __GNUC_MINOR__ >= 8
|
# elif __GNUC_MINOR__ >= 8
|
||||||
|
|
||||||
// g++-2.8.x and egcs-1.x
|
// g++-2.8.x and egcs-1.x
|
||||||
# define FG_EXPLICIT_FUNCTION_TMPL_ARGS
|
# define SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
||||||
# define FG_NEED_AUTO_PTR
|
# define FG_NEED_AUTO_PTR
|
||||||
# define FG_MEMBER_TEMPLATES
|
# define FG_MEMBER_TEMPLATES
|
||||||
# define FG_NAMESPACES
|
# define FG_NAMESPACES
|
||||||
@ -232,7 +252,7 @@
|
|||||||
#if defined ( sgi ) && !defined( __GNUC__ )
|
#if defined ( sgi ) && !defined( __GNUC__ )
|
||||||
# define FG_HAVE_NATIVE_SGI_COMPILERS
|
# define FG_HAVE_NATIVE_SGI_COMPILERS
|
||||||
|
|
||||||
# define FG_EXPLICIT_FUNCTION_TMPL_ARGS
|
# define SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
||||||
# define FG_NEED_AUTO_PTR
|
# define FG_NEED_AUTO_PTR
|
||||||
# define FG_MEMBER_TEMPLATES
|
# define FG_MEMBER_TEMPLATES
|
||||||
# define FG_NAMESPACES
|
# define FG_NAMESPACES
|
||||||
@ -287,7 +307,7 @@
|
|||||||
# define false 0
|
# define false 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FG_EXPLICIT_FUNCTION_TMPL_ARGS
|
#ifdef SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
||||||
# define FG_NULL_TMPL_ARGS <>
|
# define FG_NULL_TMPL_ARGS <>
|
||||||
#else
|
#else
|
||||||
# define FG_NULL_TMPL_ARGS
|
# define FG_NULL_TMPL_ARGS
|
||||||
@ -342,4 +362,4 @@ inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
|
|||||||
|
|
||||||
#endif // FG_INCOMPLETE_FUNCTIONAL
|
#endif // FG_INCOMPLETE_FUNCTIONAL
|
||||||
|
|
||||||
#endif // _COMPILER_H
|
#endif // _SG_COMPILER_H
|
||||||
|
@ -249,7 +249,7 @@ find_node (SGPropertyNode * current,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Success! This is the one we want.
|
// Success! This is the one we want.
|
||||||
else if (position >= components.size()) {
|
else if (position >= (int)components.size()) {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,6 +473,8 @@ SGValue::getBoolValue () const
|
|||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
return (GET_STRING == "true" || getDoubleValue() != 0.0L);
|
return (GET_STRING == "true" || getDoubleValue() != 0.0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -499,6 +501,8 @@ SGValue::getIntValue () const
|
|||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
return atoi(GET_STRING.c_str());
|
return atoi(GET_STRING.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,6 +555,8 @@ SGValue::getFloatValue () const
|
|||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
return atof(GET_STRING.c_str());
|
return atof(GET_STRING.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -577,6 +583,8 @@ SGValue::getDoubleValue () const
|
|||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
return strtod(GET_STRING.c_str(), 0);
|
return strtod(GET_STRING.c_str(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -606,12 +614,14 @@ SGValue::getStringValue () const
|
|||||||
sprintf(buf, "%f", GET_FLOAT);
|
sprintf(buf, "%f", GET_FLOAT);
|
||||||
return buf;
|
return buf;
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
sprintf(buf, "%lf", GET_DOUBLE);
|
sprintf(buf, "%f", GET_DOUBLE);
|
||||||
return buf;
|
return buf;
|
||||||
case STRING:
|
case STRING:
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
return GET_STRING;
|
return GET_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -864,7 +874,7 @@ SGValue::tie (const SGRawValue<bool> &value, bool use_default)
|
|||||||
else if (_tied)
|
else if (_tied)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool old_val;
|
bool old_val = false;
|
||||||
if (use_default)
|
if (use_default)
|
||||||
old_val = getBoolValue();
|
old_val = getBoolValue();
|
||||||
|
|
||||||
@ -891,7 +901,7 @@ SGValue::tie (const SGRawValue<int> &value, bool use_default)
|
|||||||
else if (_tied)
|
else if (_tied)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int old_val;
|
int old_val = 0;
|
||||||
if (use_default)
|
if (use_default)
|
||||||
old_val = getIntValue();
|
old_val = getIntValue();
|
||||||
|
|
||||||
@ -945,7 +955,7 @@ SGValue::tie (const SGRawValue<float> &value, bool use_default)
|
|||||||
else if (_tied)
|
else if (_tied)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float old_val;
|
float old_val = 0.0;
|
||||||
if (use_default)
|
if (use_default)
|
||||||
old_val = getFloatValue();
|
old_val = getFloatValue();
|
||||||
|
|
||||||
@ -972,7 +982,7 @@ SGValue::tie (const SGRawValue<double> &value, bool use_default)
|
|||||||
else if (_tied)
|
else if (_tied)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
double old_val;
|
double old_val = 0.0;
|
||||||
if (use_default)
|
if (use_default)
|
||||||
old_val = getDoubleValue();
|
old_val = getDoubleValue();
|
||||||
|
|
||||||
@ -1126,7 +1136,7 @@ SGPropertyNode::SGPropertyNode (const string &name,
|
|||||||
SGPropertyNode::~SGPropertyNode ()
|
SGPropertyNode::~SGPropertyNode ()
|
||||||
{
|
{
|
||||||
delete _value;
|
delete _value;
|
||||||
for (int i = 0; i < _children.size(); i++)
|
for (int i = 0; i < (int)_children.size(); i++)
|
||||||
delete _children[i];
|
delete _children[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <errno.h> // for errno
|
#include <errno.h> // for errno
|
||||||
|
|
||||||
#ifdef FG_HAVE_STD_INCLUDES
|
#ifdef SG_HAVE_STD_INCLUDES
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
# include <cstdio>
|
# include <cstdio>
|
||||||
# include <cstdlib>
|
# include <cstdlib>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#ifdef FG_HAVE_STD_INCLUDES
|
#ifdef SG_HAVE_STD_INCLUDES
|
||||||
# include <ctime>
|
# include <ctime>
|
||||||
#else
|
#else
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#ifdef FG_HAVE_STD_INCLUDES
|
#ifdef SG_HAVE_STD_INCLUDES
|
||||||
# include <ctime>
|
# include <ctime>
|
||||||
#else
|
#else
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user