]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/variant.tex
undefine _DEFINE_LIST before redefining it; also rename it to have WX prefix
[wxWidgets.git] / docs / latex / wx / variant.tex
CommitLineData
43f06cfd
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: variant.tex
3%% Purpose: wxVariant docs
4%% Author: wxWidgets Team
5%% Modified by:
6%% Created: 01/30/2005
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets Team
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
a974387a
JS
12\section{\class{wxVariant}}\label{wxvariant}
13
14The {\bf wxVariant} class represents a container for any type.
15A variant's value can be changed at run time, possibly to a different type of value.
16
38f82bf6 17As standard, wxVariant can store values of type bool, wxChar, double, long, string,
2562c823
RR
18string list, time, date, void pointer, list of strings, and list of variants.
19However, an application can extend wxVariant's capabilities by deriving from the
20class \helpref{wxVariantData}{wxvariantdata} and using the wxVariantData form of
21the wxVariant constructor or assignment operator to assign this data to a variant.
22Actual values for user-defined types will need to be accessed via the wxVariantData
23object, unlike the case for basic data types where convenience functions such as
24\helpref{GetLong}{wxvariantgetlong} can be used.
25
eb753b56 26Pointers to any \helpref{wxObject}{wxobject} derived class can also easily be stored
2562c823
RR
27in a wxVariant. wxVariant will then use wxWidgets' built-in RTTI system to set the
28type name (returned by \helpref{GetType}{wxvariantgettype}) and to perform
29type-safety checks at runtime.
a974387a
JS
30
31This class is useful for reducing the programming for certain tasks, such as an editor
32for different data types, or a remote procedure call protocol.
33
3f90a399
RR
34An optional name member is associated with a wxVariant. This might be used, for example,
35in CORBA or OLE automation classes, where named parameters are required.
a974387a 36
631787c4
VZ
37Note that as of wxWidgets 2.7.1, wxVariant is \helpref{reference counted}{trefcount}.
38Additionally, the convenience macros {\bf DECLARE\_VARIANT\_OBJECT} and
39{\bf IMPLEMENT\_VARIANT\_OBJECT} were added so that adding (limited) support
40for conversion to and from wxVariant can be very easily implemented without modifying
41either wxVariant or the class to be stored by wxVariant. Since assignment operators
42cannot be declared outside the class, the shift left operators are used like this:
3f90a399
RR
43
44\begin{verbatim}
45 // in the header file
46 DECLARE_VARIANT_OBJECT(MyClass)
47
48 // in the implementation file
49 IMPLMENT_VARIANT_OBJECT(MyClass)
50
51 // in the user code
52 wxVariant variant;
53 MyClass value;
54 variant << value;
55
56 // or
57 value << variant;
58\end{verbatim}
59
60For this to work, MyClass must derive from \helpref{wxObject}{wxobject}, implement
61the \helpref{wxWidgets RTTI system}{runtimeclassoverview}
62and support the assignment operator and equality operator for itself. Ideally, it
63should also be reference counted to make copying operations cheap and fast. This
64can be most easily implemented using the reference counting support offered by
65\helpref{wxObject}{wxobject} itself. By default, wxWidgets already implements
66the shift operator conversion for a few of its drawing related classes:
67
68\begin{verbatim}
69IMPLEMENT_VARIANT_OBJECT(wxColour)
3f90a399
RR
70IMPLEMENT_VARIANT_OBJECT(wxImage)
71IMPLEMENT_VARIANT_OBJECT(wxIcon)
72IMPLEMENT_VARIANT_OBJECT(wxBitmap)
73\end{verbatim}
2562c823 74
e3c35a0d
RR
75Note that as of wxWidgets 2.9.0, wxVariantData no longer inherits from wxObject
76and wxVariant no longer uses the type-unsafe wxList class for list
c8058a09
JS
77operations but the type-safe wxVariantList class. Also, wxVariantData now
78supports the Clone function for implementing the \helpref{wxVariant::Unshare}{wxvariantunshare} function.
79Clone is implemented automatically by IMPLEMENT\_VARIANT\_OBJECT.
80
81Since wxVariantData no longer derives from wxObject, any code that tests the type
82of the data using wxDynamicCast will require adjustment. You can use the macro
83wxDynamicCastVariantData with the same arguments as wxDynamicCast, to use C++ RTTI
84type information instead of wxWidgets RTTI.
e3c35a0d 85
a974387a
JS
86\wxheading{Derived from}
87
88\helpref{wxObject}{wxobject}
89
954b8ae6
JS
90\wxheading{Include files}
91
92<wx/variant.h>
93
a7af285d
VZ
94\wxheading{Library}
95
96\helpref{wxBase}{librarieslist}
97
a974387a
JS
98\wxheading{See also}
99
100\helpref{wxVariantData}{wxvariantdata}
101
102\latexignore{\rtfignore{\wxheading{Members}}}
103
104\membersection{wxVariant::wxVariant}\label{wxvariantctor}
105
106\func{}{wxVariant}{\void}
107
108Default constructor.
109
110\func{}{wxVariant}{\param{const wxVariant\& }{variant}}
111
631787c4 112Copy constructor, uses \helpref{reference counting}{trefcount}.
a974387a 113
38f82bf6 114\func{}{wxVariant}{\param{const wxChar*}{ value}, \param{const wxString\& }{name = ``"}}
f6bcfd97 115
a974387a
JS
116\func{}{wxVariant}{\param{const wxString\&}{ value}, \param{const wxString\& }{name = ``"}}
117
118Construction from a string value.
119
38f82bf6 120\func{}{wxVariant}{\param{wxChar}{ value}, \param{const wxString\& }{name = ``"}}
a974387a
JS
121
122Construction from a character value.
123
124\func{}{wxVariant}{\param{long}{ value}, \param{const wxString\& }{name = ``"}}
125
126Construction from an integer value. You may need to cast to (long) to
127avoid confusion with other constructors (such as the bool constructor).
128
129\func{}{wxVariant}{\param{bool}{ value}, \param{const wxString\& }{name = ``"}}
130
131Construction from a boolean value.
132
133\func{}{wxVariant}{\param{double}{ value}, \param{const wxString\& }{name = ``"}}
134
135Construction from a double-precision floating point value.
136
9a0a58f5 137\func{}{wxVariant}{\param{const wxVariantList\&}{ value}, \param{const wxString\& }{name = ``"}}
a974387a
JS
138
139Construction from a list of wxVariant objects. This constructor
140copies {\it value}, the application is still responsible for
141deleting {\it value} and its contents.
142
a974387a
JS
143\func{}{wxVariant}{\param{void*}{ value}, \param{const wxString\& }{name = ``"}}
144
145Construction from a void pointer.
146
cf6ae290
RG
147\func{}{wxVariant}{\param{wxObject*}{ value}, \param{const wxString\& }{name = ``"}}
148
149Construction from a wxObject pointer.
150
a974387a
JS
151\func{}{wxVariant}{\param{wxVariantData*}{ data}, \param{const wxString\& }{name = ``"}}
152
8715d2d3
RN
153Construction from user-defined data. The variant holds onto the {\it data} pointer.
154
155\func{}{wxVariant}{\param{wxDateTime\&}{ val}, \param{const wxString\& }{name = ``"}}
156
43f06cfd 157Construction from a \helpref{wxDateTime}{wxdatetime}.
8715d2d3
RN
158
159\func{}{wxVariant}{\param{wxArrayString\&}{ val}, \param{const wxString\& }{name = ``"}}
160
161Construction from an array of strings. This constructor copies {\it value} and its contents.
162
163\func{}{wxVariant}{\param{DATE\_STRUCT*}{ val}, \param{const wxString\& }{name = ``"}}
164
165Construction from a odbc date value. Represented internally by a \helpref{wxDateTime}{wxdatetime} value.
166
167\func{}{wxVariant}{\param{TIME\_STRUCT*}{ val}, \param{const wxString\& }{name = ``"}}
168
169Construction from a odbc time value. Represented internally by a \helpref{wxDateTime}{wxdatetime} value.
170
171\func{}{wxVariant}{\param{TIMESTAMP\_STRUCT*}{ val}, \param{const wxString\& }{name = ``"}}
172
173Construction from a odbc timestamp value. Represented internally by a \helpref{wxDateTime}{wxdatetime} value.
a974387a
JS
174
175\membersection{wxVariant::\destruct{wxVariant}}\label{wxvariantdtor}
176
177\func{}{\destruct{wxVariant}}{\void}
178
179Destructor.
180
2562c823
RR
181Note that destructor is protected, so wxVariantData cannot usually
182be deleted. Instead, \helpref{DecRef}{wxvariantdatadecref} should be called.
631787c4 183See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
2562c823 184
8715d2d3 185
a974387a
JS
186\membersection{wxVariant::Append}\label{wxvariantappend}
187
188\func{void}{Append}{\param{const wxVariant\&}{ value}}
189
190Appends a value to the list.
191
2562c823
RR
192\membersection{wxVariant::Clear}\label{wxvariantclear}
193
194\func{void}{Clear}{\void}
195
196Makes the variant null by deleting the internal data and
197set the name to {\it wxEmptyString}.
198
a974387a
JS
199\membersection{wxVariant::ClearList}\label{wxvariantclearlist}
200
201\func{void}{ClearList}{\void}
202
203Deletes the contents of the list.
204
8715d2d3
RN
205
206\membersection{wxVariant::Convert}\label{wxvariantconvert}
207
0f353563 208\constfunc{bool}{Convert}{\param{long*}{ value}}
8715d2d3 209
0f353563 210\constfunc{bool}{Convert}{\param{bool*}{ value}}
8715d2d3 211
0f353563 212\constfunc{bool}{Convert}{\param{double*}{ value}}
8715d2d3 213
0f353563 214\constfunc{bool}{Convert}{\param{wxString*}{ value}}
8715d2d3 215
38f82bf6 216\constfunc{bool}{Convert}{\param{wxChar*}{ value}}
8715d2d3 217
0f353563 218\constfunc{bool}{Convert}{\param{wxDateTime*}{ value}}
8715d2d3
RN
219
220Retrieves and converts the value of this variant to the type that {\it value} is.
221
222
a974387a
JS
223\membersection{wxVariant::GetCount}\label{wxvariantgetcount}
224
0902898a 225\constfunc{size\_t}{GetCount}{\void}
a974387a
JS
226
227Returns the number of elements in the list.
228
229\membersection{wxVariant::Delete}\label{wxvariantdelete}
230
0902898a 231\func{bool}{Delete}{\param{size\_t }{item}}
a974387a
JS
232
233Deletes the zero-based {\it item} from the list.
234
8715d2d3
RN
235\membersection{wxVariant::GetArrayString}\label{wxvariantgetarraystring}
236
237\constfunc{wxArrayString}{GetArrayString}{\void}
238
239Returns the string array value.
240
a974387a
JS
241\membersection{wxVariant::GetBool}\label{wxvariantgetbool}
242
243\constfunc{bool}{GetBool}{\void}
244
245Returns the boolean value.
246
247\membersection{wxVariant::GetChar}\label{wxvariantgetchar}
248
38f82bf6 249\constfunc{wxChar}{GetChar}{\void}
a974387a
JS
250
251Returns the character value.
252
253\membersection{wxVariant::GetData}\label{wxvariantgetdata}
254
255\constfunc{wxVariantData*}{GetData}{\void}
256
2562c823
RR
257Returns a pointer to the internal variant data. To take ownership
258of this data, you must call its \helpref{IncRef}{wxvariantdataincref}
259method. When you stop using it, \helpref{DecRef}{wxvariantdatadecref}
260must be likewise called.
a974387a 261
8715d2d3
RN
262\membersection{wxVariant::GetDateTime}\label{wxvariantgetdatetime}
263
264\constfunc{wxDateTime}{GetDateTime}{\void}
265
266Returns the date value.
267
a974387a
JS
268\membersection{wxVariant::GetDouble}\label{wxvariantgetdouble}
269
270\constfunc{double}{GetDouble}{\void}
271
272Returns the floating point value.
273
9a0a58f5
RR
274\membersection{wxVariant::GetList}\label{wxvariantgetlist}
275
276\constfunc{wxVariantList &}{GetList}{\void}
277
278Returns a reference to the wxVariantList class used by
279wxVariant if this wxVariant is currently a list of variants.
280
a974387a
JS
281\membersection{wxVariant::GetLong}\label{wxvariantgetlong}
282
283\constfunc{long}{GetLong}{\void}
284
285Returns the integer value.
286
287\membersection{wxVariant::GetName}\label{wxvariantgetname}
288
289\constfunc{const wxString\&}{GetName}{\void}
290
291Returns a constant reference to the variant name.
292
293\membersection{wxVariant::GetString}\label{wxvariantgetstring}
294
295\constfunc{wxString}{GetString}{\void}
296
297Gets the string value.
298
a974387a
JS
299\membersection{wxVariant::GetType}\label{wxvariantgettype}
300
301\constfunc{wxString}{GetType}{\void}
302
7909f748 303Returns the value type as a string. The built-in types are: bool, char, datetime, double, list, long, string, arrstring, void*.
a974387a
JS
304
305If the variant is null, the value type returned is the string ``null" (not the empty string).
306
307\membersection{wxVariant::GetVoidPtr}\label{wxvariantgetvoidptr}
308
309\constfunc{void*}{GetVoidPtr}{\void}
310
311Gets the void pointer value.
312
cf6ae290
RG
313\membersection{wxVariant::GetWxObjectPtr}\label{wxvariantgetwxobjectptr}
314
cfd5930d 315\constfunc{wxObject*}{GetWxObjectPtr}{\void}
cf6ae290
RG
316
317Gets the wxObject pointer value.
318
a974387a
JS
319\membersection{wxVariant::Insert}\label{wxvariantinsert}
320
321\func{void}{Insert}{\param{const wxVariant\&}{ value}}
322
323Inserts a value at the front of the list.
324
325\membersection{wxVariant::IsNull}\label{wxvariantisnull}
326
327\constfunc{bool}{IsNull}{\void}
328
cc81d32f 329Returns true if there is no data associated with this variant, false if there is data.
a974387a
JS
330
331\membersection{wxVariant::IsType}\label{wxvariantistype}
332
333\constfunc{bool}{IsType}{\param{const wxString\&}{ type}}
334
cc81d32f 335Returns true if {\it type} matches the type of the variant, false otherwise.
a974387a 336
cf6ae290
RG
337\membersection{wxVariant::IsValueKindOf}\label{wxvariantisvaluekindof}
338
339\constfunc{bool}{IsValueKindOf}{\param{const wxClassInfo* type}{ type}}
340
341Returns true if the data is derived from the class described by {\it type}, false otherwise.
342
a974387a
JS
343\membersection{wxVariant::MakeNull}\label{wxvariantmakenull}
344
345\func{void}{MakeNull}{\void}
346
347Makes the variant null by deleting the internal data.
348
349\membersection{wxVariant::MakeString}\label{wxvariantmakestring}
350
351\constfunc{wxString}{MakeString}{\void}
352
353Makes a string representation of the variant value (for any type).
354
355\membersection{wxVariant::Member}\label{wxvariantmember}
356
357\constfunc{bool}{Member}{\param{const wxVariant\&}{ value}}
358
cc81d32f 359Returns true if {\it value} matches an element in the list.
a974387a
JS
360
361\membersection{wxVariant::NullList}\label{wxvariantnulllist}
362
363\func{void}{NullList}{\void}
364
365Makes an empty list. This differs from a null variant which has no data; a null list
366is of type list, but the number of elements in the list is zero.
367
368\membersection{wxVariant::SetData}\label{wxvariantsetdata}
369
370\func{void}{SetData}{\param{wxVariantData*}{ data}}
371
372Sets the internal variant data, deleting the existing data if there is any.
373
c8058a09
JS
374\membersection{wxVariant::Unshare}\label{wxvariantunshare}
375
376\func{bool}{Unshare}{\void}
377
378Makes sure that any data associated with this variant is not shared with other
379variants. For this to work, \helpref{wxVariantData::Clone}{wxvariantdataclone} must
380be implemented for the data types you are working with. Clone is implemented
381for all the default data types.
382
a974387a
JS
383\membersection{wxVariant::operator $=$}\label{wxvariantassignment}
384
385\func{void}{operator $=$}{\param{const wxVariant\& }{value}}
386
387\func{void}{operator $=$}{\param{wxVariantData* }{value}}
388
389\func{void}{operator $=$}{\param{const wxString\& }{value}}
390
38f82bf6 391\func{void}{operator $=$}{\param{const wxChar* }{value}}
a974387a 392
38f82bf6 393\func{void}{operator $=$}{\param{wxChar }{value}}
a974387a
JS
394
395\func{void}{operator $=$}{\param{const long }{value}}
396
397\func{void}{operator $=$}{\param{const bool }{value}}
398
399\func{void}{operator $=$}{\param{const double }{value}}
400
a974387a
JS
401\func{void}{operator $=$}{\param{void* }{value}}
402
2f620946
RR
403\func{void}{operator $=$}{\param{wxObject* }{value}}
404
9a0a58f5 405\func{void}{operator $=$}{\param{const wxVariantList\& }{value}}
a974387a 406
8715d2d3
RN
407\func{void}{operator $=$}{\param{const wxDateTime\& }{value}}
408
409\func{void}{operator $=$}{\param{const wxArrayString\& }{value}}
410
411\func{void}{operator $=$}{\param{const DATE\_STRUCT* }{value}}
412
413\func{void}{operator $=$}{\param{const TIME\_STRUCT* }{value}}
414
415\func{void}{operator $=$}{\param{const TIMESTAMP\_STRUCT* }{value}}
416
631787c4 417Assignment operators, using \helpref{reference counting}{trefcount} when possible.
a974387a
JS
418
419\membersection{wxVariant::operator $==$}\label{wxvarianteq}
420
8715d2d3
RN
421\constfunc{bool}{operator $==$}{\param{const wxVariant\& }{value}}
422
423\constfunc{bool}{operator $==$}{\param{const wxString\& }{value}}
a974387a 424
38f82bf6 425\constfunc{bool}{operator $==$}{\param{const wxChar* }{value}}
a974387a 426
38f82bf6 427\constfunc{bool}{operator $==$}{\param{wxChar }{value}}
a974387a 428
8715d2d3 429\constfunc{bool}{operator $==$}{\param{const long }{value}}
a974387a 430
8715d2d3 431\constfunc{bool}{operator $==$}{\param{const bool }{value}}
a974387a 432
8715d2d3 433\constfunc{bool}{operator $==$}{\param{const double }{value}}
a974387a 434
8715d2d3 435\constfunc{bool}{operator $==$}{\param{void* }{value}}
a974387a 436
2f620946
RR
437\constfunc{bool}{operator $==$}{\param{wxObject* }{value}}
438
9a0a58f5 439\constfunc{bool}{operator $==$}{\param{const wxVariantList\& }{value}}
a974387a 440
8715d2d3
RN
441\constfunc{bool}{operator $==$}{\param{const wxArrayString\& }{value}}
442
443\constfunc{bool}{operator $==$}{\param{const wxDateTime\& }{value}}
a974387a
JS
444
445Equality test operators.
446
447\membersection{wxVariant::operator $!=$}\label{wxvariantneq}
448
8715d2d3
RN
449\constfunc{bool}{operator $!=$}{\param{const wxVariant\& }{value}}
450
451\constfunc{bool}{operator $!=$}{\param{const wxString\& }{value}}
a974387a 452
38f82bf6 453\constfunc{bool}{operator $!=$}{\param{const wxChar* }{value}}
a974387a 454
38f82bf6 455\constfunc{bool}{operator $!=$}{\param{wxChar }{value}}
a974387a 456
8715d2d3 457\constfunc{bool}{operator $!=$}{\param{const long }{value}}
a974387a 458
8715d2d3 459\constfunc{bool}{operator $!=$}{\param{const bool }{value}}
a974387a 460
8715d2d3 461\constfunc{bool}{operator $!=$}{\param{const double }{value}}
a974387a 462
8715d2d3 463\constfunc{bool}{operator $!=$}{\param{void* }{value}}
a974387a 464
2f620946
RR
465\constfunc{bool}{operator $!=$}{\param{wxObject* }{value}}
466
9a0a58f5 467\constfunc{bool}{operator $!=$}{\param{const wxVariantList\& }{value}}
a974387a 468
8715d2d3
RN
469\constfunc{bool}{operator $!=$}{\param{const wxArrayString\& }{value}}
470
471\constfunc{bool}{operator $!=$}{\param{const wxDateTime\& }{value}}
a974387a
JS
472
473Inequality test operators.
474
475\membersection{wxVariant::operator $[]$}\label{wxvariantarray}
476
477\constfunc{wxVariant}{operator $[]$}{\param{size\_t }{idx}}
478
479Returns the value at {\it idx} (zero-based).
480
481\func{wxVariant\&}{operator $[]$}{\param{size\_t }{idx}}
482
483Returns a reference to the value at {\it idx} (zero-based). This can be used
484to change the value at this index.
485
38f82bf6 486\membersection{wxVariant::operator wxChar}\label{wxvariantchar}
a974387a 487
38f82bf6 488\constfunc{char}{operator wxChar}{\void}
a974387a 489
38f82bf6 490Operator for implicit conversion to a wxChar, using \helpref{wxVariant::GetChar}{wxvariantgetchar}.
a974387a
JS
491
492\membersection{wxVariant::operator double}\label{wxvariantdouble}
493
494\constfunc{double}{operator double}{\void}
495
496Operator for implicit conversion to a double, using \helpref{wxVariant::GetDouble}{wxvariantgetdouble}.
497
498\constfunc{long}{operator long}{\void}
499
500Operator for implicit conversion to a long, using \helpref{wxVariant::GetLong}{wxvariantgetlong}.
501
a974387a
JS
502\membersection{wxVariant::operator wxString}\label{wxvariantwxstring}
503
504\constfunc{wxString}{operator wxString}{\void}
505
506Operator for implicit conversion to a string, using \helpref{wxVariant::MakeString}{wxvariantmakestring}.
507
a974387a
JS
508\membersection{wxVariant::operator void*}\label{wxvariantvoid}
509
510\constfunc{void*}{operator void*}{\void}
511
512Operator for implicit conversion to a pointer to a void, using \helpref{wxVariant::GetVoidPtr}{wxvariantgetvoidptr}.
513
8715d2d3
RN
514\membersection{wxVariant::operator wxDateTime}\label{wxvariantdatetime}
515
516\constfunc{void*}{operator wxDateTime}{\void}
517
518Operator for implicit conversion to a pointer to a \helpref{wxDateTime}{wxdatetime}, using \helpref{wxVariant::GetDateTime}{wxvariantgetdatetime}.
519
631787c4
VZ
520
521
522%% wxVariantData
523
524
a974387a
JS
525\section{\class{wxVariantData}}\label{wxvariantdata}
526
631787c4
VZ
527The {\bf wxVariantData} class is used to implement a new type for \helpref{wxVariant}{wxvariant}.
528Derive from wxVariantData, and override the pure virtual functions.
a974387a 529
631787c4
VZ
530wxVariantData is \helpref{reference counted}{refcount}, but you don't normally have to care about this,
531as wxVariant manages the count automatically. However, in case your application needs to take
2562c823
RR
532ownership of wxVariantData, be aware that the object is created with reference count of 1,
533and passing it to wxVariant will not increase this. In other words, \helpref{IncRef}{wxvariantdataincref}
534needs to be called only if you both take ownership of wxVariantData and pass it to a wxVariant.
535Also note that the destructor is protected, so you can never explicitly delete a wxVariantData
536instance. Instead, \helpref{DecRef}{wxvariantdatadecref} will delete the object automatically
537when the reference count reaches zero.
538
954b8ae6
JS
539\wxheading{Include files}
540
541<wx/variant.h>
542
9743a449
RR
543\wxheading{Derived from}
544
545No base class
546
a7af285d
VZ
547\wxheading{Library}
548
549\helpref{wxBase}{librarieslist}
550
a974387a
JS
551\wxheading{See also}
552
553\helpref{wxVariant}{wxvariant}
554
555\latexignore{\rtfignore{\wxheading{Members}}}
556
557\membersection{wxVariantData::wxVariantData}\label{wxvariantdatactor}
558
559\func{}{wxVariantData}{\void}
560
561Default constructor.
562
c8058a09
JS
563\membersection{wxVariantData::Clone}\label{wxvariantdataclone}
564
565\constfunc{wxVariantData*}{Clone}{\void}
566
567This function can be overridden to clone the data.
568Implement Clone if you wish \helpref{wxVariant::Unshare}{wxvariantunshare} to work
569for your data. This function is implemented for all built-in data types.
570
2562c823
RR
571\membersection{wxVariantData::DecRef}\label{wxvariantdatadecref}
572
573\func{void}{DecRef}{\void}
a974387a 574
2562c823
RR
575Decreases reference count. If the count reaches zero, the object is
576automatically deleted.
a974387a 577
2562c823 578Note that destructor of wxVariantData is protected, so delete
631787c4
VZ
579cannot be used as normal. Instead, \helpref{DecRef}{wxvariantdatadecref} should be called.
580
581
a974387a
JS
582\membersection{wxVariantData::Eq}\label{wxvariantdataeq}
583
584\constfunc{bool}{Eq}{\param{wxVariantData\&}{ data}}
585
cc81d32f 586Returns true if this object is equal to {\it data}.
a974387a
JS
587
588\membersection{wxVariantData::GetType}\label{wxvariantdatagettype}
589
590\constfunc{wxString}{GetType}{\void}
591
592Returns the string type of the data.
593
cf6ae290
RG
594\membersection{wxVariantData::GetValueClassInfo}\label{wxvariantdatagetvalueclassinfo}
595
596\constfunc{wxClassInfo*}{GetValueClassInfo}{\void}
597
598If the data is a wxObject returns a pointer to the objects wxClassInfo structure, if
599the data isn't a wxObject the method returns NULL.
600
2562c823
RR
601\membersection{wxVariantData::IncRef}\label{wxvariantdataincref}
602
603\func{void}{IncRef}{\void}
604
605Increases reference count. Note that initially wxVariantData has reference count of 1.
606
a974387a
JS
607\membersection{wxVariantData::Read}\label{wxvariantdataread}
608
609\func{bool}{Read}{\param{ostream\&}{ stream}}
610
611\func{bool}{Read}{\param{wxString\&}{ string}}
612
613Reads the data from {\it stream} or {\it string}.
614
615\membersection{wxVariantData::Write}\label{wxvariantdatawrite}
616
617\constfunc{bool}{Write}{\param{ostream\&}{ stream}}
618
619\constfunc{bool}{Write}{\param{wxString\&}{ string}}
620
621Writes the data to {\it stream} or {\it string}.
622
623
cf6ae290
RG
624\membersection{wxGetVariantCast}\label{wxgetvariantcast}
625
626\func{classname *}{wxGetVariantCast}{wxVariant\&, classname}
627
628This macro returns the data stored in {\it variant} cast to the type {\it classname *} if
629the data is of this type (the check is done during the run-time) or
43f06cfd 630{\tt NULL} otherwise.
cf6ae290
RG
631
632
633\wxheading{See also}
a974387a 634
cf6ae290 635\helpref{RTTI overview}{runtimeclassoverview}\\
0497e172 636\helpref{wxDynamicCast}{wxdynamiccast}
b67a86d5 637