-/////////////////////////////////////////////////////////////////////////////\r
-// Name: any.h\r
-// Purpose: interface of wxAny\r
-// Author: wxWidgets team\r
-// RCS-ID: $Id$\r
-// Licence: wxWindows license\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-/**\r
- @class wxAny\r
-\r
- The wxAny class represents a container for any type. Its value\r
- can be changed at run time, possibly to a different type of value.\r
-\r
- wxAny is successor class for wxVariant, essentially doing the same thing\r
- in a more modern, template-based manner and with transparent support\r
- for any user data type.\r
-\r
- Some pseudo-code'ish example of use with arbitrary user data:\r
-\r
- @code\r
- void SomeFunction()\r
- {\r
- MyClass myObject;\r
- wxAny any = myObject;\r
-\r
- // Do something\r
- // ...\r
-\r
- // Let's do a sanity check to make sure that any still holds\r
- // data of correct type.\r
- if ( any.CheckType<MyClass>() )\r
- {\r
- // Thank goodness, still a correct type.\r
- MyClass myObject2 = any.As<MyClass>();\r
- }\r
- else\r
- {\r
- // Something has gone horribly wrong!\r
- wxFAIL();\r
- }\r
- }\r
- @endcode\r
-\r
- When compared to wxVariant, there are various internal implementation\r
- differences as well. For instance, wxAny only allocates separate data\r
- object in heap for large (ie. size in bytes more than\r
- WX_ANY_VALUE_BUFFER_SIZE) or 'non-movable' data types. Pointers, integers,\r
- bools etc. are fitted in the wxAny's own buffer without need for any extra\r
- allocation. Use following code to declare your own data type as 'movable':\r
-\r
- @code\r
- #include "wx/meta/movable.h"\r
- WX_DECLARE_TYPE_MOVABLE(MyClass)\r
- @endcode\r
-\r
- However, you must be aware that 'movable' means such data that can be\r
- copied with memcpy() without corrupting program integrity. For instance,\r
- movable objects usually cannot contain pointers or references to other\r
- data. wxRect, wxPoint, and wxSize are good examples of movable classes.\r
-\r
- Note that pointers to any and all classes are already automatically\r
- declared as movable data.\r
-\r
- @library{wxbase}\r
- @category{data}\r
-\r
- @see wxAnyValueType, wxVariant\r
-*/\r
-class wxAny\r
-{\r
-public:\r
- /**\r
- Default constructor. It seeds the object with a null value.\r
- */\r
- wxAny();\r
-\r
- /**\r
- Constructs wxAny from data.\r
- */\r
- template<typename T>\r
- wxAny(const T& value);\r
-\r
- /**\r
- Constructs wxAny from another wxAny.\r
- */\r
- wxAny(const wxAny& any);\r
-\r
- /**\r
- Destructor.\r
- */\r
- ~wxAny();\r
-\r
- /**\r
- This template function converts wxAny into given type. No dynamic\r
- conversion is performed, so if the type is incorrect an assertion\r
- failure will occur in debug builds, and a bogus value is returned\r
- in release ones.\r
-\r
- @remarks This template function may not work properly with Visual C++\r
- 6. For full compiler compatibility, please use\r
- wxANY_AS(any, T) macro instead.\r
- */\r
- template<typename T>\r
- T As() const;\r
-\r
- /**\r
- Use this template function for checking if this wxAny holds\r
- a specific C++ data type.\r
-\r
- @remarks This template function may not work properly with Visual C++\r
- 6. For full compiler compatibility, please use\r
- wxANY_CHECK_TYPE(any, T) macro instead.\r
-\r
- @see wxAnyValueType::CheckType()\r
- */\r
- template<typename T>\r
- bool CheckType();\r
-\r
- /**\r
- Template function that retrieves and converts the value of this\r
- wxAny to the type that T* value is.\r
-\r
- @return Returns @true if conversion was succesfull.\r
- */\r
- template<typename T>\r
- bool GetAs(T* value) const;\r
-\r
- /**\r
- Returns the value type as wxAnyValueType instance.\r
-\r
- @remarks You cannot reliably test whether two wxAnys are of\r
- same value type by simply comparing return values\r
- of wxAny::GetType(). Instead use\r
- wxAnyValueType::CheckType<T>() template function.\r
- */\r
- const wxAnyValueType* GetType() const;\r
-\r
- /**\r
- Tests if wxAny is null (that is, whether there is data).\r
- */\r
- bool IsNull() const;\r
-\r
- /**\r
- Makes wxAny null (that is, clears it).\r
- */\r
- void MakeNull();\r
-\r
- //@{\r
- /**\r
- @name Assignment operators\r
- */\r
- template<typename T>\r
- wxAny& operator=(const T &value);\r
- wxAny& operator=(const wxAny &any);\r
- //@}\r
-\r
- //@{\r
- /**\r
- @name Equality operators\r
-\r
- @remarks Generic template-based comparison operators have not been\r
- provided for various code consistency reasons, so for custom\r
- data types you have do something like this:\r
-\r
- @code\r
- if ( any.CheckType<MyClass*>() &&\r
- any.As<MyClass*>() == myObjectPtr )\r
- {\r
- // Do something if any stores myObjectPtr\r
- }\r
- @endcode\r
- */\r
- bool operator==(signed char value) const;\r
- bool operator==(signed short value) const;\r
- bool operator==(signed int value) const;\r
- bool operator==(signed long value) const;\r
- bool operator==(wxLongLong_t value) const;\r
- bool operator==(unsigned char value) const;\r
- bool operator==(unsigned short value) const;\r
- bool operator==(unsigned int value) const;\r
- bool operator==(unsigned long value) const;\r
- bool operator==(wxULongLong_t value) const;\r
- bool operator==(float value) const;\r
- bool operator==(double value) const;\r
- bool operator==(bool value) const;\r
- bool operator==(const char* value) const;\r
- bool operator==(const wchar_t* value) const;\r
- bool operator==(const wxString& value) const;\r
- //@}\r
-\r
- //@{\r
- /**\r
- @name Inequality operators\r
- */\r
- bool operator!=(signed char value) const;\r
- bool operator!=(signed short value) const;\r
- bool operator!=(signed int value) const;\r
- bool operator!=(signed long value) const;\r
- bool operator!=(wxLongLong_t value) const;\r
- bool operator!=(unsigned char value) const;\r
- bool operator!=(unsigned short value) const;\r
- bool operator!=(unsigned int value) const;\r
- bool operator!=(unsigned long value) const;\r
- bool operator!=(wxULongLong_t value) const;\r
- bool operator!=(float value) const;\r
- bool operator!=(double value) const;\r
- bool operator!=(bool value) const;\r
- bool operator!=(const char* value) const;\r
- bool operator!=(const wchar_t* value) const;\r
- bool operator!=(const wxString& value) const;\r
- //@}\r
-};\r
-\r
-/**\r
- This is value getter macro that is more compatible with older\r
- compilers, such as Visual C++ 6.0.\r
-*/\r
-#define wxANY_AS(any, T)\r
-\r
-\r
-/**\r
- This is type checking macro that is more compatible with older\r
- compilers, such as Visual C++ 6.0.\r
-*/\r
-#define wxANY_CHECK_TYPE(any, T)\r
-\r
-\r
-/**\r
- Size of the wxAny value buffer.\r
-*/\r
-enum\r
-{\r
- WX_ANY_VALUE_BUFFER_SIZE = 16\r
-};\r
-\r
-/**\r
- Type for buffer within wxAny for holding data.\r
-*/\r
-union wxAnyValueBuffer\r
-{\r
- void* m_ptr;\r
- wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE];\r
-};\r
-\r
-\r
-/**\r
- @class wxAnyValueType\r
-\r
- wxAnyValueType is base class for value type functionality for C++ data\r
- types used with wxAny. Usually the default template will create a\r
- satisfactory wxAnyValueType implementation for a data type, but\r
- sometimes you may need to add some customization. To do this you will need\r
- to add specialized template of wxAnyValueTypeImpl<>. Often your only\r
- need may be to add dynamic type conversion which would be done like\r
- this:\r
-\r
- @code\r
- template<>\r
- class wxAnyValueTypeImpl<MyClass> :\r
- public wxAnyValueTypeImplBase<MyClass>\r
- {\r
- WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)\r
- public:\r
- wxAnyValueTypeImpl() :\r
- wxAnyValueTypeImplBase<MyClass>() { }\r
- virtual ~wxAnyValueTypeImpl() { }\r
-\r
- virtual bool ConvertValue(const wxAnyValueBuffer& src,\r
- wxAnyValueType* dstType,\r
- wxAnyValueBuffer& dst) const\r
- {\r
- // GetValue() is a static member function implemented\r
- // in wxAnyValueTypeImplBase<>.\r
- MyClass value = GetValue(src);\r
-\r
- // TODO: Convert value from src buffer to destination\r
- // type and buffer. If cannot be done, return\r
- // false. This is a simple sample.\r
- if ( dstType->CheckType<wxString>() )\r
- {\r
- wxString s = value.ToString();\r
- wxAnyValueTypeImpl<wxString>::SetValue(s, dst);\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
- };\r
-\r
- //\r
- // Following must be placed somewhere in your source code\r
- WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)\r
- @endcode\r
-\r
- wxAnyValueTypeImplBase<> template, from which we inherit in the above\r
- example, contains the bulk of the default wxAnyValueTypeImpl<> template\r
- implementation, and as such allows you to easily add some minor\r
- customization.\r
-\r
- If you need a have complete control over the type interpretation, you\r
- will need to derive a class directly from wxAnyValueType, like this:\r
-\r
- @code\r
- template <>\r
- class wxAnyValueTypeImpl<MyClass> : public wxAnyValueType\r
- {\r
- WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)\r
- public:\r
- virtual void DeleteValue(wxAnyValueBuffer& buf) const\r
- {\r
- // TODO: Free the data in buffer\r
- // It is important to clear the buffer like this\r
- // at the end of DeleteValue().\r
- buf.m_ptr = NULL;\r
- }\r
-\r
- virtual void CopyBuffer(const wxAnyValueBuffer& src,\r
- wxAnyValueBuffer& dst) const\r
- {\r
- // TODO: Copy value from one buffer to another.\r
- }\r
-\r
- virtual bool ConvertValue(const wxAnyValueBuffer& src,\r
- wxAnyValueType* dstType,\r
- wxAnyValueBuffer& dst) const\r
- {\r
- // TODO: Convert value from src buffer to destination\r
- // type and buffer.\r
- }\r
-\r
- //\r
- // Following static functions must be implemented\r
- //\r
-\r
- static void SetValue(const T& value,\r
- wxAnyValueBuffer& buf)\r
- {\r
- // TODO: Store value into buf.\r
- }\r
-\r
- static const T& GetValue(const wxAnyValueBuffer& buf)\r
- {\r
- // TODO: Return reference to value stored in buffer.\r
- }\r
- };\r
-\r
- //\r
- // Following must be placed somewhere in your source code\r
- WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)\r
-\r
- @endcode\r
-\r
- @library{wxbase}\r
- @category{data}\r
-\r
- @see wxAny\r
-*/\r
-class wxAnyValueType\r
-{\r
-public:\r
- /**\r
- Default constructor.\r
- */\r
- wxAnyValueType();\r
-\r
- /**\r
- Destructor.\r
- */\r
- virtual ~wxAnyValueType();\r
-\r
- /**\r
- Use this template function for checking if wxAnyValueType represents\r
- a specific C++ data type.\r
-\r
- @remarks This template function does not work on some older compilers\r
- (such as Visual C++ 6.0). For full compiler ccompatibility\r
- please use wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) macro\r
- instead.\r
-\r
- @see wxAny::CheckType()\r
- */\r
- template <typename T>\r
- bool CheckType();\r
-\r
- /**\r
- Convert value into buffer of different type. Return false if\r
- not possible.\r
- */\r
- virtual bool ConvertValue(const wxAnyValueBuffer& src,\r
- wxAnyValueType* dstType,\r
- wxAnyValueBuffer& dst) const = 0;\r
-\r
- /**\r
- Implement this for buffer-to-buffer copy. src.m_ptr can\r
- be expected to be NULL if value type of previously stored\r
- data was different.\r
- */\r
- virtual void CopyBuffer(const wxAnyValueBuffer& src,\r
- wxAnyValueBuffer& dst) const = 0;\r
-\r
- /**\r
- This function is called every time the data in wxAny\r
- buffer needs to be freed.\r
- */\r
- virtual void DeleteValue(wxAnyValueBuffer& buf) const = 0;\r
-\r
- /**\r
- This function is used for internal type matching.\r
- */\r
- virtual wxAnyClassInfo GetClassInfo() const = 0;\r
-\r
- /**\r
- This function is used for internal type matching.\r
- */\r
- virtual bool IsSameType(const wxAnyValueType* otherType) const = 0;\r
-};\r
-\r
-/**\r
- This is type checking macro that is more compatible with older\r
- compilers, such as Visual C++ 6.0.\r
-*/\r
-#define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T)\r
+/////////////////////////////////////////////////////////////////////////////
+// Name: any.h
+// Purpose: interface of wxAny
+// Author: wxWidgets team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ @class wxAny
+
+ The wxAny class represents a container for any type. Its value
+ can be changed at run time, possibly to a different type of value.
+
+ wxAny is a backwards-incompatible (but convertible) successor class for
+ wxVariant, essentially doing the same thing in a more modern, template-
+ based manner and with transparent support for any user data type.
+
+ Some pseudo-code'ish example of use with arbitrary user data:
+
+ @code
+ void SomeFunction()
+ {
+ MyClass myObject;
+ wxAny any = myObject;
+
+ // Do something
+ // ...
+
+ // Let's do a sanity check to make sure that any still holds
+ // data of correct type.
+ if ( any.CheckType<MyClass>() )
+ {
+ // Thank goodness, still a correct type.
+ MyClass myObject2 = any.As<MyClass>();
+ }
+ else
+ {
+ // Something has gone horribly wrong!
+ wxFAIL();
+ }
+ }
+ @endcode
+
+ When compared to wxVariant, there are various internal implementation
+ differences as well. For instance, wxAny only allocates separate data
+ object in heap for large objects (i.e. ones with size more than
+ WX_ANY_VALUE_BUFFER_SIZE, which at the time of writing is 16 bytes).
+
+ @note When performing conversions between strings and floating point
+ numbers, the representation of numbers in C locale is always used.
+ I.e. @code wxAny("1.23").GetAs<double>() @endcode will always work,
+ even if the current locale uses comma as decimal separator.
+
+ @library{wxbase}
+ @category{data}
+
+ @see wxAnyValueType, wxVariant, @ref overview_cpp_rtti_disabled
+*/
+class wxAny
+{
+public:
+ /**
+ Default constructor. It seeds the object with a null value.
+ */
+ wxAny();
+
+ /**
+ Constructs wxAny from data.
+ */
+ template<typename T>
+ wxAny(const T& value);
+
+ /**
+ Constructs wxAny from another wxAny.
+ */
+ wxAny(const wxAny& any);
+
+ /**
+ Constructs wxAny, converting value from wxVariant.
+
+ @remarks Because of this conversion, it is not usually possible to
+ have wxAny that actually holds a wxVariant. If wxVariant
+ cannot be converted to a specific data type, wxAny will then
+ hold and manage reference to wxVariantData* similar to how
+ wxVariant does.
+ */
+ wxAny(const wxVariant& variant);
+
+ /**
+ Destructor.
+ */
+ ~wxAny();
+
+ /**
+ This template function converts wxAny into given type. In most cases
+ no type conversion is performed, so if the type is incorrect an
+ assertion failure will occur.
+
+ @remarks For conveniency, conversion is done when T is wxString. This
+ is useful when a string literal (which are treated as
+ const char* and const wchar_t*) has been assigned to wxAny.
+
+ This template function may not work properly with Visual C++
+ 6. For full compiler compatibility, please use
+ wxANY_AS(any, T) macro instead.
+ */
+ template<typename T>
+ T As() const;
+
+ /**
+ Use this template function for checking if this wxAny holds
+ a specific C++ data type.
+
+ @remarks This template function may not work properly with Visual C++
+ 6. For full compiler compatibility, please use
+ wxANY_CHECK_TYPE(any, T) macro instead.
+
+ @see wxAnyValueType::CheckType()
+ */
+ template<typename T>
+ bool CheckType() const;
+
+ /**
+ Template function that retrieves and converts the value of this
+ wxAny to the type that T* value is.
+
+ @return Returns @true if conversion was successful.
+ */
+ template<typename T>
+ bool GetAs(T* value) const;
+
+ /**
+ Specialization of GetAs() that allows conversion of wxAny into
+ wxVariant.
+
+ @return Returns @true if conversion was successful. Conversion usually
+ only fails if variant used custom wxVariantData that did not
+ implement the wxAny to wxVariant conversion functions.
+ */
+ bool GetAs(wxVariant* value) const;
+
+ /**
+ Returns the value type as wxAnyValueType instance.
+
+ @remarks You cannot reliably test whether two wxAnys are of
+ same value type by simply comparing return values
+ of wxAny::GetType(). Instead, use wxAny::HasSameType().
+
+ @see HasSameType()
+ */
+ const wxAnyValueType* GetType() const;
+
+ /**
+ Returns @true if this and another wxAny have the same
+ value type.
+ */
+ bool HasSameType(const wxAny& other) const;
+
+ /**
+ Tests if wxAny is null (that is, whether there is no data).
+ */
+ bool IsNull() const;
+
+ /**
+ Makes wxAny null (that is, clears it).
+ */
+ void MakeNull();
+
+ //@{
+ /**
+ @name Assignment operators
+ */
+ template<typename T>
+ wxAny& operator=(const T &value);
+ wxAny& operator=(const wxAny &any);
+ wxAny& operator=(const wxVariant &variant);
+ //@}
+
+ //@{
+ /**
+ @name Equality operators
+
+ @remarks Generic template-based comparison operators have not been
+ provided for various code consistency reasons, so for custom
+ data types you have do something like this:
+
+ @code
+ if ( any.CheckType<MyClass*>() &&
+ any.As<MyClass*>() == myObjectPtr )
+ {
+ // Do something if any stores myObjectPtr
+ }
+ @endcode
+ */
+ bool operator==(signed char value) const;
+ bool operator==(signed short value) const;
+ bool operator==(signed int value) const;
+ bool operator==(signed long value) const;
+ bool operator==(wxLongLong_t value) const;
+ bool operator==(unsigned char value) const;
+ bool operator==(unsigned short value) const;
+ bool operator==(unsigned int value) const;
+ bool operator==(unsigned long value) const;
+ bool operator==(wxULongLong_t value) const;
+ bool operator==(float value) const;
+ bool operator==(double value) const;
+ bool operator==(bool value) const;
+ bool operator==(const char* value) const;
+ bool operator==(const wchar_t* value) const;
+ bool operator==(const wxString& value) const;
+ //@}
+
+ //@{
+ /**
+ @name Inequality operators
+ */
+ bool operator!=(signed char value) const;
+ bool operator!=(signed short value) const;
+ bool operator!=(signed int value) const;
+ bool operator!=(signed long value) const;
+ bool operator!=(wxLongLong_t value) const;
+ bool operator!=(unsigned char value) const;
+ bool operator!=(unsigned short value) const;
+ bool operator!=(unsigned int value) const;
+ bool operator!=(unsigned long value) const;
+ bool operator!=(wxULongLong_t value) const;
+ bool operator!=(float value) const;
+ bool operator!=(double value) const;
+ bool operator!=(bool value) const;
+ bool operator!=(const char* value) const;
+ bool operator!=(const wchar_t* value) const;
+ bool operator!=(const wxString& value) const;
+ //@}
+};
+
+/**
+ This is value getter macro that is more compatible with older
+ compilers, such as Visual C++ 6.0.
+*/
+#define wxANY_AS(any, T)
+
+
+/**
+ This is type checking macro that is more compatible with older
+ compilers, such as Visual C++ 6.0.
+*/
+#define wxANY_CHECK_TYPE(any, T)
+
+
+/**
+ Size of the wxAny value buffer.
+*/
+enum
+{
+ WX_ANY_VALUE_BUFFER_SIZE = 16
+};
+
+/**
+ Type for buffer within wxAny for holding data.
+*/
+union wxAnyValueBuffer
+{
+ void* m_ptr;
+ wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE];
+};
+
+
+/**
+ @class wxAnyValueType
+
+ wxAnyValueType is base class for value type functionality for C++ data
+ types used with wxAny. Usually the default template will create a
+ satisfactory wxAnyValueType implementation for a data type, but
+ sometimes you may need to add some customization. To do this you will need
+ to add specialized template of wxAnyValueTypeImpl<>. Often your only
+ need may be to add dynamic type conversion which would be done like
+ this:
+
+ @code
+ template<>
+ class wxAnyValueTypeImpl<MyClass> :
+ public wxAnyValueTypeImplBase<MyClass>
+ {
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)
+ public:
+ wxAnyValueTypeImpl() :
+ wxAnyValueTypeImplBase<MyClass>() { }
+ virtual ~wxAnyValueTypeImpl() { }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const
+ {
+ // GetValue() is a static member function implemented
+ // in wxAnyValueTypeImplBase<>.
+ MyClass value = GetValue(src);
+
+ // TODO: Convert value from src buffer to destination
+ // type and buffer. If cannot be done, return
+ // false. This is a simple sample.
+ if ( dstType->CheckType<wxString>() )
+ {
+ wxString s = value.ToString();
+ wxAnyValueTypeImpl<wxString>::SetValue(s, dst);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+
+ //
+ // Following must be placed somewhere in your source code
+ WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)
+ @endcode
+
+ wxAnyValueTypeImplBase<> template, from which we inherit in the above
+ example, contains the bulk of the default wxAnyValueTypeImpl<> template
+ implementation, and as such allows you to easily add some minor
+ customization.
+
+ If you need a have complete control over the type interpretation, you
+ will need to derive a class directly from wxAnyValueType, like this:
+
+ @code
+ template <>
+ class wxAnyValueTypeImpl<MyClass> : public wxAnyValueType
+ {
+ WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)
+ public:
+ virtual void DeleteValue(wxAnyValueBuffer& buf) const
+ {
+ // TODO: Free the data in buffer
+ // It is important to clear the buffer like this
+ // at the end of DeleteValue().
+ buf.m_ptr = NULL;
+ }
+
+ virtual void CopyBuffer(const wxAnyValueBuffer& src,
+ wxAnyValueBuffer& dst) const
+ {
+ // TODO: Copy value from one buffer to another.
+ // dst is already uninitialized and does not
+ // need to be freed.
+ }
+
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const
+ {
+ // TODO: Convert value from src buffer to destination
+ // type and buffer.
+ }
+
+ //
+ // Following static functions must be implemented
+ //
+
+ static void SetValue(const T& value,
+ wxAnyValueBuffer& buf)
+ {
+ // TODO: Store value into buf.
+ }
+
+ static const T& GetValue(const wxAnyValueBuffer& buf)
+ {
+ // TODO: Return reference to value stored in buffer.
+ }
+ };
+
+ //
+ // Following must be placed somewhere in your source code
+ WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<MyClass>)
+
+ @endcode
+
+ @library{wxbase}
+ @category{data}
+
+ @see wxAny
+*/
+class wxAnyValueType
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxAnyValueType();
+
+ /**
+ Destructor.
+ */
+ virtual ~wxAnyValueType();
+
+ /**
+ Use this template function for checking if wxAnyValueType represents
+ a specific C++ data type.
+
+ @remarks This template function does not work on some older compilers
+ (such as Visual C++ 6.0). For full compiler compatibility
+ please use wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) macro
+ instead.
+
+ @see wxAny::CheckType()
+ */
+ template <typename T>
+ bool CheckType() const;
+
+ /**
+ Convert value into buffer of different type. Return false if
+ not possible.
+ */
+ virtual bool ConvertValue(const wxAnyValueBuffer& src,
+ wxAnyValueType* dstType,
+ wxAnyValueBuffer& dst) const = 0;
+
+ /**
+ Implement this for buffer-to-buffer copy.
+
+ @param src
+ This is the source data buffer.
+
+ @param dst
+ This is the destination data buffer that is in either
+ uninitialized or freed state.
+ */
+ virtual void CopyBuffer(const wxAnyValueBuffer& src,
+ wxAnyValueBuffer& dst) const = 0;
+
+ /**
+ This function is called every time the data in wxAny
+ buffer needs to be freed.
+ */
+ virtual void DeleteValue(wxAnyValueBuffer& buf) const = 0;
+
+ /**
+ This function is used for internal type matching.
+ */
+ virtual bool IsSameType(const wxAnyValueType* otherType) const = 0;
+};
+
+/**
+ This is type checking macro that is more compatible with older
+ compilers, such as Visual C++ 6.0.
+*/
+#define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T)