Version: 3.1.2
dynarray.h File Reference

Classes

class  wxArray< T >
 The legacy dynamic array class, existing for compatibility only and NOT to be used in the new code. More...
 

Macros

#define WX_APPEND_ARRAY(wxArray_arrayToModify, wxArray_arrayToBeAppended)
 This macro may be used to append all elements of the wxArray_arrayToBeAppended array to the wxArray_arrayToModify. More...
 
#define WX_CLEAR_ARRAY(wxArray_arrayToBeCleared)
 This macro may be used to delete all elements of the array before emptying it. More...
 
#define WX_PREPEND_ARRAY(wxArray_arrayToModify, wxArray_arrayToBePrepended)
 This macro may be used to prepend all elements of the wxArray_arrayToBePrepended array to the wxArray_arrayToModify. More...
 
#define WX_DECLARE_OBJARRAY(T, name)
 This macro declares a new object array class named name and containing the elements of type T. More...
 
#define WX_DECLARE_EXPORTED_OBJARRAY(T, name)
 This macro declares a new object array class named name and containing the elements of type T. More...
 
#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode)
 This macro declares a new object array class named name and containing the elements of type T. More...
 
#define WX_DEFINE_ARRAY(T, name)
 This macro defines a new array class named name and containing the elements of type T. More...
 
#define WX_DEFINE_EXPORTED_ARRAY(T, name)
 This macro defines a new array class named name and containing the elements of type T. More...
 
#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, exportspec)
 This macro defines a new array class named name and containing the elements of type T. More...
 
#define WX_DEFINE_OBJARRAY(name)
 This macro defines the methods of the array class name not defined by the WX_DECLARE_OBJARRAY() macro. More...
 
#define WX_DEFINE_EXPORTED_OBJARRAY(name)
 This macro defines the methods of the array class name not defined by the WX_DECLARE_OBJARRAY() macro. More...
 
#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name)
 This macro defines the methods of the array class name not defined by the WX_DECLARE_OBJARRAY() macro. More...
 
#define WX_DEFINE_SORTED_ARRAY(T, name)
 This macro defines a new sorted array class named name and containing the elements of type T. More...
 
#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name)
 This macro defines a new sorted array class named name and containing the elements of type T. More...
 
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode)
 This macro defines a new sorted array class named name and containing the elements of type T. More...
 

Typedefs

typedef wxArray< int > wxArrayInt
 Predefined specialization of wxArray<T> for standard types. More...
 
typedef wxArray< long > wxArrayLong
 Predefined specialization of wxArray<T> for standard types. More...
 
typedef wxArray< short > wxArrayShort
 Predefined specialization of wxArray<T> for standard types. More...
 
typedef wxArray< double > wxArrayDouble
 Predefined specialization of wxArray<T> for standard types. More...
 
typedef wxArray< void * > wxArrayPtrVoid
 Predefined specialization of wxArray<T> for standard types. More...
 

Macro Definition Documentation

#define WX_APPEND_ARRAY (   wxArray_arrayToModify,
  wxArray_arrayToBeAppended 
)

This macro may be used to append all elements of the wxArray_arrayToBeAppended array to the wxArray_arrayToModify.

The two arrays must be of the same type.

#define WX_CLEAR_ARRAY (   wxArray_arrayToBeCleared)

This macro may be used to delete all elements of the array before emptying it.

It cannot be used with wxObjArrays - but they will delete their elements anyway when you call Empty().

#define WX_DECLARE_EXPORTED_OBJARRAY (   T,
  name 
)

This macro declares a new object array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 class MyClass;
2 WX_DECLARE_OBJARRAY(MyClass, wxArrayOfMyClass); // note: not "MyClass *"!

You must use WX_DEFINE_OBJARRAY() macro to define the array class, otherwise you would get link errors.

#define WX_DECLARE_OBJARRAY (   T,
  name 
)

This macro declares a new object array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 class MyClass;
2 WX_DECLARE_OBJARRAY(MyClass, wxArrayOfMyClass); // note: not "MyClass *"!

You must use WX_DEFINE_OBJARRAY() macro to define the array class, otherwise you would get link errors.

#define WX_DECLARE_USER_EXPORTED_OBJARRAY (   T,
  name,
  expmode 
)

This macro declares a new object array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 class MyClass;
2 WX_DECLARE_OBJARRAY(MyClass, wxArrayOfMyClass); // note: not "MyClass *"!

You must use WX_DEFINE_OBJARRAY() macro to define the array class, otherwise you would get link errors.

#define WX_DEFINE_ARRAY (   T,
  name 
)

This macro defines a new array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 WX_DEFINE_ARRAY_INT(int, MyArrayInt);
2 
3 class MyClass;
4 WX_DEFINE_ARRAY(MyClass *, ArrayOfMyClass);

Note that wxWidgets predefines the following standard array classes: wxArrayInt, wxArrayLong, wxArrayShort, wxArrayDouble, wxArrayPtrVoid.

#define WX_DEFINE_EXPORTED_ARRAY (   T,
  name 
)

This macro defines a new array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 WX_DEFINE_ARRAY_INT(int, MyArrayInt);
2 
3 class MyClass;
4 WX_DEFINE_ARRAY(MyClass *, ArrayOfMyClass);

Note that wxWidgets predefines the following standard array classes: wxArrayInt, wxArrayLong, wxArrayShort, wxArrayDouble, wxArrayPtrVoid.

#define WX_DEFINE_EXPORTED_OBJARRAY (   name)

This macro defines the methods of the array class name not defined by the WX_DECLARE_OBJARRAY() macro.

You must include the file <wx/arrimpl.cpp> before using this macro and you must have the full declaration of the class of array elements in scope! If you forget to do the first, the error will be caught by the compiler, but, unfortunately, many compilers will not give any warnings if you forget to do the second - but the objects of the class will not be copied correctly and their real destructor will not be called.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example of usage:

1 // first declare the class!
2 class MyClass
3 {
4 public:
5  MyClass(const MyClass&);
6 
7  // ...
8 
9  virtual ~MyClass();
10 };
11 
12 #include <wx/arrimpl.cpp>
13 WX_DEFINE_OBJARRAY(wxArrayOfMyClass);
#define WX_DEFINE_OBJARRAY (   name)

This macro defines the methods of the array class name not defined by the WX_DECLARE_OBJARRAY() macro.

You must include the file <wx/arrimpl.cpp> before using this macro and you must have the full declaration of the class of array elements in scope! If you forget to do the first, the error will be caught by the compiler, but, unfortunately, many compilers will not give any warnings if you forget to do the second - but the objects of the class will not be copied correctly and their real destructor will not be called.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example of usage:

1 // first declare the class!
2 class MyClass
3 {
4 public:
5  MyClass(const MyClass&);
6 
7  // ...
8 
9  virtual ~MyClass();
10 };
11 
12 #include <wx/arrimpl.cpp>
13 WX_DEFINE_OBJARRAY(wxArrayOfMyClass);
#define WX_DEFINE_SORTED_ARRAY (   T,
  name 
)

This macro defines a new sorted array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 WX_DEFINE_SORTED_ARRAY_INT(int, MySortedArrayInt);
2 
3 class MyClass;
4 WX_DEFINE_SORTED_ARRAY(MyClass *, ArrayOfMyClass);

You will have to initialize the objects of this class by passing a comparison function to the array object constructor like this:

1 int CompareInts(int n1, int n2)
2 {
3  return n1 - n2;
4 }
5 
6 MySortedArrayInt sorted(CompareInts);
7 
8 int CompareMyClassObjects(MyClass *item1, MyClass *item2)
9 {
10  // sort the items by their address...
11  return Stricmp(item1->GetAddress(), item2->GetAddress());
12 }
13 
14 ArrayOfMyClass another(CompareMyClassObjects);
#define WX_DEFINE_SORTED_EXPORTED_ARRAY (   T,
  name 
)

This macro defines a new sorted array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 WX_DEFINE_SORTED_ARRAY_INT(int, MySortedArrayInt);
2 
3 class MyClass;
4 WX_DEFINE_SORTED_ARRAY(MyClass *, ArrayOfMyClass);

You will have to initialize the objects of this class by passing a comparison function to the array object constructor like this:

1 int CompareInts(int n1, int n2)
2 {
3  return n1 - n2;
4 }
5 
6 MySortedArrayInt sorted(CompareInts);
7 
8 int CompareMyClassObjects(MyClass *item1, MyClass *item2)
9 {
10  // sort the items by their address...
11  return Stricmp(item1->GetAddress(), item2->GetAddress());
12 }
13 
14 ArrayOfMyClass another(CompareMyClassObjects);
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY (   T,
  name,
  expmode 
)

This macro defines a new sorted array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 WX_DEFINE_SORTED_ARRAY_INT(int, MySortedArrayInt);
2 
3 class MyClass;
4 WX_DEFINE_SORTED_ARRAY(MyClass *, ArrayOfMyClass);

You will have to initialize the objects of this class by passing a comparison function to the array object constructor like this:

1 int CompareInts(int n1, int n2)
2 {
3  return n1 - n2;
4 }
5 
6 MySortedArrayInt sorted(CompareInts);
7 
8 int CompareMyClassObjects(MyClass *item1, MyClass *item2)
9 {
10  // sort the items by their address...
11  return Stricmp(item1->GetAddress(), item2->GetAddress());
12 }
13 
14 ArrayOfMyClass another(CompareMyClassObjects);
#define WX_DEFINE_USER_EXPORTED_ARRAY (   T,
  name,
  exportspec 
)

This macro defines a new array class named name and containing the elements of type T.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example:

1 WX_DEFINE_ARRAY_INT(int, MyArrayInt);
2 
3 class MyClass;
4 WX_DEFINE_ARRAY(MyClass *, ArrayOfMyClass);

Note that wxWidgets predefines the following standard array classes: wxArrayInt, wxArrayLong, wxArrayShort, wxArrayDouble, wxArrayPtrVoid.

#define WX_DEFINE_USER_EXPORTED_OBJARRAY (   name)

This macro defines the methods of the array class name not defined by the WX_DECLARE_OBJARRAY() macro.

You must include the file <wx/arrimpl.cpp> before using this macro and you must have the full declaration of the class of array elements in scope! If you forget to do the first, the error will be caught by the compiler, but, unfortunately, many compilers will not give any warnings if you forget to do the second - but the objects of the class will not be copied correctly and their real destructor will not be called.

An exported array is used when compiling wxWidgets as a DLL under Windows and the array needs to be visible outside the DLL. An user exported array needed for exporting an array from a user DLL.

Example of usage:

1 // first declare the class!
2 class MyClass
3 {
4 public:
5  MyClass(const MyClass&);
6 
7  // ...
8 
9  virtual ~MyClass();
10 };
11 
12 #include <wx/arrimpl.cpp>
13 WX_DEFINE_OBJARRAY(wxArrayOfMyClass);
#define WX_PREPEND_ARRAY (   wxArray_arrayToModify,
  wxArray_arrayToBePrepended 
)

This macro may be used to prepend all elements of the wxArray_arrayToBePrepended array to the wxArray_arrayToModify.

The two arrays must be of the same type.

Typedef Documentation

typedef wxArray<double> wxArrayDouble

Predefined specialization of wxArray<T> for standard types.

typedef wxArray<int> wxArrayInt

Predefined specialization of wxArray<T> for standard types.

typedef wxArray<long> wxArrayLong

Predefined specialization of wxArray<T> for standard types.

typedef wxArray<void*> wxArrayPtrVoid

Predefined specialization of wxArray<T> for standard types.

typedef wxArray<short> wxArrayShort

Predefined specialization of wxArray<T> for standard types.