# Array Class Reference

A list based Array. More...

`#include <yateclass.h>`

Inheritance diagram for Array:

List of all members.

## Public Member Functions

| Array (int columns=0, int rows=0)
virtual | ~Array ()
virtual void * | getObject (const String &name) const
bool | addRow (ObjList *row=0, int index=-1)
bool | addColumn (ObjList *column=0, int index=-1)
bool | delRow (int index)
bool | delColumn (int index)
GenObject * | get (int column, int row) const
bool | set (GenObject *obj, int column, int row)
int | getRows () const
int | getColumns () const

## Detailed Description

A list based Array.

A simple Array class derivated from RefObject It uses one ObjList to keep the pointers to other ObjList's. Data is organized in columns - the main ObjList holds pointers to one ObjList for each column. This class has been written by Diana

## Constructor & Destructor Documentation

Array | ( | int | columns = `0`,
|  | int | rows = `0` |
| ) |  |  |

Creates a new empty array.

Parameters:

  | columns | Initial number of columns
  | rows | Initial number of rows

virtual ~Array | ( |  | ) | `[virtual]`

Destructor. Destructs all objects in the array

## Member Function Documentation

virtual void* getObject | ( | const String & | name | ) | const`[virtual]`

Get a pointer to a derived class given that class name

Parameters:

  | name | Name of the class we are asking for

Returns:
  Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from GenObject.

bool addRow | ( | ObjList * | row = `0`,
|  | int | index = `-1` |
| ) |  |  |

Insert a row of objects

Parameters:

  | row | List of objects to insert or NULL
  | index | Number of the row to insert before, negative to append

Returns:
  True for success, false if index was larger than the array

bool addColumn | ( | ObjList * | column = `0`,
|  | int | index = `-1` |
| ) |  |  |

Insert a column of objects

Parameters:

  | column | List of objects to insert or NULL
  | index | Number of the column to insert before, negative to append

Returns:
  True for success, false if index was larger than the array

bool delRow | ( | int | index | ) |

Delete an entire row of objects

Parameters:

  | index | Number of the row to delete

Returns:
  True for success, false if index was out of bounds

bool delColumn | ( | int | index | ) |

Delete an entire column of objects

Parameters:

  | index | Number of the column to delete

Returns:
  True for success, false if index was out of bounds

GenObject* get | ( | int | column,
|  | int | row |
| ) |  |  | const

Retrive an object from the array

Parameters:

  | column | Number of the column in the array
  | row | Number of the row in the array

Returns:
  Pointer to the stored object, NULL for out of bound indexes

bool set | ( | GenObject * | obj,
|  | int | column,
|  | int | row |
| ) |  |  |

Store an object in the array

Parameters:

  | obj | Object to store in the array
  | column | Number of the column in the array
  | row | Number of the row in the array

Returns:
  True for success, false if indexes were out of bounds

int getRows | ( |  | ) | const`[inline]`

Get the number of rows in the array

Returns:
  Total number of rows

int getColumns | ( |  | ) | const`[inline]`

Get the number of columns in the array

Returns:
  Total number of columns

The documentation for this class was generated from the following file:

- yateclass.h