version 1.15, 2002/06/13 21:32:03
|
version 1.16, 2002/07/17 18:52:23
|
|
|
| |
#include <Pegasus/Common/Memory.h> | #include <Pegasus/Common/Memory.h> |
#include <Pegasus/Common/ArrayRep.h> | #include <Pegasus/Common/ArrayRep.h> |
|
#include <Pegasus/Common/Exception.h> |
| |
#ifdef PEGASUS_HAS_EBCDIC | #ifdef PEGASUS_HAS_EBCDIC |
#include <unistd.h> | #include <unistd.h> |
|
|
PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) | PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) |
{ | { |
if (pos >= size()) | if (pos >= size()) |
ThrowOutOfBounds(); |
throw OutOfBounds(); |
| |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data()[pos]; | return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data()[pos]; |
} | } |
|
|
const PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) const | const PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) const |
{ | { |
if (pos >= size()) | if (pos >= size()) |
ThrowOutOfBounds(); |
throw OutOfBounds(); |
| |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data()[pos]; | return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data()[pos]; |
} | } |
|
|
void Array<PEGASUS_ARRAY_T>::insert(Uint32 pos, const PEGASUS_ARRAY_T* x, Uint32 size) | void Array<PEGASUS_ARRAY_T>::insert(Uint32 pos, const PEGASUS_ARRAY_T* x, Uint32 size) |
{ | { |
if (pos > this->size()) | if (pos > this->size()) |
ThrowOutOfBounds(); |
throw OutOfBounds(); |
| |
reserve(this->size() + size); | reserve(this->size() + size); |
| |
|
|
void Array<PEGASUS_ARRAY_T>::remove(Uint32 pos, Uint32 size) | void Array<PEGASUS_ARRAY_T>::remove(Uint32 pos, Uint32 size) |
{ | { |
if (pos + size - 1 > this->size()) | if (pos + size - 1 > this->size()) |
ThrowOutOfBounds(); |
throw OutOfBounds(); |
| |
Destroy(_data() + pos, size); | Destroy(_data() + pos, size); |
| |