1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gi_list.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SOLTOOLS_GI_LIST_HXX
32 #define SOLTOOLS_GI_LIST_HXX
35 #include "st_list.hxx"
40 /** Holds set of generic informations in a sorted list.
42 At different places, methods of this class have a parameter,
43 whose name includes "path". Those are paths like this:
47 which are used to access GenericInfo keys in deep search through
48 the lists and their sublists.
50 class List_GenericInfo
57 const GenericInfo
& operator*() const;
58 const_iterator
& operator++();
59 bool operator==( const const_iterator
& ) const;
60 bool operator!=( const const_iterator
& ) const;
63 const_iterator( const DynamicList
< GenericInfo
>::const_iterator
& );
64 private: DynamicList
< GenericInfo
>::const_iterator it
;
68 GenericInfo
& operator*() const;
69 iterator
& operator++();
70 bool operator==( const iterator
& ) const;
71 bool operator!=( const iterator
& ) const;
74 iterator( const DynamicList
< GenericInfo
>::iterator
& );
75 private: DynamicList
< GenericInfo
>::iterator it
;
78 typedef const char * KeyPath
;
83 const List_GenericInfo
&
88 List_GenericInfo
& operator=(
89 const List_GenericInfo
&
91 const GenericInfo
* operator[](
92 KeyPath i_sKeyPath
) const;
93 GenericInfo
* operator[](
98 GenericInfo
* let_dpInfo
, /// Will be owned by this object.
99 bool i_bOverwrite
= true );
100 bool InsertInfoByPath(
101 GenericInfo
* let_dpInfo
, /// Will be owned by this object.
104 bool i_bOverwrite
= true );
106 GenericInfo
* ReleaseInfo( /// Removes the GenericInfo from its parent.
107 KeyPath i_sKeyPath
);
110 KeyPath i_sKeyPath
);
113 unsigned Size() const;
115 const_iterator
Begin() const;
116 const_iterator
End() const;
123 typedef DynamicList
< GenericInfo
>::iterator sub_iterator
;
125 sub_iterator
lower_bound(
127 const char * & o_sNextPathSegment
,
128 KeyPath i_sKeyPath
);
130 DynamicList
< GenericInfo
>
138 inline const GenericInfo
&
140 const_iterator::operator*() const
143 inline List_GenericInfo::const_iterator
&
145 const_iterator::operator++()
146 { ++it
; return *this; }
150 const_iterator::operator==( const const_iterator
& i_rIter
) const
151 { return it
== i_rIter
.it
; }
155 const_iterator::operator!=( const const_iterator
& i_rIter
) const
156 { return it
!= i_rIter
.it
; }
158 inline List_GenericInfo::
159 const_iterator::const_iterator()
162 inline List_GenericInfo::
163 const_iterator::const_iterator( const DynamicList
< GenericInfo
>::const_iterator
& i_rDynListIter
)
164 : it(i_rDynListIter
) { }
169 iterator::operator*() const
172 inline List_GenericInfo::iterator
&
174 iterator::operator++()
175 { ++it
; return *this; }
179 iterator::operator==( const iterator
& i_rIter
) const
180 { return it
== i_rIter
.it
; }
184 iterator::operator!=( const iterator
& i_rIter
) const
185 { return it
!= i_rIter
.it
; }
187 inline List_GenericInfo::
191 inline List_GenericInfo::
192 iterator::iterator( const DynamicList
< GenericInfo
>::iterator
& i_rDynListIter
)
193 : it(i_rDynListIter
) { }
196 List_GenericInfo::Size() const
197 { return aChildren
.size(); }
199 inline List_GenericInfo::const_iterator
200 List_GenericInfo::Begin() const
201 { return aChildren
.begin(); }
203 inline List_GenericInfo::const_iterator
204 List_GenericInfo::End() const
205 { return aChildren
.end(); }
207 inline List_GenericInfo::iterator
208 List_GenericInfo::Begin()
209 { return aChildren
.begin(); }
211 inline List_GenericInfo::iterator
212 List_GenericInfo::End()
213 { return aChildren
.end(); }