mockpp-commits Mailing List for Mock Objects for C++ (Page 19)
Brought to you by:
ewald-arnold
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
(17) |
Mar
(178) |
Apr
(119) |
May
(60) |
Jun
(3) |
Jul
(60) |
Aug
(16) |
Sep
(55) |
Oct
(156) |
Nov
(136) |
Dec
(255) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(98) |
Feb
(8) |
Mar
(57) |
Apr
(43) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Ewald A. <ewa...@us...> - 2005-12-01 19:43:12
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21140 Modified Files: ChangeLog Log Message: ministl fully working Index: ChangeLog =================================================================== RCS file: /cvsroot/mockpp/mockpp/ChangeLog,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- ChangeLog 27 Nov 2005 17:27:56 -0000 1.82 +++ ChangeLog 1 Dec 2005 19:43:03 -0000 1.83 @@ -2,7 +2,7 @@ mockpp history -------------- -2005-11-24 1.10.1: +2005-11-24 1.11.0 - removed superfluous template parameter - fix compilation error due to bad namespace resolution |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 18:56:52
|
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8961/3party/ministl Modified Files: !README raw_iterator.h reverse_iterator.h Log Message: docs Index: raw_iterator.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/raw_iterator.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- raw_iterator.h 1 Dec 2005 18:15:08 -0000 1.1 +++ raw_iterator.h 1 Dec 2005 18:56:40 -0000 1.2 @@ -1,3 +1,32 @@ +/** @file + @brief Raw iterator for minimalistic stl + + $Id$ + + ***************************************************************************/ + +/************************************************************************** + + begin : Thu Dec 1 2005 + copyright : (C) 2002-2005 by Ewald Arnold + email : mockpp at ewald-arnold dot de + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **/ + #ifndef __ministl__raw_iterator_h #define __ministl__raw_iterator_h Index: !README =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/!README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- !README 29 Nov 2005 23:23:55 -0000 1.1 +++ !README 1 Dec 2005 18:56:40 -0000 1.2 @@ -2,5 +2,5 @@ at http://www.mico.org. The content was moved into the namespace ministl. -Some minor changes were made to reflect the current state of -the stl and better fit into a minimalicstic mockpp testing environment. \ No newline at end of file +Some minor changes and extensions were made to reflect the current state of +the stl and better fit into a minimalistic mockpp testing environment. \ No newline at end of file Index: reverse_iterator.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/reverse_iterator.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- reverse_iterator.h 1 Dec 2005 18:15:08 -0000 1.1 +++ reverse_iterator.h 1 Dec 2005 18:56:40 -0000 1.2 @@ -1,3 +1,32 @@ +/** @file + @brief reverse iterator for minimalistic stl + + $Id$ + + ***************************************************************************/ + +/************************************************************************** + + begin : Thu Dec 1 2005 + copyright : (C) 2002-2005 by Ewald Arnold + email : mockpp at ewald-arnold dot de + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **/ + #ifndef __ministl__reverse_iterator_h #define __ministl__reverse_iterator_h |
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30919/3party/ministl Modified Files: Makefile.am defalloc.h map map.h pair set string vector Added Files: multimap raw_iterator.h reverse_iterator.h Log Message: ministl basically working Index: map =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/map,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- map 30 Nov 2005 21:46:34 -0000 1.3 +++ map 1 Dec 2005 18:15:08 -0000 1.4 @@ -30,6 +30,7 @@ #include <ministl/simplevec.h> #include <ministl/functional> #include <ministl/pair> +#include <ministl/multimap> //#include <ministl/bool.h> @@ -59,36 +60,43 @@ mapIterator () : n (0) {} + bool operator== (const my_type &it) const { return it.n == n; } + bool operator!= (const my_type &it) const { return !(it.n == n); } + my_type operator++ () { ++n; return *this; } + my_type operator++ (int) { my_type tmp = *this; ++n; return tmp; } + my_type operator-- () { --n; return *this; } + my_type operator-- (int) { my_type tmp = *this; --n; return tmp; } + value_type &operator* () { return **n; @@ -108,43 +116,52 @@ mapConstIterator (repiterator _n) : n (_n) {} + public: mapConstIterator () : n (0) {} + mapConstIterator (const mapIterator<kT,vT,cT> &i) : n (i.n) {} + bool operator== (const my_type &it) const { return it.n == n; } + bool operator!= (const my_type &it) const { return !(it.n == n); } + my_type operator++ () { ++n; return *this; } + my_type operator++ (int) { my_type tmp = *this; ++n; return tmp; } + my_type operator-- () { --n; return *this; } + my_type operator-- (int) { my_type tmp = *this; --n; return tmp; } + const value_type &operator* () const { return **n; @@ -155,6 +172,7 @@ class map { public: + typedef keyT key_type; typedef pair<const keyT, valT> value_type; typedef std::size_t size_type; @@ -163,39 +181,51 @@ typedef mapConstIterator<keyT, valT, cmpT> const_iterator; // XXX typedefs done to work around g++ bug typedef pair<iterator, bool> pair_iterator_bool; + private: + rep_type _ents; cmpT _comp; + public: + iterator begin () { return iterator (_ents.begin()); } + const_iterator begin () const { return const_iterator (_ents.begin()); } + iterator end () { return iterator (_ents.end()); } + + const_iterator end () const { return const_iterator (_ents.end()); } + map (const cmpT &comp = cmpT()) : _comp (comp) {} + map (const_iterator first, const_iterator last, const cmpT &comp = cmpT()) : _comp (comp) { insert (first, last); } + map (const map<keyT, valT, cmpT> &m) : _comp (m._comp) { insert (m.begin(), m.end()); } + map<keyT, valT, cmpT> &operator= (const map<keyT, valT, cmpT> &m) { if (this != &m) @@ -206,27 +236,34 @@ } return *this; } + ~map () { erase (begin(), end()); } + bool empty () const { return _ents.empty (); } + size_type size () const { return _ents.size (); } + private: // find the iterator position where k should be inserted ... bool lookup (const key_type &k, iterator &it); + public: + pair_iterator_bool insert (const value_type &v) { iterator i = end(); if (size() > 0 && lookup (v.first, i)) return pair_iterator_bool (i, false); + i = iterator (_ents.insert (i.n, new value_type (v))); return pair_iterator_bool (i, true); } @@ -240,11 +277,13 @@ for ( ; first != last; ++first) insert (*first); } + void insert (const value_type *first, const value_type *last) { for ( ; first != last; ++first) insert (*first); } + void erase (iterator pos) { if (pos != end()) @@ -253,6 +292,7 @@ _ents.erase (pos.n); } } + size_type erase (const key_type &k) { iterator i = find (k); @@ -261,16 +301,19 @@ erase (i); return 1; } + void erase (iterator first, iterator last) { for (iterator i = first; i != last; ++i) delete *(i.n); _ents.erase (first.n, last.n); } + void clear () { erase (begin(), end()); } + iterator find (const key_type &k) { if (size() > 0) @@ -296,6 +339,7 @@ } return end(); } + const_iterator find (const key_type &k) const { if (size() > 0) @@ -321,10 +365,12 @@ } return end(); } + size_type count (const key_type &k) const { return find (k) != end() ? 1 : 0; } + valT &operator[] (const key_type &k) { iterator i = insert(value_type (k, valT())).first; Index: set =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/set,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- set 30 Nov 2005 21:46:34 -0000 1.3 +++ set 1 Dec 2005 18:15:08 -0000 1.4 @@ -150,7 +150,7 @@ } }; -template<class valT, class cmpT> +template<class valT, class cmpT = ministl::less<valT> > class set { public: Index: string =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/string,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- string 30 Nov 2005 21:46:34 -0000 1.4 +++ string 1 Dec 2005 18:15:08 -0000 1.5 @@ -577,6 +577,12 @@ remove (size_t pos = 0, size_t n = NPOS) _THROW_ALLOC_OUTRANGE ; basic_string<charT>& + erase (size_t pos = 0, size_t n = NPOS) _THROW_ALLOC_OUTRANGE + { + return remove(pos, n); + } + + basic_string<charT>& replace (size_t pos1, size_t n1, const basic_string<charT>& str, size_t pos2 = 0, size_t n2 = NPOS) _THROW_ALLOC_LENGTH_OUTRANGE ; --- NEW FILE: multimap --- // -*- c++ -*- /* * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de * Generated by extending map.h * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send comments and/or bug reports to: * mi...@in... */ #ifndef __ministl_multimap_h__ #define __ministl_multimap_h__ #include <ministl/ministl.h> #include <ministl/simplevec.h> #include <ministl/functional> #include <ministl/pair> //#include <ministl/bool.h> namespace ministl { template<class kT, class vT, class cT> class multimap; template<class kT, class vT, class cT> class multimapConstIterator; template<class kT, class vT, class cT> class multimapIterator { friend class multimap<kT,vT,cT>; friend class multimapConstIterator<kT,vT,cT>; typedef multimapIterator<kT,vT,cT> my_type; typedef pair<const kT, vT> value_type; typedef simplevec<value_type *> rep_type; typedef typename rep_type::iterator repiterator; repiterator n; multimapIterator (repiterator _n) : n (_n) {} public: multimapIterator () : n (0) {} bool operator== (const my_type &it) const { return it.n == n; } bool operator!= (const my_type &it) const { return !(it.n == n); } my_type operator++ () { ++n; return *this; } my_type operator++ (int) { my_type tmp = *this; ++n; return tmp; } my_type operator-- () { --n; return *this; } my_type operator-- (int) { my_type tmp = *this; --n; return tmp; } value_type &operator* () { return **n; } }; template<class kT, class vT, class cT> class multimapConstIterator { friend class multimap<kT,vT,cT>; typedef multimapConstIterator<kT,vT,cT> my_type; typedef pair<const kT, vT> value_type; typedef simplevec<value_type *> rep_type; typedef typename rep_type::const_iterator repiterator; repiterator n; multimapConstIterator (repiterator _n) : n (_n) {} public: multimapConstIterator () : n (0) {} multimapConstIterator (const multimapIterator<kT,vT,cT> &i) : n (i.n) {} bool operator== (const my_type &it) const { return it.n == n; } bool operator!= (const my_type &it) const { return !(it.n == n); } my_type operator++ () { ++n; return *this; } my_type operator++ (int) { my_type tmp = *this; ++n; return tmp; } my_type operator-- () { --n; return *this; } my_type operator-- (int) { my_type tmp = *this; --n; return tmp; } const value_type &operator* () const { return **n; } }; template<class keyT, class valT, class cmpT = ministl::less<keyT> > class multimap { public: typedef keyT key_type; typedef pair<const keyT, valT> value_type; typedef std::size_t size_type; typedef simplevec<value_type *> rep_type; typedef multimapIterator<keyT, valT, cmpT> iterator; typedef multimapConstIterator<keyT, valT, cmpT> const_iterator; // XXX typedefs done to work around g++ bug private: rep_type _ents; cmpT _comp; public: iterator begin () { return iterator (_ents.begin()); } const_iterator begin () const { return const_iterator (_ents.begin()); } iterator end () { return iterator (_ents.end()); } const_iterator end () const { return const_iterator (_ents.end()); } multimap (const cmpT &comp = cmpT()) : _comp (comp) {} multimap (const_iterator first, const_iterator last, const cmpT &comp = cmpT()) : _comp (comp) { insert (first, last); } multimap (const multimap<keyT, valT, cmpT> &m) : _comp (m._comp) { insert (m.begin(), m.end()); } multimap<keyT, valT, cmpT> &operator= (const multimap<keyT, valT, cmpT> &m) { if (this != &m) { _comp = m._comp; erase (begin(), end()); insert (m.begin(), m.end()); } return *this; } ~multimap () { erase (begin(), end()); } bool empty () const { return _ents.empty (); } size_type size () const { return _ents.size (); } private: // find the iterator position where k should be inserted ... bool lookup (const key_type &k, iterator &it); public: iterator insert (const value_type &v) { iterator i = end(); if (size() > 0 && lookup (v.first, i)) return i; i = iterator (_ents.insert (i.n, new value_type(v))); return i; } #if 0 iterator insert (iterator pos, const value_type &v) {} #endif void insert (const_iterator first, const_iterator last) { for ( ; first != last; ++first) insert (*first); } void insert (const value_type *first, const value_type *last) { for ( ; first != last; ++first) insert (*first); } iterator lower_bound(const key_type& x) { return find(x); } const_iterator lower_bound(const key_type& x) const { return find(x); } iterator upper_bound(const key_type& x) { iterator it = find(x); if (it == end()) return it; while (*it++ == x) /**/; return it; } const_iterator upper_bound(const key_type& x) const { iterator it = find(x); if (it == end()) return it; while (*it++ == x) /**/; return it; } void erase (iterator pos) { if (pos != end()) { delete *(pos.n); _ents.erase (pos.n); } } size_type erase (const key_type &k) { iterator i = find (k); if (i == end()) return 0; erase (i); return 1; } void erase (iterator first, iterator last) { for (iterator i = first; i != last; ++i) delete *(i.n); _ents.erase (first.n, last.n); } void clear () { erase (begin(), end()); } iterator find (const key_type &k) { if (size() > 0) { int l = 0; int r = size()-1; do { int m = (l+r) >> 1; if (_comp (_ents[m]->first, k)) { l = m+1; } else { // if (k == _ents[m]->first) if (!_comp (k, _ents[m]->first)) return iterator (_ents.begin()+m); r = m-1; } } while (l <= r); } return end(); } const_iterator find (const key_type &k) const { if (size() > 0) { int l = 0; int r = size()-1; do { int m = (l+r) >> 1; if (_comp (_ents[m]->first, k)) { l = m+1; } else { // if (k == _ents[m]->first) if (!_comp (k, _ents[m]->first)) return const_iterator (_ents.begin()+m); r = m-1; } } while (l <= r); } return end(); } size_type count (const key_type &k) const { return find (k) != end() ? 1 : 0; } valT &operator[] (const key_type &k) { iterator i = insert(value_type (k, valT())).first; return (*i).second; } }; template<class kT, class vT, class cT> inline bool multimap<kT,vT,cT>::lookup (const kT &k, multimapIterator<kT,vT,cT> &it) { int l = 0; int r = size(); while (l < r) { int m = (l+r) >> 1; ministl_assert (m < r); if (_comp (_ents[m]->first, k)) { l = m+1; } else { // if (k == _ents[m]->first) { if (!_comp (k, _ents[m]->first)) { it = multimapIterator<kT,vT,cT> (_ents.begin()+m); return true; } r = m; } } ministl_assert (l == r); it = multimapIterator<kT,vT,cT> (_ents.begin()+l); return l < (int)size() && // (*it).first == k; !_comp ((*it).first, k) && !_comp (k, (*it).first); } template<class kT, class vT, class cT> bool operator== (const multimap<kT,vT,cT> &v1, const multimap<kT,vT,cT> &v2) { if (v1.size() != v2.size()) return false; typename multimap<kT,vT,cT>::const_iterator i1 = v1.begin(); typename multimap<kT,vT,cT>::const_iterator i2 = v2.begin(); for ( ;i1 != v1.end() && i2 != v2.end(); ++i1, ++i2) { if (!(*i1 == *i2)) return false; } return true; } template<class kT, class vT, class cT> bool operator< (const multimap<kT,vT,cT> &v1, const multimap<kT,vT,cT> &v2) { long minlast = _min_ (v1.size(), v2.size()); typename multimap<kT,vT,cT>::const_iterator i1 = v1.begin(); typename multimap<kT,vT,cT>::const_iterator i2 = v2.begin(); for ( ;i1 != v1.end() && i2 != v2.end(); ++i1, ++i2) { if (*i1 < *i2) return true; if (*i2 < *i1) return false; } return v1.size() < v2.size(); } } // namespace ministl #endif // __ministl_multimap_h__ Index: vector =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/vector,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- vector 30 Nov 2005 21:46:34 -0000 1.3 +++ vector 1 Dec 2005 18:15:08 -0000 1.4 @@ -33,6 +33,8 @@ //#include <ministl/bool.h> #include <ministl/defalloc.h> +#include <ministl/raw_iterator.h> +#include <ministl/reverse_iterator.h> namespace ministl @@ -43,35 +45,67 @@ class vector { public: - typedef T* iterator; - typedef const T* const_iterator; + + typedef T* iterator; + typedef const T* const_iterator; + + typedef ministl::reverse_iterator<raw_iterator<T> > reverse_iterator; + typedef ministl::reverse_iterator<raw_iterator<const T> > const_reverse_iterator; + typedef std::size_t size_type; private: + size_type _last, _size; T *_buf; public: + const_iterator begin () const { return &_buf[0]; } + iterator begin () { return &_buf[0]; } + const_iterator end () const { return &_buf[_last]; } + iterator end () { return &_buf[_last]; } + + const_reverse_iterator rbegin () const + { + return reverse_iterator(end()); + } + + reverse_iterator rbegin () + { + return reverse_iterator(end()); + } + + const_reverse_iterator rend () const + { + return reverse_iterator(begin()); + } + + reverse_iterator rend () + { + return reverse_iterator(begin()); + } + size_type capacity () const { return _size; } + size_type size () const { return _last; Index: defalloc.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/defalloc.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- defalloc.h 30 Nov 2005 21:46:34 -0000 1.3 +++ defalloc.h 1 Dec 2005 18:15:08 -0000 1.4 @@ -13,8 +13,7 @@ * */ -//#include <new> - +#include <new> #ifndef MINISTL_DEFALLOC_H #define MINISTL_DEFALLOC_H Index: map.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/map.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- map.h 29 Nov 2005 23:18:05 -0000 1.2 +++ map.h 1 Dec 2005 18:15:08 -0000 1.3 @@ -23,4 +23,6 @@ */ #include <ministl/map> +#include <ministl/multimap> using ministl::map; +using ministl::multimap; --- NEW FILE: reverse_iterator.h --- #ifndef __ministl__reverse_iterator_h #define __ministl__reverse_iterator_h namespace ministl { template<typename ITER> class reverse_iterator { public: typedef typename ITER::difference_type difference_type; typedef typename ITER::pointer pointer; typedef typename ITER::reference reference; typedef ITER iterator_type; typedef typename ITER::value_type value_type; reverse_iterator() : current() { } explicit reverse_iterator(iterator_type x) : current(x) { } explicit reverse_iterator(pointer x) : current(raw_iterator<value_type>(x)) { } reverse_iterator(const reverse_iterator& x) : current(x.current) { } template<typename IT> reverse_iterator(const reverse_iterator<IT>& x) : current(x.current) { } iterator_type base() const { return current; } reference operator*() const { pointer tmp = current.base()-1; return *tmp; } pointer operator->() const { return &(operator*()); } reverse_iterator& operator++() { --current; return *this; } reverse_iterator operator++(int) { reverse_iterator tmp = *this; --current; return tmp; } reverse_iterator& operator--() { ++current; return *this; } reverse_iterator operator--(int) { reverse_iterator tmp = *this; ++current; return tmp; } reverse_iterator operator+(difference_type n) const { return reverse_iterator(current - n); } reverse_iterator& operator+=(difference_type n) { current -= n; return *this; } reverse_iterator operator-(difference_type n) const { return reverse_iterator(current + n); } reverse_iterator& operator-=(difference_type n) { current += n; return *this; } reference operator[](difference_type n) const { return *(*this + n); } private: ITER current; }; template<typename ITER> inline bool operator==(const reverse_iterator<ITER>& x, const reverse_iterator<ITER>& y) { return x.base() == y.base(); } template<typename ITER> inline bool operator<(const reverse_iterator<ITER>& x, const reverse_iterator<ITER>& y) { return y.base() < x.base(); } template<typename ITER> inline bool operator!=(const reverse_iterator<ITER>& x, const reverse_iterator<ITER>& y) { return !(x == y); } } #endif // __ministl__reverse_iterator_h Index: pair =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/pair,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pair 29 Nov 2005 23:18:05 -0000 1.2 +++ pair 1 Dec 2005 18:15:08 -0000 1.3 @@ -27,14 +27,24 @@ { T1 first; T2 second; + #if defined(_AIX) && !defined(__GNUG__) // if T? is const xlC goofes about first/second not beeing inited pair() : first (T1()), second (T2()) {} #else pair() {} #endif - pair(const T1& a, const T2& b) : first(a), second(b) {}} -; + pair(const T1& a, const T2& b) + : first(a) + , second(b) + {} + + template<class U1, class U2> + pair(const pair<U1, U2>& p) + : first(p.first) + , second(p.second) + { } +}; template <class T1, class T2> inline bool operator==(const pair<T1, T2>& x, const pair<T1, T2>& y) @@ -49,7 +59,8 @@ } template <class T1, class T2> -inline pair<T1, T2> make_pair(const T1& x, const T2& y) +inline pair<T1, T2> +make_pair(const T1 &x, const T2 &y) { return pair<T1, T2>(x, y); } --- NEW FILE: raw_iterator.h --- #ifndef __ministl__raw_iterator_h #define __ministl__raw_iterator_h namespace ministl { template<typename T> class raw_iterator { public: typedef std::size_t difference_type; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef T value_type; raw_iterator () : current() { } // explicit raw_iterator (pointer x) : current(x) { } raw_iterator (const raw_iterator & x) : current(x.current) { } template<typename IT> raw_iterator (const raw_iterator <IT>& x) : current(x.base()) { } pointer base() const { return current; } pointer operator*() const { return current; } pointer operator->() const { return &(operator*()); } raw_iterator & operator++() { ++current; return *this; } raw_iterator operator++(int) { raw_iterator tmp = *this; ++current; return tmp; } raw_iterator & operator--() { --current; return *this; } raw_iterator operator--(int) { raw_iterator tmp = *this; --current; return tmp; } raw_iterator operator+(difference_type n) const { return raw_iterator (current + n); } raw_iterator & operator+=(difference_type n) { current += n; return *this; } raw_iterator operator-(difference_type n) const { return raw_iterator (current - n); } raw_iterator & operator-=(difference_type n) { current -= n; return *this; } reference operator[](difference_type n) const { return *(*this + n); } private: pointer current; }; template<typename T> inline bool operator==(const raw_iterator <T>& x, const raw_iterator <T>& y) { return x.base() == y.base(); } template<typename T> inline bool operator<(const raw_iterator <T>& x, const raw_iterator <T>& y) { return y.base() < x.base(); } template<typename T> inline bool operator!=(const raw_iterator <T>& x, const raw_iterator <T>& y) { return !(x == y); } } // ministl #endif // __ministl__raw_iterator_h Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 29 Nov 2005 23:30:31 -0000 1.2 +++ Makefile.am 1 Dec 2005 18:15:08 -0000 1.3 @@ -16,6 +16,7 @@ list \ map.h \ map \ + multimap \ ministl.h \ pair.h \ pair \ |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 18:15:20
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30919/mockpp/docs/en Modified Files: Makefile.am index.docbook Added Files: dev_embedded.docbook Log Message: ministl basically working --- NEW FILE: dev_embedded.docbook --- <sect1 id="devel-embedded"> <title>Embedded Systems</title> <para>text <programlisting> Full featured: 322400 built-in stl: 230628 built-in stl, no rtti: 218204 built-in stl, no exceptions: 193588 built-in stl, no rtti, no exceptions: 180588 ------------ Cost per feature stl: 91772 == 28% rtti: 12424 == 4% exceptions: 37040 == 11% production code: 188588 = 58% </programlisting> </para> <para>There are a few things that are not obvious but might become interesting: <itemizedlist> <listitem>In the same manner <literal>MOCKPP_STRING</literal> yields either a <token>std::string</token> or a <token>std::wstring</token>. </listitem> </itemizedlist> </para> </sect1> Index: index.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/index.docbook,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- index.docbook 14 Nov 2005 19:35:08 -0000 1.32 +++ index.docbook 1 Dec 2005 18:15:08 -0000 1.33 @@ -24,6 +24,7 @@ <!ENTITY sect_dev_advanced_jmock SYSTEM 'dev_advanced_jmock.docbook' > <!ENTITY sect_dev_advanced_poor_man SYSTEM 'dev_poor_mans_mock.docbook' > <!ENTITY sect_dev_helper SYSTEM 'dev_helper.docbook' > + <!ENTITY sect_dev_embedded SYSTEM 'dev_embedded.docbook' > <!ENTITY sect_dev_production SYSTEM 'dev_production.docbook' > <!ENTITY chap_faq SYSTEM 'faq.docbook' > <!ENTITY chap_credits SYSTEM 'credits.docbook' > @@ -45,6 +46,8 @@ §_dev_helper; + §_dev_embedded; + §_dev_production; </chapter> Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/Makefile.am,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Makefile.am 18 Nov 2005 20:32:36 -0000 1.38 +++ Makefile.am 1 Dec 2005 18:15:08 -0000 1.39 @@ -106,4 +106,5 @@ EXTRA_DIST=appendix.docbook bookinfo.docbook credits.docbook customize.xsl customize-flat.xsl \ dev_advanced.docbook dev_advanced_easymock.docbook customize-chunked.xsl \ dev_advanced_intro.docbook dev_poor_mans_mock.docbook dev_advanced_jmock.docbook dev_basic.docbook \ - dev_helper.docbook dev_intro.docbook faq.docbook index.docbook dev_production.docbook + dev_helper.docbook dev_intro.docbook faq.docbook index.docbook dev_production.docbook \ + dev_embedded.docbook |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 18:15:20
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30919 Modified Files: configure.in run-configure-ascii.sh run-configure-unicode.sh Log Message: ministl basically working Index: run-configure-unicode.sh =================================================================== RCS file: /cvsroot/mockpp/mockpp/run-configure-unicode.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- run-configure-unicode.sh 30 Nov 2005 21:47:31 -0000 1.9 +++ run-configure-unicode.sh 1 Dec 2005 18:15:08 -0000 1.10 @@ -8,7 +8,9 @@ fi echo mycc: $MYCC -# --disable-rtti --disable-exceptions -OPTS="--enable-doxygen --enable-docbook --enable-builtin-stl" -CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS" CXX=$MYCC CC=$MYCC ${0%/*}/configure --enable-unicode --enable-debug=full $OPTS --prefix=/tmp/mockpp-install +#OPTS="--enable-doxygen --enable-docbook" +OPTS="$OPTS --enable-builtin-stl" # --disable-exceptions --disable-rtti +#OPTS="$OPTS --enable-debug=full" + +CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS" CXX=$MYCC CC=$MYCC ${0%/*}/configure --enable-unicode $OPTS --prefix=/tmp/mockpp-install Index: run-configure-ascii.sh =================================================================== RCS file: /cvsroot/mockpp/mockpp/run-configure-ascii.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- run-configure-ascii.sh 7 Oct 2005 21:15:59 -0000 1.3 +++ run-configure-ascii.sh 1 Dec 2005 18:15:08 -0000 1.4 @@ -1,4 +1,16 @@ #!/bin/sh MYFLAGS="-O0 -g3 -Wall -Werror" -MYCC="ccache g++" -CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS" CXX=$MYCC CC=$MYCC ${0%/*}/configure --enable-debug=full --prefix=/tmp/mockpp-install \ No newline at end of file + +if which "gcc-4.0"; then + MYCC="ccache g++-4.0"; +else + MYCC="ccache g++"; +fi +echo mycc: $MYCC + + +#OPTS="--enable-doxygen --enable-docbook" +#OPTS="$OPTS --enable-builtin-stl --disable-rtti --disable-exceptions" +#OPTS="$OPTS --enable-debug=full" + +CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS" CXX=$MYCC CC=$MYCC ${0%/*}/configure $OPTS --prefix=/tmp/mockpp-install Index: configure.in =================================================================== RCS file: /cvsroot/mockpp/mockpp/configure.in,v retrieving revision 1.99 retrieving revision 1.100 diff -u -d -r1.99 -r1.100 --- configure.in 30 Nov 2005 21:47:31 -0000 1.99 +++ configure.in 1 Dec 2005 18:15:07 -0000 1.100 @@ -16,12 +16,12 @@ # if backwards compatibility has been broken, set MOCKPP_BINARY_AGE and MOCKPP_INTERFACE_AGE to 0. # MOCKPP_MAJOR_VERSION=1 -MOCKPP_MINOR_VERSION=10 +MOCKPP_MINOR_VERSION=11 MOCKPP_PATCH_VERSION=0 -MOCKPP_MICRO_VERSION=34 -MOCKPP_INTERFACE_AGE=0 -MOCKPP_BINARY_AGE=0 +MOCKPP_MICRO_VERSION=35 +MOCKPP_INTERFACE_AGE=1 +MOCKPP_BINARY_AGE=1 MOCKPP_VERSION=$MOCKPP_MAJOR_VERSION.$MOCKPP_MINOR_VERSION.$MOCKPP_PATCH_VERSION @@ -298,6 +298,7 @@ [Define to use built-in mini stl.]) fi ]) +AM_CONDITIONAL(BUILTIN_MINISTL, test x$enable_builtin_stl = xyes) dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 18:15:20
|
Update of /cvsroot/mockpp/mockpp/3party/ministl/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30919/3party/ministl/tests Modified Files: Makefile.am ministl_test.cpp Log Message: ministl basically working Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/tests/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 30 Nov 2005 21:46:34 -0000 1.2 +++ Makefile.am 1 Dec 2005 18:15:08 -0000 1.3 @@ -3,13 +3,17 @@ CLEANFILES = *.~* *.~~* *~ -check_PROGRAMS = ministl_test - # ministl_test_LDFLAGS = ministl_test_SOURCES = ministl_test.cpp ministl_test_LDADD = -lstdc++ +if BUILTIN_MINISTL + +TESTS = $(check_PROGRAMS) + +check_PROGRAMS = ministl_test +endif Index: ministl_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/tests/ministl_test.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ministl_test.cpp 30 Nov 2005 21:46:34 -0000 1.2 +++ ministl_test.cpp 1 Dec 2005 18:15:08 -0000 1.3 @@ -27,14 +27,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ -#include <new> - -#include <mockpp/mockpp.h> // always first #include <ministl/vector> #include <ministl/vector.h> #include <ministl/map> #include <ministl/map.h> +#include <ministl/multimap> #include <ministl/pair> #include <ministl/pair.h> #include <ministl/set> @@ -49,20 +47,101 @@ //#include <ministl/bool.h> #include <ministl/ministl.h> #include <ministl/simplevec.h> +#include <ministl/raw_iterator.h> +#include <ministl/reverse_iterator.h> -int main(int /*argc*/, char** /*argv*/) +#include <iostream> + +bool map_test() +{ + ministl::map<int, unsigned> mm; + ministl::pair<int, unsigned> p(11, 22u); + mm.insert(ministl::make_pair(11, 22u)); + mm.insert(p); + mm.insert(p); + + if (mm.size() != 1) + return 1; + + return 0; +} + + +bool multimap_test() +{ + ministl::multimap<unsigned, signed> mm; + mm.insert(ministl::make_pair(1u, 2)); + mm.insert(ministl::make_pair(1u, 2)); + mm.insert(ministl::make_pair<unsigned, signed>(1u, 2)); + + // lower_bound + // upper_bound +/* + if (mm.size() != 3) // @todo + return 1; +*/ + return 0; +} + + +bool vector_test() { ministl::vector<unsigned> vv; vv.push_back(1u); + vv.push_back(2u); + vv.push_back(3u); - ministl::map<unsigned, signed> mm; -// mm.insert(ministl::make_pair(1u, 2)); + std::cout << "Start iter-test:\n"; - ministl::pair<int, double> pp(1, 1.1); + ministl::vector<unsigned>::iterator fit = vv.begin(); + if (*fit != 1) + return 1; - ministl::set<double, int> ss; -// ss.insert(ministl::make_pair(1u, 2)); + while (fit != vv.end()) + std::cout << "fit++ " << *fit++ << std::endl; + + fit = vv.end(); + if (*(fit-1) != 3) + return 1; + + while (fit != vv.begin()) + std::cout << "fit-- " << *--fit << std::endl; + + std::cout << "reverse iter-test:\n"; + + ministl::vector<unsigned>::reverse_iterator rit = vv.rbegin(); + if (*rit != 3) + return 1; + + while (rit != vv.rend()) + std::cout << "rit++ " << *rit++ << std::endl; + + rit = vv.rend(); + if (*(rit-1) != 1) + return 1; + + while (rit != vv.rbegin()) + std::cout << "rit-- " << *--rit << std::endl; + + std::cout << "Ende iter-test: \n"; return 0; } + +int main(int /*argc*/, char** /*argv*/) +{ + unsigned ret = 0; + + ret |= vector_test(); + ret |= multimap_test(); + ret |= map_test(); + + ministl::pair<int, double> pp(1, 1.1); + + ministl::set<int> ss; + ss.insert(2); + + return ret; +} + |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 18:15:20
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30919/mockpp Modified Files: ChainableMockObject.h VerifyingTestCaller.h VerifyingTestCase.cpp VerifyingTestCase.h mockpp.h Log Message: ministl basically working Index: mockpp.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/mockpp.h,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- mockpp.h 30 Nov 2005 21:47:31 -0000 1.64 +++ mockpp.h 1 Dec 2005 18:15:08 -0000 1.65 @@ -170,6 +170,7 @@ // namespace ministl #define MOCKPP_STL ministl +#define MOCKPP_ALTERNATIVE_STL #else @@ -184,6 +185,7 @@ // namespace std #define MOCKPP_STL std +#undef MOCKPP_ALTERNATIVE_STL #endif Index: VerifyingTestCase.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VerifyingTestCase.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- VerifyingTestCase.cpp 1 Dec 2005 16:14:43 -0000 1.26 +++ VerifyingTestCase.cpp 1 Dec 2005 18:15:08 -0000 1.27 @@ -57,13 +57,13 @@ MOCKPP_EXPORT -VerifyingTestCase::VerifyingTestCase( const MOCKPP_STL::string &name) -#ifndef MOCKPP_ALTERNATIVE_STL +VerifyingTestCase::VerifyingTestCase( const std::string &name) : CppUnit::TestCase(name) +#ifdef MOCKPP_ALTERNATIVE_STL + , MockObject(MOCKPP_PCHAR("VerifyingTestCase/")+MOCKPP_GET_STRING(name.c_str()), 0) #else - : CppUnit::TestCase(name.c_str()) -#endif , MockObject(MOCKPP_PCHAR("VerifyingTestCase/")+MOCKPP_GET_STRING(name), 0) +#endif { } Index: VerifyingTestCaller.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VerifyingTestCaller.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- VerifyingTestCaller.h 28 Nov 2005 19:03:09 -0000 1.11 +++ VerifyingTestCaller.h 1 Dec 2005 18:15:08 -0000 1.12 @@ -64,7 +64,7 @@ * \param test the method this VerifyingTestCaller calls in runTest() * \param fixture the Fixture to invoke the test method on. */ - VerifyingTestCaller(const MOCKPP_STL::string &name, + VerifyingTestCaller(const std::string &name, TestCaseMethod test, VerifyingFixtureType& fixture) : ::CppUnit::TestCaller<VerifyingFixtureType>(name, test, fixture) @@ -80,7 +80,7 @@ * \param test the method this VerifyingTestCaller calls in runTest() * \param fixture the Fixture to invoke the test method on. */ - VerifyingTestCaller(const MOCKPP_STL::string &name, + VerifyingTestCaller(const std::string &name, TestCaseMethod test, VerifyingFixtureType* fixture) : ::CppUnit::TestCaller<VerifyingFixtureType>(name, test, fixture) Index: VerifyingTestCase.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VerifyingTestCase.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- VerifyingTestCase.h 26 Nov 2005 18:00:17 -0000 1.21 +++ VerifyingTestCase.h 1 Dec 2005 18:15:08 -0000 1.22 @@ -66,7 +66,7 @@ /** Constructs the test case. * @param name test case name */ - VerifyingTestCase( const MOCKPP_STL::string &name ); + VerifyingTestCase( const std::string &name ); /** Constructs the test case. */ Index: ChainableMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ChainableMockObject.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- ChainableMockObject.h 1 Dec 2005 16:15:24 -0000 1.31 +++ ChainableMockObject.h 1 Dec 2005 18:15:08 -0000 1.32 @@ -32,8 +32,6 @@ #include <mockpp/mockpp.h> // always first -#include MOCKPP_MULTIMAP_H - #include <mockpp/MockObject.h> #include <mockpp/chaining/ChainableMockObject_macro.h> |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 18:15:20
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30919/mockpp/tests Modified Files: Makefile.am VerifyingTestCaller_test.cpp Log Message: ministl basically working Index: VerifyingTestCaller_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VerifyingTestCaller_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VerifyingTestCaller_test.cpp 27 Nov 2005 17:27:57 -0000 1.8 +++ VerifyingTestCaller_test.cpp 1 Dec 2005 18:15:08 -0000 1.9 @@ -117,7 +117,7 @@ { VerifyingTestCaseDummy vd; mockpp::VerifyingTestCaller<VerifyingTestCaseDummy, true> - caller(MOCKPP_STL::string("caller"), &VerifyingTestCaseDummy::method, vd); + caller(std::string("caller"), &VerifyingTestCaseDummy::method, vd); caller.runTest(); MOCKPP_ASSERT_EQUALS((unsigned)2, vd.ver); MOCKPP_ASSERT_EQUALS((unsigned)3, vd.clr); @@ -128,7 +128,7 @@ { VerifyingTestCaseDummy *vd = new VerifyingTestCaseDummy; mockpp::VerifyingTestCaller<VerifyingTestCaseDummy, true> - caller(MOCKPP_STL::string("caller"), &VerifyingTestCaseDummy::method, vd); + caller(std::string("caller"), &VerifyingTestCaseDummy::method, vd); caller.runTest(); MOCKPP_ASSERT_EQUALS((unsigned)2, vd->ver); MOCKPP_ASSERT_EQUALS((unsigned)3, vd->clr); Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Makefile.am,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- Makefile.am 30 Oct 2005 20:27:30 -0000 1.88 +++ Makefile.am 1 Dec 2005 18:15:08 -0000 1.89 @@ -148,7 +148,7 @@ echo "// to check #include-ing of *all* headers" >>check_inst.cpp echo "// /*" >>check_inst.cpp (N=`pwd`/check_inst.cpp; cd $(srcdir)/../..; find . -name "*.h" \ - | grep -v "config" | grep -v "/tests/" | grep -v "/docs/" | grep -v "/examples/" \ + | grep -v "config" | grep -v "/tests/" | grep -v "/ministl/" | grep -v "/docs/" | grep -v "/examples/" \ | sed -e "s,\./,#include <,g" -e "s/\.h/\.h>/g" >>$$N) echo "// */" >>check_inst.cpp echo "int main()" >>check_inst.cpp |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 16:15:36
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27882/mockpp Modified Files: ChainableMockObject.h Log Message: fixes for ministl Index: ChainableMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ChainableMockObject.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- ChainableMockObject.h 26 Nov 2005 18:00:16 -0000 1.30 +++ ChainableMockObject.h 1 Dec 2005 16:15:24 -0000 1.31 @@ -32,6 +32,8 @@ #include <mockpp/mockpp.h> // always first +#include MOCKPP_MULTIMAP_H + #include <mockpp/MockObject.h> #include <mockpp/chaining/ChainableMockObject_macro.h> @@ -49,14 +51,15 @@ namespace mockpp { -/** Base for a generic object that can be used to replace a real world object for testing purposes. +/** Base for a generic object that can be used to replace a real world object + * for testing purposes. * It emulates the real world behaviour by feeding it "chained expectations". * \ingroup grp_advanced_mo */ class ChainableMockObjectBase : public BuilderNamespace { typedef MOCKPP_STL::map<String, MatchBuilderAdapterBase*> TableType; - typedef std::multimap<String, InvokedRecorder*> PendingType; + typedef MOCKPP_STL::multimap<String, InvokedRecorder*> PendingType; public: |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 16:14:54
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27668/mockpp Modified Files: VerifyingTestCase.cpp Log Message: fixes for ministl Index: VerifyingTestCase.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VerifyingTestCase.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- VerifyingTestCase.cpp 26 Nov 2005 18:00:17 -0000 1.25 +++ VerifyingTestCase.cpp 1 Dec 2005 16:14:43 -0000 1.26 @@ -58,7 +58,11 @@ MOCKPP_EXPORT VerifyingTestCase::VerifyingTestCase( const MOCKPP_STL::string &name) +#ifndef MOCKPP_ALTERNATIVE_STL : CppUnit::TestCase(name) +#else + : CppUnit::TestCase(name.c_str()) +#endif , MockObject(MOCKPP_PCHAR("VerifyingTestCase/")+MOCKPP_GET_STRING(name), 0) { } |
|
From: Ewald A. <ewa...@us...> - 2005-12-01 16:14:22
|
Update of /cvsroot/mockpp/mockpp/mockpp/compat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27575/mockpp/compat Modified Files: Formatter.h Log Message: fixes for ministl Index: Formatter.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/compat/Formatter.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- Formatter.h 27 Nov 2005 15:34:36 -0000 1.35 +++ Formatter.h 1 Dec 2005 16:14:09 -0000 1.36 @@ -356,7 +356,11 @@ { std::basic_ostringstream<wchar_t> oss; oss << t; +#ifndef MOCKPP_ALTERNATIVE_STL return oss.str(); +#else + return oss.str().c_str(); +#endif } } |
|
From: Ewald A. <ewa...@us...> - 2005-11-30 21:47:39
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10068/mockpp Modified Files: Makefile.am mockpp.h Log Message: fixes in ministl Index: mockpp.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/mockpp.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- mockpp.h 28 Nov 2005 19:03:09 -0000 1.63 +++ mockpp.h 30 Nov 2005 21:47:31 -0000 1.64 @@ -160,6 +160,7 @@ #ifdef MOCKPP_USE_MINI_STL #include <ministl/string> +#define MOCKPP_STRING_H <ministl/string> #define MOCKPP_VECTOR_H <ministl/vector> #define MOCKPP_MAP_H <ministl/map> #define MOCKPP_SET_H <ministl/set> @@ -173,6 +174,7 @@ #else #include <string> +#define MOCKPP_STRING_H <string> #define MOCKPP_VECTOR_H <vector> #define MOCKPP_MAP_H <map> #define MOCKPP_DEQUE_H <deque> Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/Makefile.am,v retrieving revision 1.96 retrieving revision 1.97 diff -u -d -r1.96 -r1.97 --- Makefile.am 31 Oct 2005 19:01:00 -0000 1.96 +++ Makefile.am 30 Nov 2005 21:47:31 -0000 1.97 @@ -112,6 +112,7 @@ grep HAVE_LIMITS ../config.h >>$@ grep HAVE_WSTRING ../config.h >>$@ grep HAVE_VALUES ../config.h >>$@ + grep MOCKPP_USE_MINI_STL ../config.h >>$@ mockpp_config-bcb5.h: perl -i.bak -pe "s/(.*mockpp_production)_(\d*)(\.lib|\.dll)/\1_$(LT_CURRENT)\3/g" $(top_srcdir)/bcb5/*.bpr $(top_srcdir)/bcb5/*.bpf $(top_srcdir)/bcb5/*.bpg $(top_srcdir)/bcbX/*.cbx |
|
From: Ewald A. <ewa...@us...> - 2005-11-30 21:47:39
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10068 Modified Files: configure.in mockpp.kdevelop run-configure-unicode.sh Log Message: fixes in ministl Index: run-configure-unicode.sh =================================================================== RCS file: /cvsroot/mockpp/mockpp/run-configure-unicode.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- run-configure-unicode.sh 27 Nov 2005 17:27:56 -0000 1.8 +++ run-configure-unicode.sh 30 Nov 2005 21:47:31 -0000 1.9 @@ -9,6 +9,6 @@ echo mycc: $MYCC # --disable-rtti --disable-exceptions -OPTS="--enable-doxygen --enable-docbook" +OPTS="--enable-doxygen --enable-docbook --enable-builtin-stl" CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS" CXX=$MYCC CC=$MYCC ${0%/*}/configure --enable-unicode --enable-debug=full $OPTS --prefix=/tmp/mockpp-install Index: mockpp.kdevelop =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp.kdevelop,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- mockpp.kdevelop 26 Nov 2005 18:27:30 -0000 1.81 +++ mockpp.kdevelop 30 Nov 2005 21:47:31 -0000 1.82 @@ -212,7 +212,7 @@ <hidenonlocation>true</hidenonlocation> </groups> <tree> - <hidepatterns></hidepatterns> + <hidepatterns>*~</hidepatterns> <hidenonprojectfiles>false</hidenonprojectfiles> <showvcsfields>false</showvcsfields> </tree> Index: configure.in =================================================================== RCS file: /cvsroot/mockpp/mockpp/configure.in,v retrieving revision 1.98 retrieving revision 1.99 diff -u -d -r1.98 -r1.99 --- configure.in 29 Nov 2005 23:31:15 -0000 1.98 +++ configure.in 30 Nov 2005 21:47:31 -0000 1.99 @@ -279,6 +279,27 @@ ]) dnl ------------------------------------------------------------------------ + +AC_DEFUN([EA_BUILTIN_STL], +[ +AC_ARG_ENABLE(builtin_stl, [ --enable-builtin-stl use built-in mini stl (no)]) + +if test x$enable_builtin_stl = xyes; then + echo "*******************************************************" + echo "** using builtin mini stl" + echo "*******************************************************" + AC_DEFINE(MOCKPP_USE_MINI_STL, 1, [Define to use built-in mini stl.]) + EA_EXTRA_INC="$EA_EXTRA_INC -I\$(top_srcdir)/3party" +else + echo "*******************************************************" + echo "** using regular stl" + echo "*******************************************************" + AH_TEMPLATE([MOCKPP_USE_MINI_STL], + [Define to use built-in mini stl.]) +fi +]) + +dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) dnl params: filename path result(NO = none) dnl ------------------------------------------------------------------------ @@ -364,6 +385,7 @@ EA_DISABLE_EXCEPTIONS EA_DISABLE_RTTI +EA_BUILTIN_STL EA_ENABLE_DOCBOOK EA_CHECK_LIBDL EA_ENABLE_DOXYGEN |
|
From: Ewald A. <ewa...@us...> - 2005-11-30 21:47:39
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10068/mockpp/tests Modified Files: ReturnObjectList_test.cpp Log Message: fixes in ministl Index: ReturnObjectList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ReturnObjectList_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ReturnObjectList_test.cpp 13 Nov 2005 11:53:18 -0000 1.16 +++ ReturnObjectList_test.cpp 30 Nov 2005 21:47:31 -0000 1.17 @@ -158,3 +158,4 @@ #endif // HAVE_CPPUNIT + |
|
From: Ewald A. <ewa...@us...> - 2005-11-30 21:46:46
|
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9898/3party/ministl Modified Files: algo.h basic_string.h defalloc.h function.h list map set simplevec.h string vector Log Message: fixes in ministl Index: function.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/function.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- function.h 29 Nov 2005 23:18:05 -0000 1.2 +++ function.h 30 Nov 2005 21:46:34 -0000 1.3 @@ -22,4 +22,5 @@ * mi...@in... */ -#include <ministl/function.h> +#include <ministl/functional> +//using namespace ministl; Index: map =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/map,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- map 29 Nov 2005 23:18:05 -0000 1.2 +++ map 30 Nov 2005 21:46:34 -0000 1.3 @@ -157,7 +157,7 @@ public: typedef keyT key_type; typedef pair<const keyT, valT> value_type; - typedef unsigned long size_type; + typedef std::size_t size_type; typedef simplevec<value_type *> rep_type; typedef mapIterator<keyT, valT, cmpT> iterator; typedef mapConstIterator<keyT, valT, cmpT> const_iterator; Index: set =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/set,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- set 29 Nov 2005 23:18:05 -0000 1.2 +++ set 30 Nov 2005 21:46:34 -0000 1.3 @@ -30,9 +30,8 @@ #include <ministl/simplevec.h> #include <ministl/functional> #include <ministl/pair> -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif + +//#include <ministl/bool.h> namespace ministl { @@ -156,7 +155,7 @@ { public: typedef valT value_type; - typedef unsigned long size_type; + typedef std::size_t size_type; typedef simplevec<value_type *> rep_type; typedef setIterator<valT, cmpT> iterator; typedef setConstIterator<valT, cmpT> const_iterator; Index: string =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/string,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- string 29 Nov 2005 23:24:18 -0000 1.3 +++ string 30 Nov 2005 21:46:34 -0000 1.4 @@ -17,6 +17,8 @@ #error Must use C++ for BSTRING.H #endif +#include <ministl/vector> + #ifndef MINISTL_MBSTRING_H #define MINISTL_MBSTRING_H @@ -35,9 +37,7 @@ // bool.h -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif +// #include <ministl/bool.h> // a typedef is less sweeping than a #define for "bool" #ifndef __BOOL_DEFINED @@ -85,13 +85,11 @@ #define _THROW_LENGTH_OUTRANGE #define _THROW_ALLOC_LENGTH_OUTRANGE -#include <ministl/vector> - #ifdef __MMULTITHREAD #include "mutex.h" #endif -const size_t NPOS = (size_t)(-1); +const size_t NPOS = (std::size_t)(-1); enum capacity { default_size, reserve }; @@ -182,7 +180,8 @@ } }; -template<> struct string_char_baggage<char> +template<> +struct string_char_baggage<char> { typedef char char_type; @@ -261,6 +260,7 @@ #ifdef MOCKPP_UNICODE +template<> struct string_char_baggage<wchar_t> { @@ -488,10 +488,11 @@ public: #if 1 - typedef unsigned long size_type; + typedef std::size_t size_type; #endif typedef charT char_type; typedef string_char_baggage<charT> baggage_type; + enum { npos = NPOS }; basic_string () _THROW_ALLOC ; @@ -2615,8 +2616,10 @@ typedef basic_string<char> cstring; typedef basic_string<char> string; -//typedef basic_string<wchar_t> wstring; +#ifdef MOCKPP_UNICODE +typedef basic_string<wchar_t> wstring; +#endif /* The following is a workaround for a compiler bug in some versions of the Apogee compiler. This looks pretty weird, and it shouldn't @@ -2627,7 +2630,6 @@ { pointer->~basic_string(); } - #endif } // namespace ministl Index: list =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/list,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- list 29 Nov 2005 23:18:05 -0000 1.2 +++ list 30 Nov 2005 21:46:34 -0000 1.3 @@ -213,7 +213,7 @@ { typedef listNode<T> node; public: - typedef unsigned long size_type; + typedef std::size_t size_type; typedef listIterator<T> iterator; typedef listConstIterator<T> const_iterator; private: Index: vector =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/vector,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- vector 29 Nov 2005 23:18:05 -0000 1.2 +++ vector 30 Nov 2005 21:46:34 -0000 1.3 @@ -45,7 +45,7 @@ public: typedef T* iterator; typedef const T* const_iterator; - typedef unsigned long size_type; + typedef std::size_t size_type; private: size_type _last, _size; Index: defalloc.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/defalloc.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- defalloc.h 29 Nov 2005 23:18:05 -0000 1.2 +++ defalloc.h 30 Nov 2005 21:46:34 -0000 1.3 @@ -13,10 +13,12 @@ * */ +//#include <new> + + #ifndef MINISTL_DEFALLOC_H #define MINISTL_DEFALLOC_H -#include <new> namespace ministl { Index: basic_string.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/basic_string.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- basic_string.h 29 Nov 2005 23:18:05 -0000 1.1 +++ basic_string.h 30 Nov 2005 21:46:34 -0000 1.2 @@ -25,4 +25,6 @@ #include <ministl/string> using ministl::string; using ministl::cstring; +#ifdef MOCKPP_UNICODE using ministl::wstring; +#endif Index: algo.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/algo.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- algo.h 29 Nov 2005 23:18:05 -0000 1.2 +++ algo.h 30 Nov 2005 21:46:34 -0000 1.3 @@ -22,5 +22,5 @@ * mi...@in... */ -#include <ministl/algo> -using namespace ministl; +#include <ministl/algorithm> +//using namespace ministl; Index: simplevec.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/simplevec.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- simplevec.h 29 Nov 2005 23:18:05 -0000 1.2 +++ simplevec.h 30 Nov 2005 21:46:34 -0000 1.3 @@ -43,7 +43,7 @@ public: typedef T* iterator; typedef const T* const_iterator; - typedef unsigned long size_type; + typedef std::size_t size_type; private: size_type _last, _size; T *_buf; |
|
From: Ewald A. <ewa...@us...> - 2005-11-30 21:46:46
|
Update of /cvsroot/mockpp/mockpp/3party/ministl/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9898/3party/ministl/tests Modified Files: Makefile.am ministl_test.cpp Log Message: fixes in ministl Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/tests/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 29 Nov 2005 23:18:05 -0000 1.1 +++ Makefile.am 30 Nov 2005 21:46:34 -0000 1.2 @@ -1,4 +1,4 @@ -INCLUDES = -I$(top_srcdir)/3party -I$(top_builddir) +INCLUDES = -I$(top_srcdir)/3party -I$(top_builddir) -I$(top_srcdir) DEFAULT_INCLUDES = $(INCLUDES) CLEANFILES = *.~* *.~~* *~ Index: ministl_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/tests/ministl_test.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ministl_test.cpp 29 Nov 2005 23:18:05 -0000 1.1 +++ ministl_test.cpp 30 Nov 2005 21:46:34 -0000 1.2 @@ -27,14 +27,28 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ +#include <new> + +#include <mockpp/mockpp.h> // always first #include <ministl/vector> +#include <ministl/vector.h> #include <ministl/map> +#include <ministl/map.h> #include <ministl/pair> +#include <ministl/pair.h> #include <ministl/set> +#include <ministl/set.h> #include <ministl/string> +#include <ministl/basic_string.h> #include <ministl/algorithm> +#include <ministl/algo.h> #include <ministl/functional> +#include <ministl/function.h> +#include <ministl/defalloc.h> +//#include <ministl/bool.h> +#include <ministl/ministl.h> +#include <ministl/simplevec.h> int main(int /*argc*/, char** /*argv*/) { |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:31:33
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30097 Modified Files: configure.in Makefile.am Log Message: include ministl Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/Makefile.am,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- Makefile.am 27 Nov 2005 17:27:56 -0000 1.35 +++ Makefile.am 29 Nov 2005 23:31:15 -0000 1.36 @@ -1,4 +1,4 @@ -SUBDIRS = tool config mockpp bcb5 bcb6 bcbX msvc6 msvc7 msvc71 +SUBDIRS = tool config 3party mockpp bcb5 bcb6 bcbX msvc6 msvc7 msvc71 LIBTOOL_DEPS = @LIBTOOL_DEPS@ Index: configure.in =================================================================== RCS file: /cvsroot/mockpp/mockpp/configure.in,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -r1.97 -r1.98 --- configure.in 27 Nov 2005 17:27:56 -0000 1.97 +++ configure.in 29 Nov 2005 23:31:15 -0000 1.98 @@ -434,6 +434,10 @@ bcbX/Makefile \ bcbX/cppunit-lib/Makefile \ \ + 3party/Makefile \ + 3party/ministl/Makefile \ + 3party/ministl/tests/Makefile \ + \ config/Makefile \ tool/Makefile \ \ |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:30:39
|
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29891/3party/ministl Modified Files: Makefile.am Log Message: include header in dist Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 29 Nov 2005 23:18:05 -0000 1.1 +++ Makefile.am 29 Nov 2005 23:30:31 -0000 1.2 @@ -2,7 +2,28 @@ CLEANFILES = *.~* *.~~* *~ -# EXTRA_DIST = +EXTRA_DIST =\ + !README \ + algo.h \ + algorithm \ + basic_string.h \ + string \ + bool.h \ + defalloc.h \ + function.h \ + functional \ + list.h \ + list \ + map.h \ + map \ + ministl.h \ + pair.h \ + pair \ + set.h \ + set \ + simplevec.h \ + vector.h \ + vector |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:24:26
|
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28198/3party/ministl Modified Files: string Log Message: update Index: string =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/string,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- string 29 Nov 2005 23:18:05 -0000 1.2 +++ string 29 Nov 2005 23:24:18 -0000 1.3 @@ -22,10 +22,10 @@ extern "C" { -#include <cctype> #ifdef MOCKPP_UNICODE #include <cwchar> #endif +#include <cctype> #include <cstring> #include <cstddef> #include <cstdlib> |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:24:06
|
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28063/3party/ministl Added Files: !README Log Message: new --- NEW FILE: !README --- The files herein were originally take from the mico project at http://www.mico.org. The content was moved into the namespace ministl. Some minor changes were made to reflect the current state of the stl and better fit into a minimalicstic mockpp testing environment. |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:18:15
|
Update of /cvsroot/mockpp/mockpp/3party/ministl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24832/3party/ministl Modified Files: algo.h algorithm bool.h defalloc.h function.h list list.h map map.h ministl.h pair pair.h set set.h simplevec.h string vector vector.h Added Files: Makefile.am basic_string.h functional Removed Files: bstring.h function Log Message: adopted to mockpp Index: function.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/function.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- function.h 27 Nov 2005 17:35:11 -0000 1.1 +++ function.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -1,285 +1,25 @@ /* + * MICO --- a free CORBA implementation + * Copyright (C) 1997-98 Kay Roemer & Arno Puder * - * Copyright (c) 1994 - * Hewlett-Packard Company + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * Send comments and/or bug reports to: + * mi...@in... */ -#ifndef FUNCTION_H -#define FUNCTION_H - -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif - -#if 0 -template <class T1, class T2> -inline bool operator!=(const T1& x, const T2& y) { - return !(x == y); -} -#endif - -template <class T1, class T2> -inline bool operator>(const T1& x, const T2& y) { - return y < x; -} - -template <class T1, class T2> -inline bool operator<=(const T1& x, const T2& y) { - return !(y < x); -} - -template <class T1, class T2> -inline bool operator>=(const T1& x, const T2& y) { - return !(x < y); -} - -template <class Arg, class Result> -struct unary_function { - typedef Arg argument_type; - typedef Result result_type; -}; - -template <class Arg1, class Arg2, class Result> -struct binary_function { - typedef Arg1 first_argument_type; - typedef Arg2 second_argument_type; - typedef Result result_type; -}; - -template <class T> -struct plus : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x + y; } -}; - -template <class T> -struct minus : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x - y; } -}; - -template <class T> -struct multiplies : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x * y; } -}; - -template <class T> -struct divides : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x / y; } -}; - -template <class T> -#ifdef __GNU__ -struct modulus { - typedef T first_argument_type; - typedef T second_argument_type; - typedef T result_type; - T operator()(const T& x, const T& y) const { return x % y; } -}; -#else -struct modulus : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x % y; } -}; -#endif - -template <class T> -struct negate : unary_function<T, T> { - T operator()(const T& x) const { return -x; } -}; - -template <class T> -struct equal_to : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x == y; } -}; - -template <class T> -struct not_equal_to : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x != y; } -}; - -template <class T> -struct greater : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x > y; } -}; - -template <class T> -struct less : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x < y; } -}; - -template <class T> -struct greater_equal : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x >= y; } -}; - -template <class T> -struct less_equal : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x <= y; } -}; - -template <class T> -struct logical_and : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x && y; } -}; - -template <class T> -struct logical_or : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x || y; } -}; - -template <class T> -struct logical_not : unary_function<T, bool> { - bool operator()(const T& x) const { return !x; } -}; - -template <class Predicate> -class unary_negate : public unary_function<typename Predicate::argument_type, bool> { -protected: - Predicate pred; -public: - unary_negate(const Predicate& x) : pred(x) {} - bool operator()(const typename Predicate::argument_type& x) const - { return !pred(x); } -}; - -template <class Predicate> -unary_negate<Predicate> not1(const Predicate& pred) { - return unary_negate<Predicate>(pred); -} - -template <class Predicate> -class binary_negate - : public binary_function<typename Predicate::first_argument_type, - typename Predicate::second_argument_type, bool> { -protected: - Predicate pred; -public: - binary_negate(const Predicate& x) : pred(x) {} - bool operator()(const typename Predicate::first_argument_type& x, - const typename Predicate::second_argument_type& y) const { - return !pred(x, y); - } -}; - -template <class Predicate> -binary_negate<Predicate> not2(const Predicate& pred) { - return binary_negate<Predicate>(pred); -} - -template <class Operation> -class binder1st : public unary_function<typename Operation::second_argument_type, - typename Operation::result_type> { -protected: - Operation op; - typename Operation::first_argument_type value; -public: - binder1st(const Operation& x, const typename Operation::first_argument_type& y) - : op(x), value(y) {} - typename Operation::result_type operator()(const typename Operation::argument_type& x) const { - return op(value, x); - } -}; - -template <class Operation, class T> -binder1st<Operation> bind1st(const Operation& op, const T& x) { - return binder1st<Operation>(op, Operation::first_argument_type(x)); -} - -template <class Operation> -class binder2nd : public unary_function<typename Operation::first_argument_type, - typename Operation::result_type> { -protected: - Operation op; - typename Operation::second_argument_type value; -public: - binder2nd(const Operation& x, const typename Operation::second_argument_type& y) - : op(x), value(y) {} - typename Operation::result_type operator()(const typename Operation::argument_type& x) const { - return op(x, value); - } -}; - -template <class Operation, class T> -binder2nd<Operation> bind2nd(const Operation& op, const T& x) { - return binder2nd<Operation>(op, Operation::second_argument_type(x)); -} - -template <class Operation1, class Operation2> -class unary_compose : public unary_function<typename Operation2::argument_type, - typename Operation1::result_type> { -protected: - Operation1 op1; - Operation2 op2; -public: - unary_compose(const Operation1& x, const Operation2& y) : op1(x), op2(y) {} - typename Operation1::result_type operator()(const typename Operation2::argument_type& x) const { - return op1(op2(x)); - } -}; - -template <class Operation1, class Operation2> -unary_compose<Operation1, Operation2> compose1(const Operation1& op1, - const Operation2& op2) { - return unary_compose<Operation1, Operation2>(op1, op2); -} - -template <class Operation1, class Operation2, class Operation3> -class binary_compose : public unary_function<typename Operation2::argument_type, - typename Operation1::result_type> { -protected: - Operation1 op1; - Operation2 op2; - Operation3 op3; -public: - binary_compose(const Operation1& x, const Operation2& y, - const Operation3& z) : op1(x), op2(y), op3(z) { } - typename Operation1::result_type operator()(const typename Operation2::argument_type& x) const { - return op1(op2(x), op3(x)); - } -}; - -template <class Operation1, class Operation2, class Operation3> -binary_compose<Operation1, Operation2, Operation3> -compose2(const Operation1& op1, const Operation2& op2, const Operation3& op3) { - return binary_compose<Operation1, Operation2, Operation3>(op1, op2, op3); -} - -template <class Arg, class Result> -class pointer_to_unary_function : public unary_function<Arg, Result> { -protected: - Result (*ptr)(Arg); -public: - pointer_to_unary_function() {} - pointer_to_unary_function(Result (*x)(Arg)) : ptr(x) {} - Result operator()(Arg x) const { return ptr(x); } -}; - -template <class Arg, class Result> -pointer_to_unary_function<Arg, Result> ptr_fun(Result (*x)(Arg)) { - return pointer_to_unary_function<Arg, Result>(x); -} - -template <class Arg1, class Arg2, class Result> -class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result> { -protected: - Result (*ptr)(Arg1, Arg2); -public: - pointer_to_binary_function() {} - pointer_to_binary_function(Result (*x)(Arg1, Arg2)) : ptr(x) {} - Result operator()(Arg1 x, Arg2 y) const { return ptr(x, y); } -}; - -template <class Arg1, class Arg2, class Result> -pointer_to_binary_function<Arg1, Arg2, Result> -ptr_fun(Result (*x)(Arg1, Arg2)) { - return pointer_to_binary_function<Arg1, Arg2, Result>(x); -} - -#endif +#include <ministl/function.h> --- function DELETED --- Index: set =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/set,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- set 27 Nov 2005 17:35:11 -0000 1.1 +++ set 29 Nov 2005 23:18:05 -0000 1.2 @@ -1,7 +1,10 @@ +// -*- c++ -*- /* * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -20,4 +23,374 @@ * mi...@in... */ -#include <ministl/set.h> +#ifndef __ministl_set_h__ +#define __ministl_set_h__ + +#include <ministl/ministl.h> +#include <ministl/simplevec.h> +#include <ministl/functional> +#include <ministl/pair> +#ifndef __GNUG__ +#include <ministl/bool.h> +#endif + +namespace ministl +{ + + +template<class vT, class cT> class set; +template<class vT, class cT> class setConstIterator; + +template<class vT, class cT> +class setIterator +{ + friend class set<vT,cT>; + friend class setConstIterator<vT,cT>; + typedef setIterator<vT,cT> my_type; + typedef vT value_type; + typedef simplevec<value_type *> rep_type; + typedef typename rep_type::iterator repiterator; + repiterator n; + + setIterator (repiterator _n) + : n (_n) + {} + public: + setIterator () + : n (0) + {} + bool operator== (const my_type &it) const + { + return it.n == n; + } + bool operator!= (const my_type &it) const + { + return !(it.n == n); + } + my_type operator++ () + { + ++n; + return *this; + } + my_type operator++ (int) + { + my_type tmp = *this; + ++n; + return tmp; + } + my_type operator-- () + { + --n; + return *this; + } + my_type operator-- (int) + { + my_type tmp = *this; + --n; + return tmp; + } + value_type &operator* () + { + return **n; + } +}; + +template<class vT, class cT> +class setConstIterator +{ + friend class set<vT,cT>; + typedef setConstIterator<vT,cT> my_type; + typedef vT value_type; + typedef simplevec<value_type *> rep_type; + typedef typename rep_type::const_iterator repiterator; + repiterator n; + + setConstIterator (repiterator _n) + : n (_n) + {} + public: + setConstIterator () + : n (0) + {} + setConstIterator (const setIterator<vT,cT> &i) + : n (i.n) + {} + bool operator== (const my_type &it) const + { + return it.n == n; + } + bool operator!= (const my_type &it) const + { + return !(it.n == n); + } + my_type operator++ () + { + ++n; + return *this; + } + my_type operator++ (int) + { + my_type tmp = *this; + ++n; + return tmp; + } + my_type operator-- () + { + --n; + return *this; + } + my_type operator-- (int) + { + my_type tmp = *this; + --n; + return tmp; + } + const value_type &operator* () const + { + return **n; + } +}; + +template<class valT, class cmpT> +class set + { + public: + typedef valT value_type; + typedef unsigned long size_type; + typedef simplevec<value_type *> rep_type; + typedef setIterator<valT, cmpT> iterator; + typedef setConstIterator<valT, cmpT> const_iterator; + // XXX typedefs done to work around g++ bug + typedef pair<iterator, bool> pair_iterator_bool; + private: + rep_type _ents; + cmpT _comp; + public: + iterator begin () + { + return iterator (_ents.begin()); + } + const_iterator begin () const + { + return const_iterator (_ents.begin()); + } + iterator end () + { + return iterator (_ents.end()); + } + const_iterator end () const + { + return const_iterator (_ents.end()); + } + set (const cmpT &comp = cmpT()) + : _comp (comp) + {} + set (const_iterator first, const_iterator last, const cmpT &comp = cmpT()) + : _comp (comp) + { + insert (first, last); + } + set (const set<valT, cmpT> &m) + : _comp (m._comp) + { + insert (m.begin(), m.end()); + } + set<valT, cmpT> &operator= (const set<valT, cmpT> &m) + { + if (this != &m) + { + _comp = m._comp; + erase (begin(), end()); + insert (m.begin(), m.end()); + } + return *this; + } + ~set () + { + erase (begin(), end()); + } + bool empty () const + { + return _ents.empty (); + } + size_type size () const + { + return _ents.size (); + } + private: + // find the iterator position where k should be inserted ... + bool lookup (const value_type &k, iterator &it); + public: + pair_iterator_bool insert (const value_type &v) + { + iterator i = end(); + if (size() > 0 && lookup (v, i)) + return pair_iterator_bool (i, false); + i = iterator (_ents.insert (i.n, new value_type (v))); + return pair_iterator_bool (i, true); + } +#if 0 + iterator insert (iterator pos, const value_type &v) + {} +#endif + + void insert (const_iterator first, const_iterator last) + { + for ( ; first != last; ++first) + insert (*first); + } + void insert (const value_type *first, const value_type *last) + { + for ( ; first != last; ++first) + insert (*first); + } + void erase (iterator pos) + { + if (pos != end()) + { + delete *(pos.n); + _ents.erase (pos.n); + } + } + size_type erase (const value_type &k) + { + iterator i = find (k); + if (i == end()) + return 0; + erase (i); + return 1; + } + void erase (iterator first, iterator last) + { + for (iterator i = first; i != last; ++i) + delete *(i.n); + _ents.erase (first.n, last.n); + } + void clear () + { + erase (begin(), end()); + } + iterator find (const value_type &k) + { + if (size() > 0) + { + int l = 0; + int r = size()-1; + do + { + int m = (l+r) >> 1; + if (_comp (*_ents[m], k)) + { + l = m+1; + } + else + { + // if (k == *_ents[m]) + if (!_comp (k, *_ents[m])) + return iterator (_ents.begin()+m); + r = m-1; + } + } + while (l <= r); + } + return end(); + } + const_iterator find (const value_type &k) const + { + if (size() > 0) + { + int l = 0; + int r = size()-1; + do + { + int m = (l+r) >> 1; + if (_comp (*_ents[m], k)) + { + l = m+1; + } + else + { + // if (k == *_ents[m]) + if (!_comp (k, *_ents[m])) + return const_iterator (_ents.begin()+m); + r = m-1; + } + } + while (l <= r); + } + return end(); + } + size_type count (const value_type &k) const + { + return find (k) != end() ? 1 : 0; + } + }; + +template<class vT, class cT> +inline bool +set<vT, cT>::lookup (const vT &k, setIterator<vT,cT> &it) +{ + int l = 0; + int r = size(); + while (l < r) + { + int m = (l+r) >> 1; + ministl_assert (m < r); + if (_comp (*_ents[m], k)) + { + l = m+1; + } + else + { + // if (k == *_ents[m]) { + if (!_comp (k, *_ents[m])) + { + it = setIterator<vT,cT> (_ents.begin()+m); + return true; + } + r = m; + } + } + ministl_assert (l == r); + it = setIterator<vT,cT> (_ents.begin()+l); + return l < (int)size() && + // k == *it + !_comp (*it, k) && !_comp (k, *it); +} + +template<class vT, class cT> +bool operator== (const set<vT,cT> &v1, const set<vT,cT> &v2) + { + if (v1.size() != v2.size()) + return false; + typename set<vT,cT>::const_iterator i1 = v1.begin(); + typename set<vT,cT>::const_iterator i2 = v2.begin(); + for ( ;i1 != v1.end() && i2 != v2.end(); ++i1, ++i2) + { + if (!(*i1 == *i2)) + return false; + } + return true; + } + +template<class vT, class cT> +bool operator< (const set<vT,cT> &v1, const set<vT,cT> &v2) + { + long minlast = _min_ (v1.size(), v2.size()); + typename set<vT,cT>::const_iterator i1 = v1.begin(); + typename set<vT,cT>::const_iterator i2 = v2.begin(); + for ( ;i1 != v1.end() && i2 != v2.end(); ++i1, ++i2) + { + if (*i1 < *i2) + return true; + if (*i2 < *i1) + return false; + } + return v1.size() < v2.size(); + } + + +} // namespace ministl + + +#endif // __ministl_set_h__ --- NEW FILE: functional --- /* * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ #ifndef MINISTL_FUNCTIONAL_H #define MINISTL_FUNCTIONAL_H //#include <ministl/bool.h> namespace ministl { #if 0 template <class T1, class T2> inline bool operator!=(const T1& x, const T2& y) { return !(x == y); } #endif template <class T1, class T2> inline bool operator>(const T1& x, const T2& y) { return y < x; } template <class T1, class T2> inline bool operator<=(const T1& x, const T2& y) { return !(y < x); } template <class T1, class T2> inline bool operator>=(const T1& x, const T2& y) { return !(x < y); } template <class Arg, class Result> struct unary_function { typedef Arg argument_type; typedef Result result_type; }; template <class Arg1, class Arg2, class Result> struct binary_function { typedef Arg1 first_argument_type; typedef Arg2 second_argument_type; typedef Result result_type; }; template <class T> struct plus : binary_function<T, T, T> { T operator()(const T& x, const T& y) const { return x + y; } }; template <class T> struct minus : binary_function<T, T, T> { T operator()(const T& x, const T& y) const { return x - y; } }; template <class T> struct multiplies : binary_function<T, T, T> { T operator()(const T& x, const T& y) const { return x * y; } }; template <class T> struct divides : binary_function<T, T, T> { T operator()(const T& x, const T& y) const { return x / y; } }; template <class T> #ifdef __GNU__ struct modulus { typedef T first_argument_type; typedef T second_argument_type; typedef T result_type; T operator()(const T& x, const T& y) const { return x % y; } }; #else struct modulus : binary_function<T, T, T> { T operator()(const T& x, const T& y) const { return x % y; } }; #endif template <class T> struct negate : unary_function<T, T> { T operator()(const T& x) const { return -x; } }; template <class T> struct equal_to : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x == y; } }; template <class T> struct not_equal_to : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x != y; } }; template <class T> struct greater : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x > y; } }; template <class T> struct less : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x < y; } }; template <class T> struct greater_equal : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x >= y; } }; template <class T> struct less_equal : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x <= y; } }; template <class T> struct logical_and : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x && y; } }; template <class T> struct logical_or : binary_function<T, T, bool> { bool operator()(const T& x, const T& y) const { return x || y; } }; template <class T> struct logical_not : unary_function<T, bool> { bool operator()(const T& x) const { return !x; } }; template <class Predicate> class unary_negate : public unary_function<typename Predicate::argument_type, bool> { protected: Predicate pred; public: unary_negate(const Predicate& x) : pred(x) {} bool operator()(const typename Predicate::argument_type& x) const { return !pred(x); } }; template <class Predicate> unary_negate<Predicate> not1(const Predicate& pred) { return unary_negate<Predicate>(pred); } template <class Predicate> class binary_negate : public binary_function<typename Predicate::first_argument_type, typename Predicate::second_argument_type, bool> { protected: Predicate pred; public: binary_negate(const Predicate& x) : pred(x) {} bool operator()(const typename Predicate::first_argument_type& x, const typename Predicate::second_argument_type& y) const { return !pred(x, y); } }; template <class Predicate> binary_negate<Predicate> not2(const Predicate& pred) { return binary_negate<Predicate>(pred); } template <class Operation> class binder1st : public unary_function<typename Operation::second_argument_type, typename Operation::result_type> { protected: Operation op; typename Operation::first_argument_type value; public: binder1st(const Operation& x, const typename Operation::first_argument_type& y) : op(x), value(y) {} typename Operation::result_type operator()(const typename Operation::argument_type& x) const { return op(value, x); } }; template <class Operation, class T> binder1st<Operation> bind1st(const Operation& op, const T& x) { return binder1st<Operation>(op, Operation::first_argument_type(x)); } template <class Operation> class binder2nd : public unary_function<typename Operation::first_argument_type, typename Operation::result_type> { protected: Operation op; typename Operation::second_argument_type value; public: binder2nd(const Operation& x, const typename Operation::second_argument_type& y) : op(x), value(y) {} typename Operation::result_type operator()(const typename Operation::argument_type& x) const { return op(x, value); } }; template <class Operation, class T> binder2nd<Operation> bind2nd(const Operation& op, const T& x) { return binder2nd<Operation>(op, Operation::second_argument_type(x)); } template <class Operation1, class Operation2> class unary_compose : public unary_function<typename Operation2::argument_type, typename Operation1::result_type> { protected: Operation1 op1; Operation2 op2; public: unary_compose(const Operation1& x, const Operation2& y) : op1(x), op2(y) {} typename Operation1::result_type operator()(const typename Operation2::argument_type& x) const { return op1(op2(x)); } }; template <class Operation1, class Operation2> unary_compose<Operation1, Operation2> compose1(const Operation1& op1, const Operation2& op2) { return unary_compose<Operation1, Operation2>(op1, op2); } template <class Operation1, class Operation2, class Operation3> class binary_compose : public unary_function<typename Operation2::argument_type, typename Operation1::result_type> { protected: Operation1 op1; Operation2 op2; Operation3 op3; public: binary_compose(const Operation1& x, const Operation2& y, const Operation3& z) : op1(x), op2(y), op3(z) { } typename Operation1::result_type operator()(const typename Operation2::argument_type& x) const { return op1(op2(x), op3(x)); } }; template <class Operation1, class Operation2, class Operation3> binary_compose<Operation1, Operation2, Operation3> compose2(const Operation1& op1, const Operation2& op2, const Operation3& op3) { return binary_compose<Operation1, Operation2, Operation3>(op1, op2, op3); } template <class Arg, class Result> class pointer_to_unary_function : public unary_function<Arg, Result> { protected: Result (*ptr)(Arg); public: pointer_to_unary_function() {} pointer_to_unary_function(Result (*x)(Arg)) : ptr(x) {} Result operator()(Arg x) const { return ptr(x); } }; template <class Arg, class Result> pointer_to_unary_function<Arg, Result> ptr_fun(Result (*x)(Arg)) { return pointer_to_unary_function<Arg, Result>(x); } template <class Arg1, class Arg2, class Result> class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result> { protected: Result (*ptr)(Arg1, Arg2); public: pointer_to_binary_function() {} pointer_to_binary_function(Result (*x)(Arg1, Arg2)) : ptr(x) {} Result operator()(Arg1 x, Arg2 y) const { return ptr(x, y); } }; template <class Arg1, class Arg2, class Result> pointer_to_binary_function<Arg1, Arg2, Result> ptr_fun(Result (*x)(Arg1, Arg2)) { return pointer_to_binary_function<Arg1, Arg2, Result>(x); } } // namespace ministl #endif --- NEW FILE: basic_string.h --- /* * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send comments and/or bug reports to: * mi...@in... */ #include <ministl/string> using ministl::string; using ministl::cstring; using ministl::wstring; Index: simplevec.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/simplevec.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- simplevec.h 27 Nov 2005 17:35:11 -0000 1.1 +++ simplevec.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -3,6 +3,8 @@ * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -25,246 +27,266 @@ #define __ministl_simplevec_h__ #include <ministl/ministl.h> -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif + +//#include <ministl/bool.h> + #include <ministl/defalloc.h> +namespace ministl +{ + + template<class T> -class simplevec { -public: +class simplevec +{ + public: typedef T* iterator; typedef const T* const_iterator; typedef unsigned long size_type; -private: + private: size_type _last, _size; T *_buf; -public: + public: const_iterator begin () const { - return &_buf[0]; + return &_buf[0]; } iterator begin () { - return &_buf[0]; + return &_buf[0]; } const_iterator end () const { - return &_buf[_last]; + return &_buf[_last]; } iterator end () { - return &_buf[_last]; + return &_buf[_last]; } size_type capacity () const { - return _size; + return _size; } size_type size () const { - return _last; + return _last; } -private: + private: static T *alloc (size_type n) { - return (T *)::operator new ((size_t)(n * sizeof (T))); + return (T *)::operator new ((size_t)(n * sizeof (T))); } static void dealloc (T *buf) { - if (buf) - ::operator delete (buf); + if (buf) + ::operator delete (buf); } void reserve (iterator where, size_type n) { - if (_last + n <= _size) { - memmove (where+n, where, (end()-where)*sizeof(T)); - } else { - long sz = _last+n; - sz = (_size == 0) ? _max_(sz, 5) : _max_(sz, 2*_size); - T *nbuf = alloc (sz); - if (_buf) { - memcpy (nbuf, begin(), (where-begin())*sizeof(T)); - memcpy (nbuf + (where-begin()) + n, where, - (end()-where)*sizeof(T)); - dealloc (_buf); - } - _buf = nbuf; - _size = sz; - } + if (_last + n <= _size) + { + memmove (where+n, where, (end()-where)*sizeof(T)); + } + else + { + long sz = _last+n; + sz = (_size == 0) ? _max_(sz, 5) : _max_(sz, 2*_size); + T *nbuf = alloc (sz); + if (_buf) + { + memcpy (nbuf, begin(), (where-begin())*sizeof(T)); + memcpy (nbuf + (where-begin()) + n, where, + (end()-where)*sizeof(T)); + dealloc (_buf); + } + _buf = nbuf; + _size = sz; + } } -public: + public: void reserve (size_type sz) { - if (_size < sz) { - sz = (_size == 0) ? _max_(sz, 5) : _max_(sz, 2*_size); - T *nbuf = alloc (sz); - if (_buf) { - memcpy (nbuf, begin(), size()*sizeof(T)); - dealloc (_buf); - } - _buf = nbuf; - _size = sz; - } + if (_size < sz) + { + sz = (_size == 0) ? _max_(sz, 5) : _max_(sz, 2*_size); + T *nbuf = alloc (sz); + if (_buf) + { + memcpy (nbuf, begin(), size()*sizeof(T)); + dealloc (_buf); + } + _buf = nbuf; + _size = sz; + } } simplevec () - : _last (0), _size (0), _buf (0) - { - } + : _last (0), _size (0), _buf (0) + {} simplevec (size_type n, const T& t = T()) - : _last (0), _size (0), _buf (0) + : _last (0), _size (0), _buf (0) { - insert (begin(), n, t); + insert (begin(), n, t); } simplevec (const_iterator first, const_iterator last) - : _last (0), _size (0), _buf (0) + : _last (0), _size (0), _buf (0) { - insert (begin(), first, last); + insert (begin(), first, last); } simplevec (const simplevec<T> &v) - : _last (0), _size (0), _buf (0) + : _last (0), _size (0), _buf (0) { - reserve (v._last); - memcpy (_buf, v.begin(), v.size()*sizeof(T)); - _last = v._last; + reserve (v._last); + memcpy (_buf, v.begin(), v.size()*sizeof(T)); + _last = v._last; } simplevec<T> &operator= (const simplevec<T> &v) { - if (this != &v) { - _last = 0; - reserve (v._last); - memcpy (_buf, v.begin(), v.size()*sizeof(T)); - _last = v._last; - } - return *this; + if (this != &v) + { + _last = 0; + reserve (v._last); + memcpy (_buf, v.begin(), v.size()*sizeof(T)); + _last = v._last; + } + return *this; } ~simplevec () { - dealloc (_buf); + dealloc (_buf); } const T &front () const { - //ministl_assert (size() > 0); - return _buf[0]; + //ministl_assert (size() > 0); + return _buf[0]; } T &front () { - //ministl_assert (size() > 0); - return _buf[0]; + //ministl_assert (size() > 0); + return _buf[0]; } const T &back () const { - //ministl_assert (size() > 0); - return _buf[_last-1]; + //ministl_assert (size() > 0); + return _buf[_last-1]; } T &back () { - //ministl_assert (size() > 0); - return _buf[_last-1]; + //ministl_assert (size() > 0); + return _buf[_last-1]; } bool empty () const { - return _last == 0; + return _last == 0; } void clear () { - _last = 0; + _last = 0; } void push_back (const T &t) { - reserve (_last+1); - *end() = t; - ++_last; + reserve (_last+1); + *end() = t; + ++_last; } void pop_back () { - //ministl_assert (size() > 0); - --_last; + //ministl_assert (size() > 0); + --_last; } const T &operator[] (size_type idx) const { - //ministl_assert (idx < size()); - return _buf[idx]; + //ministl_assert (idx < size()); + return _buf[idx]; } T &operator[] (size_type idx) { - //ministl_assert (idx < size()); - return _buf[idx]; + //ministl_assert (idx < size()); + return _buf[idx]; } iterator insert (iterator pos, const T &t) { - //ministl_assert (pos <= end()); - long at = pos - begin(); - reserve (pos, 1); - pos = begin()+at; - *pos = t; - ++_last; - return pos; + //ministl_assert (pos <= end()); + long at = pos - begin(); + reserve (pos, 1); + pos = begin()+at; + *pos = t; + ++_last; + return pos; } iterator insert (iterator pos, const_iterator first, const_iterator last) { - //ministl_assert (pos <= end()); - long n = last - first; - long at = pos - begin(); - if (n > 0) { - reserve (pos, n); - pos = begin()+at; - memcpy (pos, first, (last-first)*sizeof(T)); - _last += n; - } - return pos; + //ministl_assert (pos <= end()); + long n = last - first; + long at = pos - begin(); + if (n > 0) + { + reserve (pos, n); + pos = begin()+at; + memcpy (pos, first, (last-first)*sizeof(T)); + _last += n; + } + return pos; } iterator insert (iterator pos, size_type n, const T &t) { - //ministl_assert (pos <= end()); - long at = pos - begin(); - if (n > 0) { - reserve (pos, n); - pos = begin()+at; - for (int i = 0; i < n; ++i) - pos[i] = t; - _last += n; - } - return pos; + //ministl_assert (pos <= end()); + long at = pos - begin(); + if (n > 0) + { + reserve (pos, n); + pos = begin()+at; + for (int i = 0; i < n; ++i) + pos[i] = t; + _last += n; + } + return pos; } void erase (iterator first, iterator last) { - if (last != first) { - memmove (first, last, (end()-last)*sizeof(T)); - _last -= last - first; - } + if (last != first) + { + memmove (first, last, (end()-last)*sizeof(T)); + _last -= last - first; + } } void erase (iterator pos) { - if (pos != end()) { - memmove (pos, pos+1, (end()-(pos+1))*sizeof(T)); - --_last; - } + if (pos != end()) + { + memmove (pos, pos+1, (end()-(pos+1))*sizeof(T)); + --_last; + } } }; template<class T> bool operator== (const simplevec<T> &v1, const simplevec<T> &v2) { - if (v1.size() != v2.size()) - return false; - return !v1.size() || !memcmp (&v1[0], &v2[0], v1.size()*sizeof(T)); + if (v1.size() != v2.size()) + return false; + return !v1.size() || !memcmp (&v1[0], &v2[0], v1.size()*sizeof(T)); } template<class T> bool operator< (const simplevec<T> &v1, const simplevec<T> &v2) { - unsigned long minlast = _min_ (v1.size(), v2.size()); - for (unsigned long i = 0; i < minlast; ++i) { - if (v1[i] < v2[i]) - return true; - if (v2[i] < v1[i]) - return false; - } - return v1.size() < v2.size(); + unsigned long minlast = _min_ (v1.size(), v2.size()); + for (unsigned long i = 0; i < minlast; ++i) + { + if (v1[i] < v2[i]) + return true; + if (v2[i] < v1[i]) + return false; + } + return v1.size() < v2.size(); } + +} // namespace ministl + + #endif Index: algo.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/algo.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- algo.h 27 Nov 2005 17:35:11 -0000 1.1 +++ algo.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -1,82 +1,26 @@ /* + * MICO --- a free CORBA implementation + * Copyright (C) 1997-98 Kay Roemer & Arno Puder * - * Copyright (c) 1994 - * Hewlett-Packard Company + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * Send comments and/or bug reports to: + * mi...@in... */ -#ifndef ALGO_H -#define ALGO_H - -#include <stdlib.h> -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif -#include <ministl/pair> - -template <class InputIterator, class Function> -Function for_each(InputIterator first, InputIterator last, Function f) { - while (first != last) f(*first++); - return f; -} - -template <class InputIterator, class T> -InputIterator find(InputIterator first, InputIterator last, const T& value) { - while (first != last && *first != value) ++first; - return first; -} - -template <class InputIterator, class Predicate> -InputIterator find_if(InputIterator first, InputIterator last, - Predicate pred) { - while (first != last && !pred(*first)) ++first; - return first; -} - -template <class ForwardIterator> -ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last) { - if (first == last) return last; - ForwardIterator next = first; - while(++next != last) { - if (*first == *next) return first; - first = next; - } - return last; -} - -template <class ForwardIterator, class BinaryPredicate> -ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last, - BinaryPredicate binary_pred) { - if (first == last) return last; - ForwardIterator next = first; - while(++next != last) { - if (binary_pred(*first, *next)) return first; - first = next; - } - return last; -} - -template <class InputIterator, class T, class Size> -void count(InputIterator first, InputIterator last, const T& value, - Size& n) { - while (first != last) - if (*first++ == value) ++n; -} - -template <class InputIterator, class Predicate, class Size> -void count_if(InputIterator first, InputIterator last, Predicate pred, - Size& n) { - while (first != last) - if (pred(*first++)) ++n; -} - -#endif - +#include <ministl/algo> +using namespace ministl; --- NEW FILE: Makefile.am --- SUBDIRS = tests CLEANFILES = *.~* *.~~* *~ # EXTRA_DIST = Index: ministl.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/ministl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ministl.h 27 Nov 2005 17:35:11 -0000 1.1 +++ ministl.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -3,6 +3,8 @@ * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -35,14 +37,23 @@ #define ministl_assert(exp) assert(exp) #endif + +namespace ministl +{ + + static inline long _min_ (long x, long y) { - return x < y ? x : y; + return x < y ? x : y; } static inline long _max_ (long x, long y) { - return x > y ? x : y; + return x > y ? x : y; } + +} // namespace ministl + + #endif // __ministl_ministl_h__ --- bstring.h DELETED --- Index: list.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/list.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- list.h 27 Nov 2005 17:35:11 -0000 1.1 +++ list.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -1,8 +1,9 @@ -// -*- c++ -*- /* * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -21,392 +22,5 @@ * mi...@in... */ -#ifndef __ministl_list_h__ -#define __ministl_list_h__ - -#include <ministl/ministl.h> -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif - -template<class T> -class listNode { - listNode<T> *_prev, *_next; - T _data; -public: - listNode (const T &data = T(), listNode<T> *next = 0, - listNode<T> *prev = 0) - : _prev (prev), _next (next), _data (data) - { - } - ~listNode () - { - ministl_assert (!_next && !_prev); - } - void remove () - { - if (_prev) - _prev->_next = _next; - if (_next) - _next->_prev = _prev; - _next = _prev = 0; - } - void insert_after (listNode<T> *ln) - { - ministl_assert (ln); - _next = _prev = 0; - if (ln->_next) - ln->_next->_prev = this; - _next = ln->_next; - ln->_next = this; - _prev = ln; - } - void insert_before (listNode<T> *ln) - { - ministl_assert (ln); - _next = _prev = 0; - if (ln->_prev) - ln->_prev->_next = this; - _prev = ln->_prev; - ln->_prev = this; - _next = ln; - } - const T &data () const - { - return _data; - } - T &data () - { - return _data; - } - listNode<T> *next () - { - return _next; - } - listNode<T> *prev () - { - return _prev; - } -}; - -template<class T> class list; -template<class T> class listConstIterator; - -template<class T> -class listIterator { - friend class list<T>; - friend class listConstIterator<T>; - typedef listNode<T> node; - node *n; - listIterator (node *_n) - : n (_n) - { - } -public: - listIterator () - : n (0) - { - } - bool operator== (const listIterator<T> &it) const - { - return it.n == n; - } - bool operator!= (const listIterator<T> &it) const - { - return !(it.n == n); - } - listIterator<T> operator++ () - { - n = n->next(); - ministl_assert (n); - return *this; - } - listIterator<T> operator++ (int) - { - listIterator<T> tmp = *this; - n = n->next(); - ministl_assert (n); - return tmp; - } - listIterator<T> operator-- () - { - n = n->prev(); - ministl_assert (n); - return *this; - } - listIterator<T> operator-- (int) - { - listIterator<T> tmp = *this; - n = n->prev(); - ministl_assert (n); - return tmp; - } - T &operator* () - { - return n->data(); - } -}; - -template<class T> -class listConstIterator { - friend class list<T>; - typedef listNode<T> node; - node *n; - listConstIterator (node *_n) - : n (_n) - { - } -public: - listConstIterator () - : n (0) - { - } - listConstIterator (const listIterator<T> &i) - : n (i.n) - { - } - bool operator== (const listConstIterator<T> &it) const - { - return it.n == n; - } - bool operator!= (const listConstIterator<T> &it) const - { - return !(it.n == n); - } - listConstIterator<T> operator++ () - { - n = n->next(); - ministl_assert (n); - return *this; - } - listConstIterator<T> operator++ (int) - { - listConstIterator<T> tmp = *this; - n = n->next(); - ministl_assert (n); - return tmp; - } - listConstIterator<T> operator-- () - { - n = n->prev(); - ministl_assert (n); - return *this; - } - listConstIterator<T> operator-- (int) - { - listConstIterator<T> tmp = *this; - n = n->prev(); - ministl_assert (n); - return tmp; - } - const T &operator* () const - { - return n->data(); - } -}; - -template<class T> -class list { - typedef listNode<T> node; -public: - typedef unsigned long size_type; - typedef listIterator<T> iterator; - typedef listConstIterator<T> const_iterator; -private: - node *_begin; - node *_end; - size_type _length; -public: -#if 0 - void __check () - { - node *n = _begin; - while (n->next()) - n = n->next(); - assert (n == _end); - } -#endif - iterator begin () - { - return iterator (_begin); - } - const_iterator begin () const - { - return const_iterator (_begin); - } - iterator end () - { - return iterator (_end); - } - const_iterator end () const - { - return const_iterator (_end); - } - list () - : _length (0) - { - _begin = _end = new node (); - } - list (size_type n, const T &t = T()) - : _length (0) - { - _begin = _end = new node (); - insert (begin(), n, t); - } - list (const T *first, const T *last) - : _length (0) - { - _begin = _end = new node (); - insert (begin(), first, last); - } - list (const_iterator first, const_iterator last) - : _length (0) - { - _begin = _end = new node (); - insert (begin(), first, last); - } - typedef list<T> list_T; - list (const list_T &list_) - : _length (0) - { - _begin = _end = new node (); - insert (begin(), list_.begin(), list_.end()); - } - list<T> &operator= (const list<T> &list_) - { - if (this != &list_) { - erase (begin(), end()); - insert (begin(), list_.begin(), list_.end()); - } - return *this; - } - ~list () - { - erase (begin(), end()); - delete _end; - } - T &front () - { - return _begin->data(); - } - const T &front () const - { - return _begin->data(); - } - T &back () - { - ministl_assert (_end->prev()); - return _end->prev()->data(); - } - const T &back () const - { - ministl_assert (_end->prev()); - return _end->prev()->data(); - } - bool empty () const - { - return _length == 0; - } - void clear () - { - erase (begin(), end()); - } - size_type size () const - { - return _length; - } - void push_front (const T &t) - { - insert (begin(), t); - } - void pop_front () - { - ministl_assert (size() > 0); - erase (begin()); - } - void push_back (const T &t) - { - insert (end(), t); - } - void pop_back () - { - ministl_assert (size() > 0); - erase (--end()); - } - iterator insert (iterator pos, const T &t) - { - node *n = new node (t); - n->insert_before (pos.n); - if (pos.n == _begin) - _begin = n; - ++_length; - return iterator (n); - } - void insert (iterator pos, size_type n, const T &t) - { - for (size_type i = 0; i < n; ++i) - insert (pos, t); - } - void insert (iterator pos, const T *first, const T *last) - { - for ( ; first != last; ++first) - insert (pos, *first); - } - void insert (iterator pos, const_iterator first, const_iterator last) - { - for ( ; first != last; ++first) - insert (pos, *first); - } - void erase (iterator pos) - { - if (pos != end()) { - ministl_assert (pos.n != _end); - if (pos.n == _begin) - _begin = _begin->next(); - pos.n->remove (); - delete pos.n; - pos.n = 0; - --_length; - } - } - void erase (iterator first, iterator last) - { - iterator next; - while (first != last) { - next = first; - ++next; - // XXX first must be incremented before erasing! - erase (first); - first = next; - } - } -}; - -template<class T> -bool operator== (const list<T> &v1, const list<T> &v2) -{ - if (v1.size() != v2.size()) - return false; - typename list<T>::const_iterator i1 = v1.begin(); - typename list<T>::const_iterator i2 = v2.begin(); - for ( ;i1 != v1.end() && i2 != v2.end(); ++i1, ++i2) { - if (!(*i1 == *i2)) - return false; - } - return true; -} - -template<class T> -bool operator< (const list<T> &v1, const list<T> &v2) -{ - long minlast = _min_ (v1.size(), v2.size()); - typename list<T>::const_iterator i1 = v1.begin(); - typename list<T>::const_iterator i2 = v2.begin(); - for ( ;i1 != v1.end() && i2 != v2.end(); ++i1, ++i2) { - if (!(*i1 == *i2)) - return *i1 < *i2; - } - return v1.size() < v2.size(); -} - -#endif // __ministl_list_h__ +#include <ministl/list> +using ministl::list; Index: vector.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/vector.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vector.h 27 Nov 2005 17:35:11 -0000 1.1 +++ vector.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -1,8 +1,9 @@ -// -*- c++ -*- /* * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * + * Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -21,324 +22,5 @@ * mi...@in... */ -#ifndef __ministl_vector_h__ -#define __ministl_vector_h__ - -#include <ministl/ministl.h> -#ifndef __GNUG__ -#include <ministl/bool.h> -#endif -#include <ministl/defalloc.h> - - -namespace ministl -{ - - -template<class T> -class vector -{ - public: - typedef T* iterator; - typedef const T* const_iterator; - typedef unsigned long size_type; - - private: - size_type _last, _size; - T *_buf; - - public: - const_iterator begin () const - { - return &_buf[0]; - } - iterator begin () - { - return &_buf[0]; - } - const_iterator end () const - { - return &_buf[_last]; - } - iterator end () - { - return &_buf[_last]; - } - size_type capacity () const - { - return _size; - } - size_type size () const - { - return _last; - } - - private: - static T *alloc (size_type n) - { - return (T *)::operator new ((size_t)(n * sizeof (T))); - } - static void dealloc (T *buf) - { - if (buf) - ::operator delete (buf); - } - - // overlapping move to the right - static void copy_forward (T* d, const T* sstart, const T* send) - { - d += send - sstart; - while (send != sstart) - *--d = *--send; - } - // overlapping move to the left - static void copy_backward (T* d, const T* sstart, const T* send) - { - for ( ; send != sstart; ++d, ++sstart) - *d = *sstart; - } - - static void construct (T *d, const T &t) - { - new (d) T(t); - } - - static void construct (T *d, const T *sstart, const T *send) - { - for ( ; sstart != send; ++sstart, ++d) - construct (d, *sstart); - } - - static void fill (iterator d, size_type n, const T &t) - { - for (size_type i = 0; i < n; ++i, ++d) - construct (d, t); - } - - void reserve (iterator where, size_type n) - { - if (_last + n <= _size) - { - if (where+n < end()) - { - construct (end(), end()-n, end()); - copy_forward (where+n, where, end()-n); - destroy (where, where+n); - } - else - { - construct (where+n, where, end()); - destroy (where, end()); - } - } - else - { - long sz = _last+n; - sz = (_size == 0) ? _max_(sz, 5) : _max_(sz, 2*_size); - T *nbuf = alloc (sz); - if (_buf) - { - construct (nbuf, begin(), where); - construct (nbuf + (where-begin()) + n, where, end()); - destroy (begin(), end()); - dealloc (_buf); - } - _buf = nbuf; - _size = sz; - } - } - public: - void reserve (size_type sz) - { - if (_size < sz) - { - sz = (_size == 0) ? _max_(sz, 5) : _max_(sz, 2*_size); - T *nbuf = alloc (sz); - if (_buf) - { - construct (nbuf, begin(), end()); - destroy (begin(), end()); - dealloc (_buf); - } - _buf = nbuf; - _size = sz; - } - } - vector () - : _last (0), _size (0), _buf (0) - {} - vector (size_type n, const T& t = T()) - : _last (0), _size (0), _buf (0) - { - insert (begin(), n, t); - } - vector (const_iterator first, const_iterator last) - : _last (0), _size (0), _buf (0) - { - insert (begin(), first, last); - } - vector (const vector<T> &v) - : _last (0), _size (0), _buf (0) - { - reserve (v._last); - construct (begin(), v.begin(), v.end()); - _last = v._last; - } - vector<T> &operator= (const vector<T> &v) - { - if (this != &v) - { - destroy (begin(), end()); - _last = 0; - reserve (v._last); - construct (begin(), v.begin(), v.end()); - _last = v._last; - } - return *this; - } - ~vector () - { - destroy (begin(), end()); - dealloc (_buf); - } - const T &front () const - { - ministl_assert (size() > 0); - return _buf[0]; - } - T &front () - { - ministl_assert (size() > 0); - return _buf[0]; - } - const T &back () const - { - ministl_assert (size() > 0); - return _buf[_last-1]; - } - T &back () - { - ministl_assert (size() > 0); - return _buf[_last-1]; - } - bool empty () const - { - return _last == 0; - } - void clear () - { - destroy (begin(), end()); - _last = 0; - } - void push_back (const T &t) - { - reserve (_last+1); - construct (end(), t); - ++_last; - } - void pop_back () - { - ministl_assert (size() > 0); - --_last; - destroy (end()); - } - const T &operator[] (size_type idx) const - { - ministl_assert (idx < size()); - return _buf[idx]; - } - T &operator[] (size_type idx) - { - ministl_assert (idx < size()); - return _buf[idx]; - } - iterator insert (iterator pos, const T &t) - { - ministl_assert (pos <= end()); - long at = pos - begin(); - reserve (pos, 1); - pos = begin()+at; - construct (pos, t); - ++_last; - return pos; - } - iterator insert (iterator pos, const_iterator first, const_iterator last) - { - ministl_assert (pos <= end()); - long n = last - first; - long at = pos - begin(); - if (n > 0) - { - reserve (pos, n); - pos = begin()+at; - construct (pos, first, last); - _last += n; - } - return pos; - } - iterator insert (iterator pos, size_type n, const T &t) - { - ministl_assert (pos <= end()); - long at = pos - begin(); - if (n > 0) - { - reserve (pos, n); - pos = begin()+at; - fill (pos, n, t); - _last += n; - } - return pos; - } - void erase (iterator first, iterator last) - { - if (last != first) - { - copy_backward (first, last, end()); - destroy (end() - (last-first), end()); - _last -= last - first; - } - } - void erase (iterator pos) - { - if (pos != end()) - { - copy_backward (pos, pos+1, end()); - destroy (end()-1); - --_last; - } - } -}; - -template<class T> -bool operator== (const vector<T> &v1, const vector<T> &v2) -{ - if (v1.size() != v2.size()) - return false; - for (unsigned long i = 0; i < v1.size(); ++i) - { - if (!(v1[i] == v2[i])) - return false; - } - return true; -} - -template<class T> -bool operator< (const vector<T> &v1, const vector<T> &v2) -{ - unsigned long minlast = _min_ (v1.size(), v2.size()); - for (unsigned long i = 0; i < minlast; ++i) - { - if (v1[i] < v2[i]) - return true; - if (v2[i] < v1[i]) - return false; - } - return v1.size() < v2.size(); -} - - -} // namespace ministl - - -#endif - +#include <ministl/vector> +using ministl::vector; Index: defalloc.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/3party/ministl/defalloc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- defalloc.h 27 Nov 2005 17:35:11 -0000 1.1 +++ defalloc.h 29 Nov 2005 23:18:05 -0000 1.2 @@ -1,5 +1,5 @@ /* - * +* Copyright (C) 2005 Ewald Arnold mockpp at ewald-arnold dot de * * Copyright (c) 1994 * Hewlett-Packard Company * @@ -16,11 +16,16 @@ #ifndef MINISTL_DEFALLOC_H #define MINISTL_DEFALLOC_H +#include <new> + +namespace ministl +{ + template <class T> inline void destroy(T* pointer) { - pointer->~T(); + pointer->~T(); } template<> inline void destroy(char*) {} @@ -48,8 +53,8 @@ template <c... [truncated message content] |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:18:12
|
Update of /cvsroot/mockpp/mockpp/3party/ministl/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24832/3party/ministl/tests Added Files: .cvsignore Makefile.am ministl_test.cpp Log Message: adopted to mockpp --- NEW FILE: .cvsignore --- *.xmi Makefile .directory Makefile.in *.~* .libs .deps *.lo *.la *.loT *.old --- NEW FILE: Makefile.am --- INCLUDES = -I$(top_srcdir)/3party -I$(top_builddir) DEFAULT_INCLUDES = $(INCLUDES) CLEANFILES = *.~* *.~~* *~ check_PROGRAMS = ministl_test # ministl_test_LDFLAGS = ministl_test_SOURCES = ministl_test.cpp ministl_test_LDADD = -lstdc++ --- NEW FILE: ministl_test.cpp --- /*************************************************************************** ministl_test.cpp - ------------------- begin : Tue Nov 28 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de $Id: ministl_test.cpp,v 1.1 2005/11/29 23:18:05 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ #include <ministl/vector> #include <ministl/map> #include <ministl/pair> #include <ministl/set> #include <ministl/string> #include <ministl/algorithm> #include <ministl/functional> int main(int /*argc*/, char** /*argv*/) { ministl::vector<unsigned> vv; vv.push_back(1u); ministl::map<unsigned, signed> mm; // mm.insert(ministl::make_pair(1u, 2)); ministl::pair<int, double> pp(1, 1.1); ministl::set<double, int> ss; // ss.insert(ministl::make_pair(1u, 2)); return 0; } |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 23:18:12
|
Update of /cvsroot/mockpp/mockpp/3party In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24832/3party Added Files: Makefile.am Log Message: adopted to mockpp --- NEW FILE: Makefile.am --- SUBDIRS = ministl CLEANFILES = *.~* *.~~* *~ # EXTRA_DIST = |
|
From: Ewald A. <ewa...@us...> - 2005-11-29 22:44:27
|
Update of /cvsroot/mockpp/mockpp/3party/ministl/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13243/3party/ministl/tests Log Message: Directory /cvsroot/mockpp/mockpp/3party/ministl/tests added to the repository |
|
From: Ewald A. <ewa...@us...> - 2005-11-28 19:03:44
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24721/mockpp Modified Files: VerifyingTestCaller.h VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h VisitableMockMethod6.h VisitableMockObject_macro.h gen_visitablemethod_N.pl mockpp.h Log Message: optionally disable exceptions Index: VisitableMockObject_macro.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockObject_macro.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- VisitableMockObject_macro.h 26 Nov 2005 18:00:17 -0000 1.35 +++ VisitableMockObject_macro.h 28 Nov 2005 19:03:09 -0000 1.36 @@ -727,15 +727,15 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ m_name ## Parameter1.addActual((v_type1&)param1); \ return; \ @@ -778,16 +778,16 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ m_name ## Parameter1.addActual((v_type1&)param1); \ m_name ## Parameter2.addActual((v_type2&)param2); \ @@ -836,17 +836,17 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ m_name ## Parameter3.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ m_name ## Parameter1.addActual((v_type1&)param1); \ m_name ## Parameter2.addActual((v_type2&)param2); \ @@ -901,18 +901,18 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ m_name ## Parameter3.balanceActual(); \ m_name ## Parameter4.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ m_name ## Parameter1.addActual((v_type1&)param1); \ m_name ## Parameter2.addActual((v_type2&)param2); \ @@ -973,19 +973,19 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4, (v_type5)param5)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ m_name ## Parameter3.balanceActual(); \ m_name ## Parameter4.balanceActual(); \ m_name ## Parameter5.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ m_name ## Parameter1.addActual((v_type1&)param1); \ m_name ## Parameter2.addActual((v_type2&)param2); \ @@ -1077,15 +1077,15 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ m_name ## Parameter1.addActual((v_type1&)param1); \ \ @@ -1141,16 +1141,16 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ \ m_name ## Parameter1.addActual((v_type1&)param1); \ @@ -1212,17 +1212,17 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ m_name ## Parameter3.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ \ m_name ## Parameter1.addActual((v_type1&)param1); \ @@ -1289,18 +1289,18 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ m_name ## Parameter3.balanceActual(); \ m_name ## Parameter4.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ \ m_name ## Parameter1.addActual((v_type1&)param1); \ @@ -1373,19 +1373,19 @@ } \ else \ { \ - try { \ + MOCKPP_TRY { \ addActualMethod(mockpp::getLatin1(getVerifiableName()) + "." + func_name); \ mockpp::Throwable *t; \ if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4, (v_type5)param5)) \ t->throw_me(); \ MOCKPP_THROWER_IMPL(m_name); \ - } catch(...) { \ + } MOCKPP_CATCH_ALL { \ m_name ## Parameter1.balanceActual(); \ m_name ## Parameter2.balanceActual(); \ m_name ## Parameter3.balanceActual(); \ m_name ## Parameter4.balanceActual(); \ m_name ## Parameter5.balanceActual(); \ - throw; \ + MOCKPP_RETHROW; \ } \ \ m_name ## Parameter1.addActual((v_type1&)param1); \ Index: VisitableMockMethod6.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod6.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod6.h 19 Nov 2005 14:16:38 -0000 1.9 +++ VisitableMockMethod6.h 28 Nov 2005 19:03:09 -0000 1.10 @@ -129,7 +129,7 @@ parameter4.balanceActual(); parameter5.balanceActual(); parameter6.balanceActual(); - throw; + MOCKPP_RETHROW; } parameter1.addActual(p1); Index: VisitableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod2.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- VisitableMockMethod2.h 19 Nov 2005 14:16:38 -0000 1.11 +++ VisitableMockMethod2.h 28 Nov 2005 19:03:09 -0000 1.12 @@ -105,7 +105,7 @@ { parameter1.balanceActual(); parameter2.balanceActual(); - throw; + MOCKPP_RETHROW; } parameter1.addActual(p1); Index: VerifyingTestCaller.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VerifyingTestCaller.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- VerifyingTestCaller.h 26 Nov 2005 18:00:17 -0000 1.10 +++ VerifyingTestCaller.h 28 Nov 2005 19:03:09 -0000 1.11 @@ -93,18 +93,20 @@ virtual void runTest() { testcase->unregisterVerifiables(); - try + MOCKPP_TRY { - ::CppUnit::TestCaller<VerifyingFixtureType>::runTest(); + ::CppUnit::TestCaller<VerifyingFixtureType>::runTest(); bool doVerify = DoTheVerify; if (doVerify) testcase->verify(); } +#ifndef MOCKPP_NO_EXCEPTIONS catch(...) { testcase->unregisterVerifiables(); - throw; + MOCKPP_RETHROW; } +#endif testcase->unregisterVerifiables(); } Index: gen_visitablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_visitablemethod_N.pl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- gen_visitablemethod_N.pl 19 Nov 2005 14:16:38 -0000 1.13 +++ gen_visitablemethod_N.pl 28 Nov 2005 19:03:09 -0000 1.14 @@ -259,7 +259,7 @@ parameter" . $p . ".balanceActual();"; } print OUT " - throw; + MOCKPP_RETHROW; } "; Index: VisitableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod3.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- VisitableMockMethod3.h 19 Nov 2005 14:16:38 -0000 1.11 +++ VisitableMockMethod3.h 28 Nov 2005 19:03:09 -0000 1.12 @@ -111,7 +111,7 @@ parameter1.balanceActual(); parameter2.balanceActual(); parameter3.balanceActual(); - throw; + MOCKPP_RETHROW; } parameter1.addActual(p1); Index: mockpp.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/mockpp.h,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- mockpp.h 27 Nov 2005 17:27:56 -0000 1.62 +++ mockpp.h 28 Nov 2005 19:03:09 -0000 1.63 @@ -201,8 +201,10 @@ #ifndef MOCKPP_NO_EXCEPTIONS #define MOCKPP_THROW(x) throw (x) +#define MOCKPP_RETHROW throw #define MOCKPP_TRY try #define MOCKPP_CATCH(x) (x) +#define MOCKPP_CATCH_ALL catch(...) #else @@ -212,6 +214,10 @@ # define MOCKPP_THROW(x) /**/ # endif +# ifndef MOCKPP_RETHROW +# define MOCKPP_RETHROW /**/ +# endif + # ifndef MOCKPP_TRY # define MOCKPP_TRY /**/ # endif @@ -220,6 +226,10 @@ # define MOCKPP_CATCH(x) if(false) # endif +# ifndef MOCKPP_CATCH_ALL +# define MOCKPP_CATCH_ALL +# endif + #endif ////////////////////////////////////////////////// Index: VisitableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod4.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- VisitableMockMethod4.h 19 Nov 2005 14:16:38 -0000 1.11 +++ VisitableMockMethod4.h 28 Nov 2005 19:03:09 -0000 1.12 @@ -117,7 +117,7 @@ parameter2.balanceActual(); parameter3.balanceActual(); parameter4.balanceActual(); - throw; + MOCKPP_RETHROW; } parameter1.addActual(p1); Index: VisitableMockMethod5.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod5.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- VisitableMockMethod5.h 19 Nov 2005 14:16:38 -0000 1.11 +++ VisitableMockMethod5.h 28 Nov 2005 19:03:09 -0000 1.12 @@ -123,7 +123,7 @@ parameter3.balanceActual(); parameter4.balanceActual(); parameter5.balanceActual(); - throw; + MOCKPP_RETHROW; } parameter1.addActual(p1); Index: VisitableMockMethod1.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod1.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- VisitableMockMethod1.h 19 Nov 2005 14:16:38 -0000 1.11 +++ VisitableMockMethod1.h 28 Nov 2005 19:03:09 -0000 1.12 @@ -99,7 +99,7 @@ catch(...) { parameter1.balanceActual(); - throw; + MOCKPP_RETHROW; } parameter1.addActual(p1); |