![]()
|
TOP --> libjdl
Defines a simple vector container class. This class does not own its objects. Here is a simple example that shows how to use this class. CJdlVector<int> v; for(int i=0;i<10;i++) { v[i] = i; cout << v[i] << endl; } // These are all the same. cout << v.GetNumItems() << endl; cout << v.Size() << endl; cout << v.Length() << endl;
public CJdlVector ( ) ; Default constructor. Assumes a default size of 8. public CJdlVector ( uint size ) ; Constructor.
public CJdlVector ( const CJdlVector < T > & obj ) ; Copy constructor.
public ~ CJdlVector ( ) ; Destructor. public void Clear ( ) ; Clear the list. public void Resize ( uint ) ; Resize the list.
public void Copy ( const CJdlVector < T > & ) ; Copy another list to this one. public uint GetNumItems ( ) const ; Return the number of items in the list.
public uint Length ( ) const ; Return the number of items in the list.
public uint Size ( ) const ; Return the number of items in the list.
public bool IsEmpty ( ) const ; Is the list empty?
public uint MaxLength ( ) const ; Return the maximum number of items that can be stored in the list.
public void Append ( T & obj ) ; Append an item to the list. If the list is not large enough, it is automatically increased to accomodate the new object.
public void Append ( const CJdlVector < T > & list ) ; Append another list to the list. If the list is not large enough, it is automatically increased to accomodate the new objects.
public void InsertBefore ( uint idx , T & obj ) ; Insert item before the specified item in the list.
public void InsertAfter ( uint idx , T & obj ) ; Insert item after the specified item in the list.
public T & Get ( uint i ) const ; Get the i-th item. An assertion is raised if the index is out of bounds
public T & operator [ ] ( uint i ) ; Get the i-th item (lhs & rhs). If the array is not large enough it is grown.
public void Set ( uint i , T val ) ; Set the i-th item. Grow the list if necessary.
public CJdlVector < T > & operator = ( const CJdlVector < T > & obj ) ; Copy operator.
public CJdlVector < T > & operator += ( T & val ) ; Append to the list.
public void Grow ( uint sz ) ; Grow the list to the specified size. This is used internally by the append and set methods.
This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to return to the top of the page. |