1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SOLTOOLS_GI_LIST_HXX
29 #define SOLTOOLS_GI_LIST_HXX
32 #include "st_list.hxx"
37 /** Holds set of generic informations in a sorted list.
39 At different places, methods of this class have a parameter,
40 whose name includes "path". Those are paths like this:
44 which are used to access GenericInfo keys in deep search through
45 the lists and their sublists.
47 class List_GenericInfo
54 const GenericInfo
& operator*() const;
55 const_iterator
& operator++();
56 bool operator==( const const_iterator
& ) const;
57 bool operator!=( const const_iterator
& ) const;
60 const_iterator( const DynamicList
< GenericInfo
>::const_iterator
& );
61 private: DynamicList
< GenericInfo
>::const_iterator it
;
65 GenericInfo
& operator*() const;
66 iterator
& operator++();
67 bool operator==( const iterator
& ) const;
68 bool operator!=( const iterator
& ) const;
71 iterator( const DynamicList
< GenericInfo
>::iterator
& );
72 private: DynamicList
< GenericInfo
>::iterator it
;
75 typedef const char * KeyPath
;
80 const List_GenericInfo
&
85 List_GenericInfo
& operator=(
86 const List_GenericInfo
&
88 const GenericInfo
* operator[](
89 KeyPath i_sKeyPath
) const;
90 GenericInfo
* operator[](
95 GenericInfo
* let_dpInfo
, /// Will be owned by this object.
96 bool i_bOverwrite
= true );
97 bool InsertInfoByPath(
98 GenericInfo
* let_dpInfo
, /// Will be owned by this object.
101 bool i_bOverwrite
= true );
103 GenericInfo
* ReleaseInfo( /// Removes the GenericInfo from its parent.
104 KeyPath i_sKeyPath
);
107 KeyPath i_sKeyPath
);
110 unsigned Size() const;
112 const_iterator
Begin() const;
113 const_iterator
End() const;
120 typedef DynamicList
< GenericInfo
>::iterator sub_iterator
;
122 sub_iterator
lower_bound(
124 const char * & o_sNextPathSegment
,
125 KeyPath i_sKeyPath
);
127 DynamicList
< GenericInfo
>
135 inline const GenericInfo
&
137 const_iterator::operator*() const
140 inline List_GenericInfo::const_iterator
&
142 const_iterator::operator++()
143 { ++it
; return *this; }
147 const_iterator::operator==( const const_iterator
& i_rIter
) const
148 { return it
== i_rIter
.it
; }
152 const_iterator::operator!=( const const_iterator
& i_rIter
) const
153 { return it
!= i_rIter
.it
; }
155 inline List_GenericInfo::
156 const_iterator::const_iterator()
159 inline List_GenericInfo::
160 const_iterator::const_iterator( const DynamicList
< GenericInfo
>::const_iterator
& i_rDynListIter
)
161 : it(i_rDynListIter
) { }
166 iterator::operator*() const
169 inline List_GenericInfo::iterator
&
171 iterator::operator++()
172 { ++it
; return *this; }
176 iterator::operator==( const iterator
& i_rIter
) const
177 { return it
== i_rIter
.it
; }
181 iterator::operator!=( const iterator
& i_rIter
) const
182 { return it
!= i_rIter
.it
; }
184 inline List_GenericInfo::
188 inline List_GenericInfo::
189 iterator::iterator( const DynamicList
< GenericInfo
>::iterator
& i_rDynListIter
)
190 : it(i_rDynListIter
) { }
193 List_GenericInfo::Size() const
194 { return aChildren
.size(); }
196 inline List_GenericInfo::const_iterator
197 List_GenericInfo::Begin() const
198 { return aChildren
.begin(); }
200 inline List_GenericInfo::const_iterator
201 List_GenericInfo::End() const
202 { return aChildren
.end(); }
204 inline List_GenericInfo::iterator
205 List_GenericInfo::Begin()
206 { return aChildren
.begin(); }
208 inline List_GenericInfo::iterator
209 List_GenericInfo::End()
210 { return aChildren
.end(); }