QStack(3qt)

QStack3qt

Template class that provides a stack #include <qstack.h>

Overview

The QStack class is a template class that provides a stack.

QStack is implemented as a template class. Define a template instance QStack<X> to create a stack that operates on pointers to X, or X*.

A stack is a Last In, First Out (LIFO) structure. Items are added to the top of the stack with push() and retrieved from the top with pop().

See also Collection Classes

Member function documentation

QStack::QStack ()

Creates and empty stack.

QStack::QStack ( const QStack<type> & s )

Creates a stack by making a shallow copy of another stack.

QStack::~QStack ()

Destroys the stack. All items will be deleted if autoDelete() is TRUE.

QStack::operator type* () const

Returns a reference to the top item on the stack (most recently pushed). The stack is not changed.

bool QStack::autoDelete () const

The same as QCollection::autoDelete().

See also setAutoDelete().

void QStack::clear () [virtual]

Removes all items from the stack, deleting them if autoDelete() is TRUE.

See also remove().

Reimplemented from QCollection.

uint QStack::count () const [virtual]

Returns the number of items in the stack.

See also isEmpty().

Reimplemented from QCollection.

type* QStack::current () const

Returns a reference to the top item on the stack (most recently pushed). The stack is not changed.

bool QStack::isEmpty () const

Returns TRUE is the stack contains no elements to be popped

QStack<type>& QStack::operator= ( const QStack<type> & s )

Sets the contents of this stack by making a shallow copy of another stack. Elements currently in this stack will be deleted if autoDelete() is TRUE.

type* QStack::pop ()

Removes the top item from the stack and returns it.

void QStack::push ( const type * d )

Adds an element to the top of the stack. Last in, first out.

bool QStack::remove ()

Removes the top item from the stack and deletes it if autoDelete() is TRUE. Returns TRUE if there was an item to pop.

See also clear().

void QStack::setAutoDelete ( bool enable )

The same as QCollection::setAutoDelete().

See also autoDelete().

type* QStack::top () const

Returns a reference to the top item on the stack (most recently pushed). The stack is not changed.

Releases

2 releases since Debian 2.2 (Potato); the text changed 1 time.

  1. 2.2
  2. 3.0

Author

Generated automatically from the source code.

Bugs

If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to [email protected]. Please include the name of the manual page (qstack.3qt) and the Qt version (2.3.1).

From qt-doc 3:2.3.1-22 in Debian 3.0 (Woody). Also shipped by qt-emb-doc. Parsed by carta from the page's man source.