Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef ARY_STDCONSTITER_HXX
21 : #define ARY_STDCONSTITER_HXX
22 : // KORR_DEPRECATED_3.0
23 :
24 :
25 : // USED SERVICES
26 : // BASE CLASSES
27 : // COMPONENTS
28 : // PARAMETERS
29 :
30 :
31 : namespace ary
32 : {
33 :
34 : template <class ELEM>
35 :
36 : class StdConstIterator
37 : {
38 : public:
39 73874 : virtual ~StdConstIterator() {}
40 :
41 84454 : void operator++() { do_Advance(); }
42 94783 : const ELEM & operator*() const { return *inq_CurElement(); }
43 171357 : operator bool() const { return inq_CurElement() != 0; }
44 :
45 : /// Needed as replacement for operator bool() in gcc 2.95.
46 1026 : bool IsValid() const { return operator bool(); }
47 : bool IsSorted() const { return inq_IsSorted(); }
48 :
49 : protected:
50 73874 : StdConstIterator() {}
51 :
52 : private:
53 : //Locals
54 : virtual void do_Advance() = 0;
55 : virtual const ELEM *
56 : inq_CurElement() const = 0;
57 : virtual bool inq_IsSorted() const = 0;
58 :
59 : // Forbidden:
60 : StdConstIterator(const StdConstIterator<ELEM>&);
61 : StdConstIterator<ELEM> & operator=(const StdConstIterator<ELEM>&);
62 : };
63 :
64 :
65 : template <class ELEM>
66 56299 : class Dyn_StdConstIterator
67 : {
68 : public:
69 : typedef StdConstIterator<ELEM> client_type;
70 :
71 56299 : Dyn_StdConstIterator(
72 : DYN client_type * pass_dpIterator = 0 )
73 56299 : : pClient(pass_dpIterator) {}
74 : Dyn_StdConstIterator<ELEM> &
75 73874 : operator=(
76 : DYN client_type * pass_dpIterator )
77 73874 : { pClient = pass_dpIterator;
78 73874 : return *this; }
79 84291 : client_type & operator*() const { return *pClient.MutablePtr(); }
80 :
81 : private:
82 : Dyn<client_type> pClient;
83 : };
84 :
85 :
86 :
87 :
88 :
89 : } // namespace ary
90 : #endif
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|