Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Q3PtrQueue Class Reference
[Qt3Support module]

The Q3PtrQueue class is a template class that provides a queue. More...

#include <Q3PtrQueue>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits Q3PtrCollection.

Public Functions

Protected Functions

  • virtual QDataStream & read ( QDataStream & s, Q3PtrCollection::Item & item )
  • virtual QDataStream & write ( QDataStream & s, Q3PtrCollection::Item item ) const

Detailed Description

The Q3PtrQueue class is a template class that provides a queue.

Q3ValueVector can be used as an STL-compatible alternative to this class.

A template instance Q3PtrQueue<X> is a queue that operates on pointers to X (X*).

A queue is a first in, first out structure. Items are added to the tail of the queue with enqueue() and retrieved from the head with dequeue(). You can peek at the head item without dequeing it using head().

You can control the queue's deletion policy with setAutoDelete().

For compatibility with the Q3PtrCollection classes, current() and remove() are provided; both operate on the head().

See also Q3PtrList and Q3PtrStack.


Member Function Documentation

Q3PtrQueue::Q3PtrQueue ()

Creates an empty queue with autoDelete() set to FALSE.

Q3PtrQueue::Q3PtrQueue ( const Q3PtrQueue<type> & queue )

Creates a queue from queue.

Only the pointers are copied; the items are not. The autoDelete() flag is set to FALSE.

Q3PtrQueue::~Q3PtrQueue ()

Destroys the queue. Items in the queue are deleted if autoDelete() is TRUE.

bool Q3PtrQueue::autoDelete () const

Returns the setting of the auto-delete option. The default is FALSE.

See also setAutoDelete().

void Q3PtrQueue::clear ()   [virtual]

Removes all items from the queue, and deletes them if autoDelete() is TRUE.

Reimplemented from Q3PtrCollection.

See also remove().

uint Q3PtrQueue::count () const   [virtual]

Returns the number of items in the queue.

Reimplemented from Q3PtrCollection.

See also isEmpty().

type * Q3PtrQueue::current () const

Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.

See also dequeue() and isEmpty().

type * Q3PtrQueue::dequeue ()

Takes the head item from the queue and returns a pointer to it. Returns 0 if the queue is empty.

See also enqueue() and count().

void Q3PtrQueue::enqueue ( const type * d )

Adds item d to the tail of the queue.

See also count() and dequeue().

type * Q3PtrQueue::head () const

Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.

See also dequeue() and isEmpty().

bool Q3PtrQueue::isEmpty () const

Returns TRUE if the queue is empty; otherwise returns FALSE.

See also count(), dequeue(), and head().

QDataStream & Q3PtrQueue::read ( QDataStream & s, Q3PtrCollection::Item & item )   [virtual protected]

Reads a queue item, item, from the stream s and returns a reference to the stream.

The default implementation sets item to 0.

See also write().

bool Q3PtrQueue::remove ()

Removes the head item from the queue, and returns TRUE if there was an item, i.e. the queue wasn't empty; otherwise returns FALSE.

The item is deleted if autoDelete() is TRUE.

See also head(), isEmpty(), and dequeue().

void Q3PtrQueue::setAutoDelete ( bool enable )

Sets the queue to auto-delete its contents if enable is TRUE and not to delete them if enable is FALSE.

If auto-deleting is turned on, all the items in a queue are deleted when the queue itself is deleted. This can be quite convenient if the queue has the only pointer to the items.

The default setting is FALSE, for safety. If you turn it on, be careful about copying the queue: you might find yourself with two queues deleting the same items.

See also autoDelete().

QDataStream & Q3PtrQueue::write ( QDataStream & s, Q3PtrCollection::Item item ) const   [virtual protected]

Writes a queue item, item, to the stream s and returns a reference to the stream.

The default implementation does nothing.

See also read().

Q3PtrQueue::operator type * () const

Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.

See also dequeue() and isEmpty().

Q3PtrQueue<type> & Q3PtrQueue::operator= ( const Q3PtrQueue<type> & queue )

Assigns queue to this queue and returns a reference to this queue.

This queue is first cleared and then each item in queue is enqueued to this queue. Only the pointers are copied.

Warning: The autoDelete() flag is not modified. If it it TRUE for both queue and this queue, deleting the two lists will cause double-deletion of the items.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.1
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web