Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d0116867
Kaydet (Commit)
d0116867
authored
Ara 05, 2014
tarafından
Bjoern Michaelsen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
work towards better constness
Change-Id: Ideef73ecd6620f1d1dd283d830e41f567699a5fc
üst
e9a3d259
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
ring.hxx
sw/inc/ring.hxx
+14
-6
No files found.
sw/inc/ring.hxx
Dosyayı görüntüle @
d0116867
...
...
@@ -23,12 +23,14 @@
#include <swtypes.hxx>
#include <utility>
#include <iterator>
#include <type_traits>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/intrusive/circular_list_algorithms.hpp>
namespace
sw
{
template
<
class
T
>
class
RingContainer
;
template
<
class
T
>
class
RingIterator
;
/**
* An intrusive container class double linking the contained nodes
* @example sw/qa/core/uwriter.cxx
...
...
@@ -37,8 +39,10 @@ namespace sw
class
Ring
{
public
:
typedef
T
value_type
;
typedef
typename
std
::
add_const
<
T
>::
type
const_value_type
;
typedef
RingContainer
<
T
>
ring_container
;
typedef
RingContainer
<
const
T
>
const_ring_container
;
typedef
RingContainer
<
const_value_type
>
const_ring_container
;
virtual
~
Ring
()
{
algo
::
unlink
(
static_cast
<
T
*
>
(
this
));
};
/**
...
...
@@ -101,7 +105,11 @@ namespace sw
static
node_ptr
get_previous
(
const_node_ptr
n
)
{
return
n
->
GetPrev
();
};
static
void
set_previous
(
node_ptr
n
,
node_ptr
previous
)
{
n
->
pPrev
=
previous
;
};
};
friend
struct
Ring_node_traits
;
friend
typename
ring_container
::
iterator
;
friend
typename
ring_container
::
const_iterator
;
friend
typename
const_ring_container
::
iterator
;
friend
typename
const_ring_container
::
const_iterator
;
friend
class
boost
::
iterator_core_access
;
typedef
boost
::
intrusive
::
circular_list_algorithms
<
Ring_node_traits
>
algo
;
T
*
pNext
;
T
*
pPrev
;
...
...
@@ -134,7 +142,6 @@ namespace sw
algo
::
unlink
(
pThis
);
}
template
<
class
T
>
class
RingIterator
;
/**
* helper class that provides STL-style container iteration to the ring
*/
...
...
@@ -172,6 +179,7 @@ namespace sw
,
boost
::
forward_traversal_tag
>
{
typedef
typename
std
::
remove_const
<
T
>::
type
Tnonconst
;
public
:
RingIterator
()
:
m_pCurrent
(
nullptr
)
...
...
@@ -179,7 +187,7 @@ namespace sw
{}
explicit
RingIterator
(
T
*
pRing
,
bool
bStart
=
true
)
:
m_pCurrent
(
nullptr
)
,
m_pStart
(
pRing
)
,
m_pStart
(
const_cast
<
Tnonconst
*>
(
pRing
)
)
{
if
(
!
bStart
)
m_pCurrent
=
m_pStart
;
...
...
@@ -204,9 +212,9 @@ namespace sw
* - nullptr if on the first item (begin())
* - m_pStart when beyond the last item (end())
*/
T
*
m_pCurrent
;
T
nonconst
*
m_pCurrent
;
/** the first item of the iteration */
T
*
m_pStart
;
T
nonconst
*
m_pStart
;
};
template
<
class
T
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment