bool* arguments can be used by wrappers
[lqt.git] / cpptoxml / parser / rpp / pp-iterator.h
blob94794b7aea1a7cf6b276a9d81817c8371c630013
1 /****************************************************************************
2 **
3 ** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
4 ** Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
5 **
6 ** This file is part of $PRODUCT$.
7 **
8 ** $CPP_LICENSE$
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ****************************************************************************/
15 #ifndef PP_ITERATOR_H
16 #define PP_ITERATOR_H
18 #include <iterator>
20 namespace rpp {
22 class pp_null_output_iterator
23 : public std::iterator<std::output_iterator_tag, void, void, void, void>
25 public:
26 pp_null_output_iterator() {}
28 template <typename _Tp>
29 pp_null_output_iterator &operator=(_Tp const &)
30 { return *this; }
32 inline pp_null_output_iterator &operator * () { return *this; }
33 inline pp_null_output_iterator &operator ++ () { return *this; }
34 inline pp_null_output_iterator operator ++ (int) { return *this; }
37 template <typename _Container>
38 class pp_output_iterator
39 : public std::iterator<std::output_iterator_tag, void, void, void, void>
41 std::string &_M_result;
43 public:
44 explicit pp_output_iterator(std::string &__result):
45 _M_result (__result) {}
47 inline pp_output_iterator &operator=(typename _Container::const_reference __v)
49 if (_M_result.capacity () == _M_result.size ())
50 _M_result.reserve (_M_result.capacity () << 2);
52 _M_result.push_back(__v);
53 return *this;
56 inline pp_output_iterator &operator * () { return *this; }
57 inline pp_output_iterator &operator ++ () { return *this; }
58 inline pp_output_iterator operator ++ (int) { return *this; }
61 } // namespace rpp
63 #endif // PP_ITERATOR_H
65 // kate: space-indent on; indent-width 2; replace-tabs on;