define wxHAS_CONFIG_TEMPLATE_RW if template wxConfig::Read/Write() are available; use it to exclude the calls to these functions from the test to fix VC6 compilation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56661 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -192,6 +192,8 @@ Currently the following symbols exist:
|
|||||||
have an efficient (CPU-specific) implementation. Notice that the functions
|
have an efficient (CPU-specific) implementation. Notice that the functions
|
||||||
themselves are always available but can be prohibitively slow to use when
|
themselves are always available but can be prohibitively slow to use when
|
||||||
implemented in a generic way, using a critical section.}
|
implemented in a generic way, using a critical section.}
|
||||||
|
@itemdef{wxHAS_CONFIG_TEMPLATE_RW, Defined if the currently used compiler
|
||||||
|
supports template Read() and Write() methods in wxConfig.}
|
||||||
@itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in size.}
|
@itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in size.}
|
||||||
@itemdef{wxHAS_LARGE_FFILES, Defined if wxFFile supports files more than 4GB in size.}
|
@itemdef{wxHAS_LARGE_FFILES, Defined if wxFFile supports files more than 4GB in size.}
|
||||||
@itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.}
|
@itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.}
|
||||||
|
@@ -52,6 +52,14 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString;
|
|||||||
#define wxUSE_CONFIG_NATIVE 1
|
#define wxUSE_CONFIG_NATIVE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// not all compilers can deal with template Read/Write() methods, define this
|
||||||
|
// symbol if the template functions are available
|
||||||
|
#if (!defined(__VISUALC__) || __VISUALC__ > 1200) && \
|
||||||
|
!defined( __VMS ) && \
|
||||||
|
!defined (__DMC__)
|
||||||
|
#define wxHAS_CONFIG_TEMPLATE_RW
|
||||||
|
#endif
|
||||||
|
|
||||||
// Style flags for constructor style parameter
|
// Style flags for constructor style parameter
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -185,8 +193,7 @@ public:
|
|||||||
// no default version since it does not make sense for binary data
|
// no default version since it does not make sense for binary data
|
||||||
#endif // wxUSE_BASE64
|
#endif // wxUSE_BASE64
|
||||||
|
|
||||||
// Causes ambiguities in VC++ 6 and OpenVMS (at least)
|
#ifdef wxHAS_CONFIG_TEMPLATE_RW
|
||||||
#if ( (!defined(__VISUALC__) || __VISUALC__ > 1200) && !defined( __VMS ) && !defined (__DMC__))
|
|
||||||
// read other types, for which wxFromString is defined
|
// read other types, for which wxFromString is defined
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool Read(const wxString& key, T* value) const
|
bool Read(const wxString& key, T* value) const
|
||||||
@@ -209,7 +216,7 @@ public:
|
|||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // wxHAS_CONFIG_TEMPLATE_RW
|
||||||
|
|
||||||
// convenience functions returning directly the value
|
// convenience functions returning directly the value
|
||||||
wxString Read(const wxString& key,
|
wxString Read(const wxString& key,
|
||||||
|
@@ -67,7 +67,9 @@ void ConfigTestCase::ReadWriteLocalTest()
|
|||||||
config->Write(wxString(wxT("long1")), 234L);
|
config->Write(wxString(wxT("long1")), 234L);
|
||||||
config->Write(wxT("double1"), 345.67);
|
config->Write(wxT("double1"), 345.67);
|
||||||
config->Write(wxT("bool1"), true);
|
config->Write(wxT("bool1"), true);
|
||||||
|
#ifdef wxHAS_CONFIG_TEMPLATE_RW
|
||||||
config->Write(wxT("color1"), wxColour(11,22,33,44));
|
config->Write(wxT("color1"), wxColour(11,22,33,44));
|
||||||
|
#endif // wxHAS_CONFIG_TEMPLATE_RW
|
||||||
config->Flush();
|
config->Flush();
|
||||||
delete config;
|
delete config;
|
||||||
|
|
||||||
@@ -114,12 +116,14 @@ void ConfigTestCase::ReadWriteLocalTest()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT( config->ReadBool(wxT("bool1"), false) == bool1 );
|
CPPUNIT_ASSERT( config->ReadBool(wxT("bool1"), false) == bool1 );
|
||||||
|
|
||||||
|
#ifdef wxHAS_CONFIG_TEMPLATE_RW
|
||||||
wxColour color1;
|
wxColour color1;
|
||||||
r = config->Read(wxT("color1"), &color1);
|
r = config->Read(wxT("color1"), &color1);
|
||||||
CPPUNIT_ASSERT( r );
|
CPPUNIT_ASSERT( r );
|
||||||
CPPUNIT_ASSERT( color1 == wxColour(11,22,33,44) );
|
CPPUNIT_ASSERT( color1 == wxColour(11,22,33,44) );
|
||||||
|
|
||||||
CPPUNIT_ASSERT( config->ReadObject(wxT("color1"), wxNullColour) == color1 );
|
CPPUNIT_ASSERT( config->ReadObject(wxT("color1"), wxNullColour) == color1 );
|
||||||
|
#endif // wxHAS_CONFIG_TEMPLATE_RW
|
||||||
|
|
||||||
config->DeleteAll();
|
config->DeleteAll();
|
||||||
delete config;
|
delete config;
|
||||||
@@ -149,9 +153,11 @@ void ConfigTestCase::ReadValues(wxConfig *config, bool has_values)
|
|||||||
bool bool1;
|
bool bool1;
|
||||||
r = config->Read(wxT("bool1"), &bool1, true);
|
r = config->Read(wxT("bool1"), &bool1, true);
|
||||||
CPPUNIT_ASSERT_EQUAL( r, has_values );
|
CPPUNIT_ASSERT_EQUAL( r, has_values );
|
||||||
|
#ifdef wxHAS_CONFIG_TEMPLATE_RW
|
||||||
wxColour color1;
|
wxColour color1;
|
||||||
r = config->Read(wxT("color1"), &color1, wxColour(11,22,33,44));
|
r = config->Read(wxT("color1"), &color1, wxColour(11,22,33,44));
|
||||||
CPPUNIT_ASSERT_EQUAL( r, has_values );
|
CPPUNIT_ASSERT_EQUAL( r, has_values );
|
||||||
|
#endif // wxHAS_CONFIG_TEMPLATE_RW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user