dillo  3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java).
  Fossies Dox: dillo-3.0.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

lout::container::untyped::Vector Class Reference

Container, which is implemented by an array, which is dynamically resized. More...

#include <container.hh>

Inheritance diagram for lout::container::untyped::Vector:
[legend]
Collaboration diagram for lout::container::untyped::Vector:
[legend]

Classes

class  VectorIterator
 

Public Member Functions

 Vector (int initSize, bool ownerOfObjects)
 
 ~Vector ()
 
void put (object::Object *newElement, int newPos=-1)
 
void insert (object::Object *newElement, int pos)
 
void insertSorted (object::Object *newElement)
 Insert into an already sorted vector. More...
 
void remove (int pos)
 
object::Objectget (int pos) const
 
int size ()
 
void clear ()
 
void sort ()
 
int bsearch (Object *key, bool mustExist)
 Use binary search to find an element in a sorted vector. More...
 
- Public Member Functions inherited from lout::container::untyped::Collection
void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer. More...
 
Iterator iterator ()
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. More...
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal. More...
 
virtual int hashValue ()
 Return a hash value for the object. More...
 
virtual Objectclone ()
 Return an exact copy of the object. More...
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object. More...
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses. More...
 

Protected Member Functions

AbstractIteratorcreateIterator ()
 

Private Attributes

object::Object ** array
 
int numAlloc
 
int numElements
 
bool ownerOfObjects
 

Friends

class VectorIterator
 

Detailed Description

Container, which is implemented by an array, which is dynamically resized.

Definition at line 103 of file container.hh.

Constructor & Destructor Documentation

◆ Vector()

lout::container::untyped::Vector::Vector ( int  initSize,
bool  ownerOfObjects 
)

Definition at line 104 of file container.cc.

◆ ~Vector()

lout::container::untyped::Vector::~Vector ( )

Definition at line 112 of file container.cc.

Member Function Documentation

◆ bsearch()

int lout::container::untyped::Vector::bsearch ( Object key,
bool  mustExist 
)

Use binary search to find an element in a sorted vector.

If "mustExist" is true, only exact matches are found; otherwise, -1 is returned. If it is false, the position of the next greater element is returned, or, if the key is the greatest element, the size of the array. (This is the value which can be used for insertion; see insertSortet()).

Definition at line 205 of file container.cc.

Referenced by insertSorted().

◆ clear()

void lout::container::untyped::Vector::clear ( )

Definition at line 146 of file container.cc.

◆ createIterator()

Collection0::AbstractIterator * lout::container::untyped::Vector::createIterator ( )
protectedvirtual

Implements lout::container::untyped::Collection0.

Definition at line 258 of file container.cc.

◆ get()

object::Object* lout::container::untyped::Vector::get ( int  pos) const
inline

Definition at line 144 of file container.hh.

References array, and numElements.

◆ insert()

void lout::container::untyped::Vector::insert ( object::Object newElement,
int  pos 
)

Definition at line 157 of file container.cc.

Referenced by insertSorted().

◆ insertSorted()

void lout::container::untyped::Vector::insertSorted ( object::Object newElement)
inline

Insert into an already sorted vector.

Notice that insertion is not very efficient, unless the position is rather at the end.

Definition at line 140 of file container.hh.

References bsearch(), and insert().

◆ put()

void lout::container::untyped::Vector::put ( object::Object newElement,
int  newPos = -1 
)

Definition at line 118 of file container.cc.

◆ remove()

void lout::container::untyped::Vector::remove ( int  pos)

Definition at line 177 of file container.cc.

◆ size()

int lout::container::untyped::Vector::size ( )
inline

Definition at line 146 of file container.hh.

References numElements.

◆ sort()

void lout::container::untyped::Vector::sort ( )

Sort the elements in the vector. Assumes that all elements are Comparable's.

Definition at line 191 of file container.cc.

References lout::object::Comparable::compareFun().

Friends And Related Function Documentation

◆ VectorIterator

friend class VectorIterator
friend

Definition at line 105 of file container.hh.

Member Data Documentation

◆ array

object::Object** lout::container::untyped::Vector::array
private

Definition at line 108 of file container.hh.

Referenced by get().

◆ numAlloc

int lout::container::untyped::Vector::numAlloc
private

Definition at line 109 of file container.hh.

◆ numElements

int lout::container::untyped::Vector::numElements
private

Definition at line 109 of file container.hh.

Referenced by get(), and size().

◆ ownerOfObjects

bool lout::container::untyped::Vector::ownerOfObjects
private

Definition at line 110 of file container.hh.


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