05.11.2011 - stable version, 0.1.0, self-test program, work at GCC 2.95 - 4.5, VC 2010, MinGW, Linux, Windows, QNX
This commit is contained in:
@@ -123,12 +123,12 @@ public:
|
||||
void operator &=(const PIFlags & f) {flags = flags & f.flags;}
|
||||
void operator &=(const Enum & e) {flags = flags & e;}
|
||||
void operator &=(const int i) {flags = flags & i;}
|
||||
PIFlags & operator |(PIFlags f) const {PIFlags tf(flags | f.flags); return tf;}
|
||||
PIFlags & operator |(Enum e) const {PIFlags tf(flags | e); return tf;}
|
||||
PIFlags & operator |(int i) const {PIFlags tf(flags | i); return tf;}
|
||||
PIFlags & operator &(PIFlags f) const {PIFlags tf(flags & f.flags); return tf;}
|
||||
PIFlags & operator &(Enum e) const {PIFlags tf(flags & e); return tf;}
|
||||
PIFlags & operator &(int i) const {PIFlags tf(flags & i); return tf;}
|
||||
PIFlags operator |(PIFlags f) const {PIFlags tf(flags | f.flags); return tf;}
|
||||
PIFlags operator |(Enum e) const {PIFlags tf(flags | e); return tf;}
|
||||
PIFlags operator |(int i) const {PIFlags tf(flags | i); return tf;}
|
||||
PIFlags operator &(PIFlags f) const {PIFlags tf(flags & f.flags); return tf;}
|
||||
PIFlags operator &(Enum e) const {PIFlags tf(flags & e); return tf;}
|
||||
PIFlags operator &(int i) const {PIFlags tf(flags & i); return tf;}
|
||||
bool operator [](Enum e) {return (flags & e) == e;}
|
||||
operator int() const {return flags;}
|
||||
private:
|
||||
@@ -140,12 +140,13 @@ class PIVector: public vector<Type, Allocator> {
|
||||
typedef PIVector<Type, Allocator> _CVector;
|
||||
typedef vector<Type, Allocator> _stlc;
|
||||
public:
|
||||
PIVector() {;}
|
||||
PIVector(const Type & value) {_stlc::push_back(value);}
|
||||
PIVector(const Type & v0, const Type & v1) {_stlc::push_back(v0); _stlc::push_back(v1);}
|
||||
PIVector(const Type & v0, const Type & v1, const Type & v2) {_stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
|
||||
PIVector(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {_stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
|
||||
PIVector(uint size, const Type & value = Type()) {_stlc::resize(size, value);}
|
||||
PIVector() {piMonitor.containers++;}
|
||||
PIVector(const Type & value) {piMonitor.containers++; _stlc::push_back(value);}
|
||||
PIVector(const Type & v0, const Type & v1) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1);}
|
||||
PIVector(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
|
||||
PIVector(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
|
||||
PIVector(uint size, const Type & value = Type()) {piMonitor.containers++; _stlc::resize(size, value);}
|
||||
~PIVector() {piMonitor.containers--;}
|
||||
const Type & at(uint index) const {return (*this)[index];}
|
||||
Type & at(uint index) {return (*this)[index];}
|
||||
const Type * data(uint index = 0) const {return &(*this)[index];}
|
||||
@@ -161,6 +162,8 @@ public:
|
||||
_CVector & insert(uint pos, const Type & t) {_stlc::insert(_stlc::begin() + pos, t); return *this;}
|
||||
_CVector & operator <<(const Type & t) {_stlc::push_back(t); return *this;}
|
||||
_CVector & operator <<(const _CVector & t) {for (typename _stlc::iterator i = t.begin(); i != t.end(); i++) _stlc::push_back(*i); return *this;}
|
||||
bool operator ==(const _CVector & t) {for (uint i = 0; i < _stlc::size(); ++i) if (t[i] != at(i)) return false; return true;}
|
||||
bool operator !=(const _CVector & t) {for (uint i = 0; i < _stlc::size(); ++i) if (t[i] != at(i)) return true; return false;}
|
||||
bool contain(const Type & v) const {for (uint i = 0; i < _stlc::size(); ++i) if (v == at(i)) return true; return false;}
|
||||
};
|
||||
|
||||
@@ -172,12 +175,13 @@ class PIList: public list<Type, Allocator> {
|
||||
typedef PIList<Type, Allocator> _CList;
|
||||
typedef list<Type, Allocator> _stlc;
|
||||
public:
|
||||
PIList() {;}
|
||||
PIList(const Type & value) {_stlc::resize(1, value);}
|
||||
PIList(const Type & v0, const Type & v1) {_stlc::push_back(v0); _stlc::push_back(v1);}
|
||||
PIList(const Type & v0, const Type & v1, const Type & v2) {_stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
|
||||
PIList(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {_stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
|
||||
PIList(uint size, const Type & value = Type()) {_stlc::resize(size, value);}
|
||||
PIList() {piMonitor.containers++;}
|
||||
PIList(const Type & value) {piMonitor.containers++; _stlc::resize(1, value);}
|
||||
PIList(const Type & v0, const Type & v1) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1);}
|
||||
PIList(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
|
||||
PIList(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
|
||||
PIList(uint size, const Type & value = Type()) {piMonitor.containers++; _stlc::resize(size, value);}
|
||||
~PIList() {piMonitor.containers--;}
|
||||
Type & operator [](uint index) {return (*this)[index];}
|
||||
Type & operator [](uint index) const {return (*this)[index];}
|
||||
const Type * data(uint index = 0) const {return &(*this)[index];}
|
||||
@@ -197,11 +201,12 @@ class PISet: public set<Type, Compare, Allocator> {
|
||||
typedef PISet<Type, Compare, Allocator> _CSet;
|
||||
typedef set<Type, Compare, Allocator> _stlc;
|
||||
public:
|
||||
PISet() {;}
|
||||
PISet(const Type & value) {_stlc::resize(1, value);}
|
||||
PISet(const Type & v0, const Type & v1) {_stlc::insert(v0); _stlc::insert(v1);}
|
||||
PISet(const Type & v0, const Type & v1, const Type & v2) {_stlc::insert(v0); _stlc::insert(v1); _stlc::insert(v2);}
|
||||
PISet(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {_stlc::insert(v0); _stlc::insert(v1); _stlc::insert(v2); _stlc::insert(v3);}
|
||||
PISet() {piMonitor.containers++;}
|
||||
PISet(const Type & value) {piMonitor.containers++; _stlc::resize(1, value);}
|
||||
PISet(const Type & v0, const Type & v1) {piMonitor.containers++; _stlc::insert(v0); _stlc::insert(v1);}
|
||||
PISet(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::insert(v0); _stlc::insert(v1); _stlc::insert(v2);}
|
||||
PISet(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::insert(v0); _stlc::insert(v1); _stlc::insert(v2); _stlc::insert(v3);}
|
||||
~PISet() {piMonitor.containers--;}
|
||||
int size_s() const {return static_cast<int>(_stlc::size());}
|
||||
bool isEmpty() const {return _stlc::empty();}
|
||||
_CSet & remove(uint num) {_stlc::erase(_stlc::begin() + num); return *this;}
|
||||
@@ -232,11 +237,12 @@ class PIDeque: public deque<Type, Allocator> {
|
||||
typedef PIDeque<Type, Allocator> _CDeque;
|
||||
typedef deque<Type, Allocator> _stlc;
|
||||
public:
|
||||
PIDeque() {;}
|
||||
PIDeque(const Type & value) {_stlc::resize(1, value);}
|
||||
PIDeque(const Type & v0, const Type & v1) {_stlc::push_back(v0); _stlc::push_back(v1);}
|
||||
PIDeque(const Type & v0, const Type & v1, const Type & v2) {_stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
|
||||
PIDeque(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {_stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
|
||||
PIDeque() {piMonitor.containers++;}
|
||||
PIDeque(const Type & value) {piMonitor.containers++; _stlc::resize(1, value);}
|
||||
PIDeque(const Type & v0, const Type & v1) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1);}
|
||||
PIDeque(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
|
||||
PIDeque(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
|
||||
~PIDeque() {piMonitor.containers--;}
|
||||
int size_s() const {return static_cast<int>(_stlc::size());}
|
||||
bool isEmpty() const {return _stlc::empty();}
|
||||
_CDeque & operator <<(const Type & t) {_CDeque::push_back(t); return *this;}
|
||||
@@ -279,9 +285,9 @@ class PIHash: public PISet<PIPair<Key, Type> > {
|
||||
public:
|
||||
PIHash() {;}
|
||||
PIHash(const Type & value, const Key & key) {insert(value, key);}
|
||||
_CHash & insert(const Type & value, const Key & key) {_CSet::insert(PIPair<Key, Type>(key, value));}
|
||||
Type value(Key key) {for (typename _CHash::iterator i = _CHash::begin(); i != _CHash::end(); i++) if ((*i).first == key) return (*i).second; return Key();}
|
||||
Type operator[](Key key) {return value(key);}
|
||||
_CHash & insert(const Type & value, const Key & key) {_CSet::insert(PIPair<Key, Type>(key, value)); return *this;}
|
||||
Type value(Key key) const {for (typename _CHash::iterator i = _CHash::begin(); i != _CHash::end(); i++) if ((*i).first == key) return (*i).second; return Type();}
|
||||
Type operator[](Key key) const {return value(key);}
|
||||
};
|
||||
|
||||
#endif // PICONTAINERS_H
|
||||
|
||||
Reference in New Issue
Block a user