QPtrStack(3qt)
π QPtrStack(3qt) β bestie edition π
okay so welcome to the QPtrStack(3qt) manual page, and babes, we are about to get so organized. this is from the Qt 3 era, it's giving vintage, it's giving legendary, and it's honestly so much simpler than it looks. grab a strawberry π and let's go.
β¨ NAME β¨
QPtrStack β a template class that provides a stack π
π SYNOPSIS π
#include <qptrstack.h>
π Public Members
QPtrStack ()
QPtrStack ( const QPtrStack<type> & s )
~QPtrStack ()
QPtrStack<type> & operator= ( const QPtrStack<type> & s )
bool autoDelete () const
void setAutoDelete ( bool enable )
uint count () const
bool isEmpty () const
void push ( const type * d )
type * pop ()
bool remove ()
void clear ()
type * top () const
operator type * () const
type * current () const
π§ Protected Members
virtual QDataStream & read ( QDataStream & s, QPtrCollection::Item &
item )
virtual QDataStream & write ( QDataStream & s, QPtrCollection::Item item
) const
π¦ DESCRIPTION π¦
so the QPtrStack class is a template class that provides a stack. that's the whole vibe. πΈ
QValueStack is an STL-compatible alternative to this class β just so you know your options, bestie.
you define a template instance QPtrStack<X> to create a stack that operates on pointers to X, (X*).
a stack is a last in, first out (LIFO) structure. think of it like a stack of pancakes π₯ β the last one you put on top is the first one you grab. items get added to the top of the stack with push() and retrieved from the top with pop(). use top() to get a reference to the top element without changing the stack β like peeking, not touching. π
you can control the stack's deletion policy with setAutoDelete().
for compatibility with the QPtrCollection classes, current() and remove() are provided; they both operate on the top().
See alsoQPtrList,QPtrQueue, and Non-GUI Classes.
π MEMBER FUNCTION DOCUMENTATION π
QPtrStack::QPtrStack ()
creates an empty stack. blank slate, main character energy, nothing in it yet. β¨
QPtrStack::QPtrStack ( const QPtrStack<type> & s )
creates a stack by making a shallow copy of another stack s. (shallow, not deep β we're copying the pointers, not duplicating the whole world. no cap.)
QPtrStack::~QPtrStack ()
destroys the stack. all items will be deleted if autoDelete() is TRUE. π so like, know your settings before you let this one go.
bool QPtrStack::autoDelete () const
the same as QPtrCollection::autoDelete().
See also setAutoDelete().
void QPtrStack::clear ()
removes all items from the stack, deleting them if autoDelete() is TRUE. poof. gone. π«Ά
See also remove().
uint QPtrStack::count () const
returns the number of items in the stack. the headcount, the census, the "how many besties are in the group chat" number. π
See also isEmpty().
type * QPtrStack::current () const
returns a pointer to the top item on the stack (most recently pushed). the stack is not changed. returns 0 if the stack is empty.
bool QPtrStack::isEmpty () const
returns TRUE if the stack contains no elements; otherwise returns FALSE. vibe check: is it empty or not. π΅οΈββοΈ
QPtrStack::operator type * () const
returns a pointer to the top item on the stack (most recently pushed). the stack is not changed. returns 0 if the stack is empty. (yes, same energy as top() and current() β it's a whole family. π)
QPtrStack<type> & QPtrStack::operator= ( const QPtrStack<type> & s )
sets the contents of this stack by making a shallow copy of another stack s. elements currently in this stack will be deleted if autoDelete() is TRUE. β οΈ so like, that's destructive, be aware.
type * QPtrStack::pop ()
removes the top item from the stack and returns it. π₯
the stack must not be empty. fr fr, don't do that.
void QPtrStack::push ( const type * d )
adds an element d to the top of the stack. last in, first out. iconic behavior honestly. π
QDataStream & QPtrStack::read ( QDataStream & s, QPtrCollection::Item & item )
[virtual protected]
reads a stack item, item, from the stream s and returns a reference to the stream.
the default implementation sets item to 0.
See also write().
bool QPtrStack::remove ()
removes the top item from the stack and deletes it if autoDelete() is TRUE. returns TRUE if there was an item to pop; otherwise returns FALSE.
See also clear().
void QPtrStack::setAutoDelete ( bool enable )
defines whether this stack auto-deletes its contents. the same as QPtrCollection::setAutoDelete().
if enable is TRUE the stack auto-deletes its contents; if enable is FALSE the stack does not delete its contents.
See also autoDelete().
type * QPtrStack::top () const
returns a pointer to the top item on the stack (most recently pushed). the stack is not changed. returns 0 if the stack is empty.
QDataStream & QPtrStack::write ( QDataStream & s, QPtrCollection::Item item ) const
[virtual protected]
writes a stack item, item, to the stream s and returns a reference to the stream.
the default implementation does nothing.
See also read().
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
π AUTHOR π
Generated automatically from the source code. (yes, the author is literally a machine. slay, i guess. π€β¨)
π BUGS π
if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. π«Ά
the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qptrstack.3qt) and the Qt version (3.3.8). π
okay bestie that's the whole page, you ate that. this came to you from Trolltech AS, dated 2 February 2007, from the Qt 3.3.8 era β like, ancient history but still lowkey iconic. now go push something. π ππ
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms