CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

sarray.h File Reference

More...

Go to the source code of this file.

Compounds

class  csStaticArray
 Helper class for CS_DECLARE_STATIC_ARRAY. More...


Defines

#define CS_DECLARE_STATIC_ARRAY(Name, Type)   CS_PRIVATE_DECLARE_STATIC_ARRAY (Name, Type)


Detailed Description

Definition in file sarray.h.


Define Documentation

#define CS_DECLARE_STATIC_ARRAY Name,
Type       CS_PRIVATE_DECLARE_STATIC_ARRAY (Name, Type)
 

Deprecated:
This class will be removed very soon Create a static array class (descending from csStaticArray) with the given name that contains elements of the given type.

Definition at line 34 of file sarray.h.

#define CS_PRIVATE_DECLARE_STATIC_ARRAY Name,
Type   
 

Value:

class Name : public csStaticArray                                       \
{                                                                       \
  typedef Type cont_type;                                               \
private:                                                                \
  void *AllocateArray (int n) const {return new cont_type[n];}          \
  void DeleteArray (void *a) const {delete[] ((cont_type*)a);}          \
  void CopyArray (void *Dest, void *Src, int n) const                   \
    {memcpy (Dest, Src, n*sizeof (cont_type)); }                        \
public:                                                                 \
  inline Name (int Size = 0) :                                          \
    csStaticArray (Size) {}                                             \
  virtual ~Name ()                                                       \
  { Clear (); }                                                         \
  inline cont_type *GetArray ()                                         \
    { return (cont_type*)Map; }                                         \
  inline const cont_type *GetArray () const                             \
    { return (cont_type*)Map; }                                         \
  inline void Copy (cont_type *NewData, int NewSize, bool DeleteOld = true)     \
    { csStaticArray::Copy (NewData, NewSize, DeleteOld); }              \
  inline void Copy (const Name *other, bool DeleteOld = true)           \
    { csStaticArray::Copy (other, DeleteOld); }                         \
  inline void TakeOver (cont_type *NewData, int NewSize, bool DeleteOld = true) \
    { csStaticArray::TakeOver (NewData, NewSize, DeleteOld); }          \
  inline void TakeOver (Name *other, bool DeleteOld = true)             \
    { csStaticArray::TakeOver (other, DeleteOld); }                     \
  inline cont_type &operator[] (int n)                                  \
    { return GetArray () [n]; }                                         \
  inline const cont_type &operator[] (int n) const                      \
    { return GetArray () [n]; }                                         \
}

Definition at line 101 of file sarray.h.


Generated for Crystal Space by doxygen 1.2.14