Improved STLport support (now code compiles fine if STLport is in its own namespace and does #define std), fixed AirPlay SDK compilation
git-svn-id: http://pugixml.googlecode.com/svn/trunk@796 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
a049c2db1d
commit
9eae52a7cd
@ -90,6 +90,11 @@ typedef __int32 int32_t;
|
||||
# define DMC_VOLATILE
|
||||
#endif
|
||||
|
||||
// In some environments MSVC is a compiler but the CRT lacks certain MSVC-specific features
|
||||
#if defined(_MSC_VER) && !defined(__S3E__)
|
||||
# define MSVC_CRT_VERSION _MSC_VER
|
||||
#endif
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
// Memory allocation
|
||||
@ -3088,7 +3093,7 @@ namespace
|
||||
// we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick
|
||||
xml_parse_status get_file_size(FILE* file, size_t& out_result)
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#if defined(MSVC_CRT_VERSION) && MSVC_CRT_VERSION >= 1400
|
||||
// there are 64-bit versions of fseek/ftell, let's use them
|
||||
typedef __int64 length_type;
|
||||
|
||||
@ -3194,7 +3199,7 @@ namespace
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)
|
||||
#if defined(MSVC_CRT_VERSION) || defined(__BORLANDC__) || defined(__MINGW32__)
|
||||
FILE* open_file_wide(const wchar_t* path, const wchar_t* mode)
|
||||
{
|
||||
return _wfopen(path, mode);
|
||||
@ -5608,7 +5613,7 @@ namespace
|
||||
|
||||
bool is_nan(double value)
|
||||
{
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#if defined(MSVC_CRT_VERSION) || defined(__BORLANDC__)
|
||||
return !!_isnan(value);
|
||||
#elif defined(fpclassify) && defined(FP_NAN)
|
||||
return fpclassify(value) == FP_NAN;
|
||||
@ -5621,7 +5626,7 @@ namespace
|
||||
|
||||
const char_t* convert_number_to_string_special(double value)
|
||||
{
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#if defined(MSVC_CRT_VERSION) || defined(__BORLANDC__)
|
||||
if (_finite(value)) return (value == 0) ? PUGIXML_TEXT("0") : 0;
|
||||
if (_isnan(value)) return PUGIXML_TEXT("NaN");
|
||||
return PUGIXML_TEXT("-Infinity") + (value > 0);
|
||||
@ -5664,7 +5669,7 @@ namespace
|
||||
}
|
||||
|
||||
// gets mantissa digits in the form of 0.xxxxx with 0. implied and the exponent
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#if defined(MSVC_CRT_VERSION) && MSVC_CRT_VERSION >= 1400
|
||||
void convert_number_to_mantissa_exponent(double value, char* buffer, size_t buffer_size, char** out_mantissa, int* out_exponent)
|
||||
{
|
||||
// get base values
|
||||
|
||||
@ -16,7 +16,19 @@
|
||||
|
||||
#include "pugiconfig.hpp"
|
||||
|
||||
// Include stddef.h for size_t and ptrdiff_t
|
||||
#include <stddef.h>
|
||||
|
||||
// Include exception header for XPath
|
||||
#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
|
||||
# include <exception>
|
||||
#endif
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// cstddef is needed so that we get the 'std' namespace declaration (STLport sometimes makes std a define)
|
||||
#include <cstddef>
|
||||
|
||||
// Forward declarations for STL classes to reduce include dependencies
|
||||
namespace std
|
||||
{
|
||||
struct bidirectional_iterator_tag;
|
||||
@ -31,7 +43,14 @@ namespace std
|
||||
#else
|
||||
// Borland C++ compiler has a bug which forces template argument names in forward declarations to be the same as in actual definitions
|
||||
template <class _Ty> class allocator;
|
||||
|
||||
// STLport defines char_traits as a class instead of a struct
|
||||
# ifdef _STLPORT_VERSION
|
||||
template <class _Ty> class char_traits;
|
||||
# else
|
||||
template <class _Ty> struct char_traits;
|
||||
# endif
|
||||
|
||||
template <class _Elem, class _Traits> class basic_istream;
|
||||
template <class _Elem, class _Traits> class basic_ostream;
|
||||
template <class _Elem, class _Traits, class _Ax> class basic_string;
|
||||
@ -56,11 +75,6 @@ namespace std
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Include exception header for XPath
|
||||
#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
|
||||
# include <exception>
|
||||
#endif
|
||||
|
||||
// If no API is defined, assume default
|
||||
#ifndef PUGIXML_API
|
||||
# define PUGIXML_API
|
||||
@ -76,8 +90,6 @@ namespace std
|
||||
# define PUGIXML_FUNCTION PUGIXML_API
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// Character interface macros
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
# define PUGIXML_TEXT(t) L ## t
|
||||
|
||||
Loading…
Reference in New Issue
Block a user