JX Application Framework
|
#include <JStack.h>
Public Member Functions | |
JStack () | |
JStack (const JStack< T, S > &source) | |
~JStack () override | |
JStack< T, S > & | operator= (const JStack< T, S > &source) |
void | Push (const T &newElement) |
T | Pop () |
bool | Pop (T *element) |
T | Peek () const |
bool | Peek (T *element) const |
T | Peek (const JIndex index) const |
bool | Peek (const JIndex index, T *element) const |
void | Clear () |
void | Unwind (const JSize numToUnwind) |
JListIterator< T > * | NewIterator () |
JListIterator< T > * | NewIterator () const |
![]() | |
JContainer () | |
JContainer (const JContainer &source) | |
JContainer & | operator= (const JContainer &source) |
![]() | |
JCollection () | |
JCollection (const JCollection &source) | |
~JCollection () override | |
JCollection & | operator= (const JCollection &source) |
JSize | GetItemCount () const |
bool | IsEmpty () const |
bool | IndexValid (const JIndex index) const |
JIndex | GetIndexFromEnd (const JIndex index) const |
JString | ToString () const override |
![]() | |
JBroadcaster () | |
virtual | ~JBroadcaster () |
JBroadcaster & | operator= (const JBroadcaster &source) |
bool | HasSenders () const |
JSize | GetSenderCount () const |
bool | HasRecipients () const |
JSize | GetRecipientCount () const |
template<class T > | |
void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
Protected Member Functions | |
S * | GetElements () |
![]() | |
void | InstallCollection (JCollection *list) |
const JCollection * | GetList () const |
void | Receive (JBroadcaster *sender, const Message &message) override |
![]() | |
void | ItemAdded () |
void | ItemRemoved () |
void | SetItemCount (const JSize newItemCount) |
![]() | |
JBroadcaster (const JBroadcaster &source) | |
void | ListenTo (const JBroadcaster *sender) |
void | StopListening (const JBroadcaster *sender) |
void | ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember) |
void | StopListening (const JBroadcaster *sender, const std::type_info &messageType) |
template<class T > | |
void | Send (JBroadcaster *recipient, const T &message) |
template<class T > | |
void | Broadcast (const T &message) |
void | SendWithFeedback (JBroadcaster *recipient, Message *message) |
void | BroadcastWithFeedback (Message *message) |
virtual void | ReceiveWithFeedback (JBroadcaster *sender, Message *message) |
virtual void | ReceiveGoingAway (JBroadcaster *sender) |
Interface for JStack class
The Stack Class
This class manages a stack. The first template argument must be a derived class of JList. The second template argument is the data type of the stack.
Refer to JArray.tmpl for warning associated with using JArray's.
void JStack< T, S >::Clear | ( | ) |
Remove all the elements from the stack.
|
protected |
JListIterator< T > * JStack< T, S >::NewIterator | ( | ) |
This provides an iterator for looking at all the elements in the Stack. The caller must jdelete the iterator.
Because of the order in which the elements are stored, use Prev() instead of Next().
JListIterator< T > * JStack< T, S >::NewIterator | ( | ) | const |
JStack< T, S > & JStack< T, S >::operator= | ( | const JStack< T, S > & | source | ) |
T JStack< T, S >::Peek | ( | ) | const |
Return the top element from the stack without removing it.
Return the specified element from the stack without removing it. The top element is indexed 1.
T JStack< T, S >::Pop | ( | ) |
Remove the top element from the stack and return it.
void JStack< T, S >::Push | ( | const T & | newElement | ) |
Add a new element on top of the stack.
Remove the first few elements from the top of the stack.