1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef SOLTOOLS_GI_LIST_HXX
30 #define SOLTOOLS_GI_LIST_HXX
33 #include "st_list.hxx"
38 /** Holds set of generic informations in a sorted list.
40 At different places, methods of this class have a parameter,
41 whose name includes "path". Those are paths like this:
45 which are used to access GenericInfo keys in deep search through
46 the lists and their sublists.
48 class List_GenericInfo
55 const GenericInfo
& operator*() const;
56 const_iterator
& operator++();
57 bool operator==( const const_iterator
& ) const;
58 bool operator!=( const const_iterator
& ) const;
61 const_iterator( const DynamicList
< GenericInfo
>::const_iterator
& );
62 private: DynamicList
< GenericInfo
>::const_iterator it
;
66 GenericInfo
& operator*() const;
67 iterator
& operator++();
68 bool operator==( const iterator
& ) const;
69 bool operator!=( const iterator
& ) const;
72 iterator( const DynamicList
< GenericInfo
>::iterator
& );
73 private: DynamicList
< GenericInfo
>::iterator it
;
76 typedef const char * KeyPath
;
81 const List_GenericInfo
&
86 List_GenericInfo
& operator=(
87 const List_GenericInfo
&
89 const GenericInfo
* operator[](
90 KeyPath i_sKeyPath
) const;
91 GenericInfo
* operator[](
96 GenericInfo
* let_dpInfo
, /// Will be owned by this object.
97 bool i_bOverwrite
= true );
98 bool InsertInfoByPath(
99 GenericInfo
* let_dpInfo
, /// Will be owned by this object.
102 bool i_bOverwrite
= true );
104 GenericInfo
* ReleaseInfo( /// Removes the GenericInfo from its parent.
105 KeyPath i_sKeyPath
);
108 KeyPath i_sKeyPath
);
111 unsigned Size() const;
113 const_iterator
Begin() const;
114 const_iterator
End() const;
121 typedef DynamicList
< GenericInfo
>::iterator sub_iterator
;
123 sub_iterator
lower_bound(
125 const char * & o_sNextPathSegment
,
126 KeyPath i_sKeyPath
);
128 DynamicList
< GenericInfo
>
136 inline const GenericInfo
&
138 const_iterator::operator*() const
141 inline List_GenericInfo::const_iterator
&
143 const_iterator::operator++()
144 { ++it
; return *this; }
148 const_iterator::operator==( const const_iterator
& i_rIter
) const
149 { return it
== i_rIter
.it
; }
153 const_iterator::operator!=( const const_iterator
& i_rIter
) const
154 { return it
!= i_rIter
.it
; }
156 inline List_GenericInfo::
157 const_iterator::const_iterator()
160 inline List_GenericInfo::
161 const_iterator::const_iterator( const DynamicList
< GenericInfo
>::const_iterator
& i_rDynListIter
)
162 : it(i_rDynListIter
) { }
167 iterator::operator*() const
170 inline List_GenericInfo::iterator
&
172 iterator::operator++()
173 { ++it
; return *this; }
177 iterator::operator==( const iterator
& i_rIter
) const
178 { return it
== i_rIter
.it
; }
182 iterator::operator!=( const iterator
& i_rIter
) const
183 { return it
!= i_rIter
.it
; }
185 inline List_GenericInfo::
189 inline List_GenericInfo::
190 iterator::iterator( const DynamicList
< GenericInfo
>::iterator
& i_rDynListIter
)
191 : it(i_rDynListIter
) { }
194 List_GenericInfo::Size() const
195 { return aChildren
.size(); }
197 inline List_GenericInfo::const_iterator
198 List_GenericInfo::Begin() const
199 { return aChildren
.begin(); }
201 inline List_GenericInfo::const_iterator
202 List_GenericInfo::End() const
203 { return aChildren
.end(); }
205 inline List_GenericInfo::iterator
206 List_GenericInfo::Begin()
207 { return aChildren
.begin(); }
209 inline List_GenericInfo::iterator
210 List_GenericInfo::End()
211 { return aChildren
.end(); }
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */