1999-10-27 16:23:58 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2009-03-09 23:40:15 +00:00
|
|
|
* Copyright (C) 1999-2009, International Business Machines
|
1999-12-09 23:27:55 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
1999-10-27 16:23:58 +00:00
|
|
|
* Date Name Description
|
|
|
|
* 10/22/99 alan Creation. This is an internal header.
|
|
|
|
* It should not be exported.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UVECTOR_H
|
|
|
|
#define UVECTOR_H
|
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
#include "unicode/utypes.h"
|
2002-06-27 01:19:20 +00:00
|
|
|
#include "unicode/uobject.h"
|
2001-07-31 18:10:53 +00:00
|
|
|
#include "uhash.h"
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2002-04-26 06:30:37 +00:00
|
|
|
/**
|
|
|
|
* A token comparison function.
|
|
|
|
* @param tok1 A token (object or integer)
|
|
|
|
* @param tok2 A token (object or integer)
|
|
|
|
* @return 0 if the two tokens are equal, -1 if tok1 is < tok2, or
|
|
|
|
* +1 if tok1 is > tok2.
|
|
|
|
*/
|
2002-07-23 23:12:03 +00:00
|
|
|
typedef int8_t U_CALLCONV USortComparator(UHashTok tok1,
|
|
|
|
UHashTok tok2);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A token assignment function. It may copy an integer, copy
|
|
|
|
* a pointer, or clone a pointer, as appropriate.
|
|
|
|
* @param dst The token to be assigned to
|
|
|
|
* @param src The token to assign from
|
|
|
|
*/
|
2002-08-29 22:12:49 +00:00
|
|
|
typedef void U_CALLCONV UTokenAssigner(UHashTok *dst,
|
|
|
|
UHashTok *src);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
/**
|
|
|
|
* <p>Ultralightweight C++ implementation of a <tt>void*</tt> vector
|
|
|
|
* that is (mostly) compatible with java.util.Vector.
|
|
|
|
*
|
|
|
|
* <p>This is a very simple implementation, written to satisfy an
|
|
|
|
* immediate porting need. As such, it is not completely fleshed out,
|
|
|
|
* and it aims for simplicity and conformity. Nonetheless, it serves
|
|
|
|
* its purpose (porting code from java that uses java.util.Vector)
|
|
|
|
* well, and it could be easily made into a more robust vector class.
|
|
|
|
*
|
|
|
|
* <p><b>Design notes</b>
|
|
|
|
*
|
|
|
|
* <p>There is index bounds checking, but little is done about it. If
|
|
|
|
* indices are out of bounds, either nothing happens, or zero is
|
|
|
|
* returned. We <em>do</em> avoid indexing off into the weeds.
|
|
|
|
*
|
|
|
|
* <p>There is detection of out of memory, but the handling is very
|
|
|
|
* coarse-grained -- similar to UnicodeString's protocol, but even
|
|
|
|
* coarser. The class contains <em>one static flag</em> that is set
|
|
|
|
* when any call to <tt>new</tt> returns zero. This allows the caller
|
|
|
|
* to use several vectors and make just one check at the end to see if
|
|
|
|
* a memory failure occurred. This is more efficient than making a
|
|
|
|
* check after each call on each vector when doing many operations on
|
|
|
|
* multiple vectors. The single static flag works best when memory
|
|
|
|
* failures are infrequent, and when recovery options are limited or
|
|
|
|
* nonexistent.
|
|
|
|
*
|
|
|
|
* <p>Since we don't have garbage collection, UVector was given the
|
|
|
|
* option to <em>own</em>its contents. To employ this, set a deleter
|
|
|
|
* function. The deleter is called on a void* pointer when that
|
|
|
|
* pointer is released by the vector, either when the vector itself is
|
|
|
|
* destructed, or when a call to setElementAt() overwrites an element,
|
|
|
|
* or when a call to remove() or one of its variants explicitly
|
|
|
|
* removes an element. If no deleter is set, or the deleter is set to
|
|
|
|
* zero, then it is assumed that the caller will delete elements as
|
|
|
|
* needed.
|
|
|
|
*
|
|
|
|
* <p>In order to implement methods such as contains() and indexOf(),
|
|
|
|
* UVector needs a way to compare objects for equality. To do so, it
|
|
|
|
* uses a comparison frunction, or "comparer." If the comparer is not
|
|
|
|
* set, or is set to zero, then all such methods will act as if the
|
|
|
|
* vector contains no element. That is, indexOf() will always return
|
|
|
|
* -1, contains() will always return FALSE, etc.
|
|
|
|
*
|
|
|
|
* <p><b>To do</b>
|
|
|
|
*
|
|
|
|
* <p>Improve the handling of index out of bounds errors.
|
|
|
|
*
|
|
|
|
* @author Alan Liu
|
|
|
|
*/
|
2002-06-27 01:19:20 +00:00
|
|
|
class U_COMMON_API UVector : public UObject {
|
2001-07-31 18:10:53 +00:00
|
|
|
// NOTE: UVector uses the UHashKey (union of void* and int32_t) as
|
|
|
|
// its basic storage type. It uses UKeyComparator as its
|
|
|
|
// comparison function. It uses UObjectDeleter as its deleter
|
|
|
|
// function. These are named for hashtables, but used here as-is
|
|
|
|
// rather than duplicating the type. This allows sharing of
|
|
|
|
// support functions.
|
1999-10-27 16:23:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
int32_t count;
|
|
|
|
|
|
|
|
int32_t capacity;
|
|
|
|
|
2001-10-16 18:31:13 +00:00
|
|
|
UHashTok* elements;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UObjectDeleter *deleter;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UKeyComparator *comparer;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
|
|
|
public:
|
2001-11-09 02:04:35 +00:00
|
|
|
UVector(UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-11-09 02:04:35 +00:00
|
|
|
UVector(int32_t initialCapacity, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UVector(UObjectDeleter *d, UKeyComparator *c, UErrorCode &status);
|
2001-11-09 02:04:35 +00:00
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UVector(UObjectDeleter *d, UKeyComparator *c, int32_t initialCapacity, UErrorCode &status);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
2004-04-07 05:20:22 +00:00
|
|
|
virtual ~UVector();
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-04-26 06:30:37 +00:00
|
|
|
/**
|
|
|
|
* Assign this object to another (make this a copy of 'other').
|
|
|
|
* Use the 'assign' function to assign each element.
|
|
|
|
*/
|
2002-07-23 23:12:03 +00:00
|
|
|
void assign(const UVector& other, UTokenAssigner *assign, UErrorCode &ec);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compare this vector with another. They will be considered
|
|
|
|
* equal if they are of the same size and all elements are equal,
|
|
|
|
* as compared using this object's comparer.
|
|
|
|
*/
|
|
|
|
UBool operator==(const UVector& other);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Equivalent to !operator==()
|
|
|
|
*/
|
|
|
|
inline UBool operator!=(const UVector& other);
|
|
|
|
|
1999-11-16 17:13:02 +00:00
|
|
|
//------------------------------------------------------------
|
|
|
|
// java.util.Vector API
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
void addElement(void* obj, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
void addElement(int32_t elem, UErrorCode &status);
|
2001-07-31 18:10:53 +00:00
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
void setElementAt(void* obj, int32_t index);
|
|
|
|
|
2001-07-31 18:10:53 +00:00
|
|
|
void setElementAt(int32_t elem, int32_t index);
|
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
void insertElementAt(void* obj, int32_t index, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
void insertElementAt(int32_t elem, int32_t index, UErrorCode &status);
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
void* elementAt(int32_t index) const;
|
|
|
|
|
2001-07-31 18:10:53 +00:00
|
|
|
int32_t elementAti(int32_t index) const;
|
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
UBool equals(const UVector &other) const;
|
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
void* firstElement(void) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
void* lastElement(void) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-03-29 01:56:09 +00:00
|
|
|
int32_t lastElementi(void) const;
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
int32_t indexOf(void* obj, int32_t startIndex = 0) const;
|
|
|
|
|
2002-03-29 01:56:09 +00:00
|
|
|
int32_t indexOf(int32_t obj, int32_t startIndex = 0) const;
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
UBool contains(void* obj) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-03-29 01:56:09 +00:00
|
|
|
UBool contains(int32_t obj) const;
|
|
|
|
|
2002-04-26 06:30:37 +00:00
|
|
|
UBool containsAll(const UVector& other) const;
|
|
|
|
|
|
|
|
UBool removeAll(const UVector& other);
|
|
|
|
|
|
|
|
UBool retainAll(const UVector& other);
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
void removeElementAt(int32_t index);
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
UBool removeElement(void* obj);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
|
|
|
void removeAllElements();
|
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
int32_t size(void) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
UBool isEmpty(void) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-10-30 19:44:11 +00:00
|
|
|
/**
|
|
|
|
* Change the size of this vector as follows: If newSize is
|
|
|
|
* smaller, then truncate the array, possibly deleting held
|
|
|
|
* elements for i >= newSize. If newSize is larger, grow the
|
2006-09-28 21:27:09 +00:00
|
|
|
* array, filling in new slots with NULL.
|
2001-10-30 19:44:11 +00:00
|
|
|
*/
|
2007-12-14 10:17:12 +00:00
|
|
|
void setSize(int32_t newSize, UErrorCode &status);
|
2001-10-30 19:44:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill in the given array with all elements of this vector.
|
|
|
|
*/
|
|
|
|
void** toArray(void** result) const;
|
|
|
|
|
1999-11-16 17:13:02 +00:00
|
|
|
//------------------------------------------------------------
|
1999-10-27 16:23:58 +00:00
|
|
|
// New API
|
1999-11-16 17:13:02 +00:00
|
|
|
//------------------------------------------------------------
|
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UObjectDeleter *setDeleter(UObjectDeleter *d);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UKeyComparator *setComparer(UKeyComparator *c);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
|
|
|
void* operator[](int32_t index) const;
|
|
|
|
|
1999-11-16 17:13:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the element at the given index from this vector and
|
|
|
|
* transfer ownership of it to the caller. After this call, the
|
|
|
|
* caller owns the result and must delete it and the vector entry
|
|
|
|
* at 'index' is removed, shifting all subsequent entries back by
|
|
|
|
* one index and shortening the size of the vector by one. If the
|
|
|
|
* index is out of range or if there is no item at the given index
|
|
|
|
* then 0 is returned and the vector is unchanged.
|
|
|
|
*/
|
|
|
|
void* orphanElementAt(int32_t index);
|
|
|
|
|
2002-04-26 06:30:37 +00:00
|
|
|
/**
|
|
|
|
* Returns true if this vector contains none of the elements
|
|
|
|
* of the given vector.
|
|
|
|
* @param other vector to be checked for containment
|
|
|
|
* @return true if the test condition is met
|
|
|
|
*/
|
|
|
|
UBool containsNone(const UVector& other) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert the given object into this vector at its sorted position
|
|
|
|
* as defined by 'compare'. The current elements are assumed to
|
|
|
|
* be sorted already.
|
|
|
|
*/
|
2002-07-23 23:12:03 +00:00
|
|
|
void sortedInsert(void* obj, USortComparator *compare, UErrorCode& ec);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert the given integer into this vector at its sorted position
|
|
|
|
* as defined by 'compare'. The current elements are assumed to
|
|
|
|
* be sorted already.
|
|
|
|
*/
|
2002-07-23 23:12:03 +00:00
|
|
|
void sortedInsert(int32_t obj, USortComparator *compare, UErrorCode& ec);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
2009-03-09 23:40:15 +00:00
|
|
|
/**
|
|
|
|
* Sort the contents of the vector, assuming that the contents of the
|
|
|
|
* vector are of type int32_t.
|
|
|
|
*/
|
|
|
|
void sorti(UErrorCode &ec);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sort the contents of this vector, using a caller-supplied function
|
|
|
|
* to do the comparisons. (It's confusing that
|
|
|
|
* UVector's USortComparator function is different from the
|
|
|
|
* UComparator function type defined in uarrsort.h)
|
|
|
|
*/
|
|
|
|
void sort(USortComparator *compare, UErrorCode &ec);
|
|
|
|
|
2002-06-29 00:04:16 +00:00
|
|
|
/**
|
2003-05-29 22:21:22 +00:00
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
2002-06-29 00:04:16 +00:00
|
|
|
*/
|
2004-08-24 17:21:14 +00:00
|
|
|
static UClassID U_EXPORT2 getStaticClassID();
|
2002-06-29 00:04:16 +00:00
|
|
|
|
|
|
|
/**
|
2003-05-29 22:21:22 +00:00
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
2002-06-29 00:04:16 +00:00
|
|
|
*/
|
2003-08-27 01:01:42 +00:00
|
|
|
virtual UClassID getDynamicClassID() const;
|
2002-06-29 00:04:16 +00:00
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
private:
|
2001-08-23 01:06:08 +00:00
|
|
|
void _init(int32_t initialCapacity, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-17 19:44:00 +00:00
|
|
|
int32_t indexOf(UHashTok key, int32_t startIndex = 0, int8_t hint = 0) const;
|
2002-04-26 06:30:37 +00:00
|
|
|
|
2002-07-23 23:12:03 +00:00
|
|
|
void sortedInsert(UHashTok tok, USortComparator *compare, UErrorCode& ec);
|
2002-04-26 06:30:37 +00:00
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
// Disallow
|
|
|
|
UVector(const UVector&);
|
|
|
|
|
|
|
|
// Disallow
|
|
|
|
UVector& operator=(const UVector&);
|
2002-06-29 00:04:16 +00:00
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <p>Ultralightweight C++ implementation of a <tt>void*</tt> stack
|
|
|
|
* that is (mostly) compatible with java.util.Stack. As in java, this
|
|
|
|
* is merely a paper thin layer around UVector. See the UVector
|
|
|
|
* documentation for further information.
|
|
|
|
*
|
|
|
|
* <p><b>Design notes</b>
|
|
|
|
*
|
|
|
|
* <p>The element at index <tt>n-1</tt> is (of course) the top of the
|
|
|
|
* stack.
|
|
|
|
*
|
|
|
|
* <p>The poorly named <tt>empty()</tt> method doesn't empty the
|
|
|
|
* stack; it determines if the stack is empty.
|
|
|
|
*
|
|
|
|
* @author Alan Liu
|
|
|
|
*/
|
1999-11-16 17:13:02 +00:00
|
|
|
class U_COMMON_API UStack : public UVector {
|
1999-10-27 16:23:58 +00:00
|
|
|
public:
|
2001-11-09 02:04:35 +00:00
|
|
|
UStack(UErrorCode &status);
|
|
|
|
|
|
|
|
UStack(int32_t initialCapacity, UErrorCode &status);
|
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UStack(UObjectDeleter *d, UKeyComparator *c, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2002-07-12 00:23:52 +00:00
|
|
|
UStack(UObjectDeleter *d, UKeyComparator *c, int32_t initialCapacity, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2004-04-07 05:20:22 +00:00
|
|
|
virtual ~UStack();
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
// It's okay not to have a virtual destructor (in UVector)
|
|
|
|
// because UStack has no special cleanup to do.
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
UBool empty(void) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
void* peek(void) const;
|
2002-03-29 01:56:09 +00:00
|
|
|
|
|
|
|
int32_t peeki(void) const;
|
1999-10-27 16:23:58 +00:00
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
void* pop(void);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-07-31 18:10:53 +00:00
|
|
|
int32_t popi(void);
|
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
void* push(void* obj, UErrorCode &status);
|
1999-10-27 16:23:58 +00:00
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
int32_t push(int32_t i, UErrorCode &status);
|
2001-07-31 18:10:53 +00:00
|
|
|
|
2004-12-20 23:22:34 +00:00
|
|
|
/*
|
|
|
|
If the object o occurs as an item in this stack,
|
|
|
|
this method returns the 1-based distance from the top of the stack.
|
|
|
|
*/
|
1999-10-27 16:23:58 +00:00
|
|
|
int32_t search(void* obj) const;
|
|
|
|
|
2002-06-29 00:04:16 +00:00
|
|
|
/**
|
2003-05-29 22:21:22 +00:00
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
2002-06-29 00:04:16 +00:00
|
|
|
*/
|
2004-08-24 17:21:14 +00:00
|
|
|
static UClassID U_EXPORT2 getStaticClassID();
|
2002-06-29 00:04:16 +00:00
|
|
|
|
|
|
|
/**
|
2003-05-29 22:21:22 +00:00
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
2002-06-29 00:04:16 +00:00
|
|
|
*/
|
2003-08-27 01:01:42 +00:00
|
|
|
virtual UClassID getDynamicClassID() const;
|
2002-06-29 00:04:16 +00:00
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
private:
|
|
|
|
// Disallow
|
|
|
|
UStack(const UStack&);
|
|
|
|
|
|
|
|
// Disallow
|
|
|
|
UStack& operator=(const UStack&);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// UVector inlines
|
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
inline int32_t UVector::size(void) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
inline UBool UVector::isEmpty(void) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return count == 0;
|
|
|
|
}
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
inline UBool UVector::contains(void* obj) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return indexOf(obj) >= 0;
|
|
|
|
}
|
|
|
|
|
2002-03-29 01:56:09 +00:00
|
|
|
inline UBool UVector::contains(int32_t obj) const {
|
|
|
|
return indexOf(obj) >= 0;
|
|
|
|
}
|
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
inline void* UVector::firstElement(void) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return elementAt(0);
|
|
|
|
}
|
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
inline void* UVector::lastElement(void) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return elementAt(count-1);
|
|
|
|
}
|
|
|
|
|
2002-03-29 01:56:09 +00:00
|
|
|
inline int32_t UVector::lastElementi(void) const {
|
|
|
|
return elementAti(count-1);
|
|
|
|
}
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
inline void* UVector::operator[](int32_t index) const {
|
|
|
|
return elementAt(index);
|
|
|
|
}
|
|
|
|
|
2002-04-26 06:30:37 +00:00
|
|
|
inline UBool UVector::operator!=(const UVector& other) {
|
|
|
|
return !operator==(other);
|
|
|
|
}
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
// UStack inlines
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
inline UBool UStack::empty(void) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return isEmpty();
|
|
|
|
}
|
|
|
|
|
1999-12-22 22:57:04 +00:00
|
|
|
inline void* UStack::peek(void) const {
|
1999-10-27 16:23:58 +00:00
|
|
|
return lastElement();
|
|
|
|
}
|
|
|
|
|
2002-03-29 01:56:09 +00:00
|
|
|
inline int32_t UStack::peeki(void) const {
|
|
|
|
return lastElementi();
|
|
|
|
}
|
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
inline void* UStack::push(void* obj, UErrorCode &status) {
|
|
|
|
addElement(obj, status);
|
1999-10-27 16:23:58 +00:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2001-08-23 01:06:08 +00:00
|
|
|
inline int32_t UStack::push(int32_t i, UErrorCode &status) {
|
|
|
|
addElement(i, status);
|
2001-07-31 18:10:53 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_END
|
|
|
|
|
1999-10-27 16:23:58 +00:00
|
|
|
#endif
|