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
acf5b740
Kaydet (Commit)
acf5b740
authored
Ara 03, 2014
tarafından
Bjoern Michaelsen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move container stuff out of sw::Ring<>
Change-Id: Idf72c16318735d6b3ef7f421aceacc225a7697bf
üst
1801b559
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
48 deletions
+60
-48
edimp.hxx
sw/inc/edimp.hxx
+1
-1
ring.hxx
sw/inc/ring.hxx
+53
-41
uwriter.cxx
sw/qa/core/uwriter.cxx
+2
-2
doccorr.cxx
sw/source/core/doc/doccorr.cxx
+3
-3
autofmt.cxx
sw/source/core/edit/autofmt.cxx
+1
-1
No files found.
sw/inc/edimp.hxx
Dosyayı görüntüle @
acf5b740
...
@@ -31,7 +31,7 @@ class SwNodeIndex;
...
@@ -31,7 +31,7 @@ class SwNodeIndex;
#define PCURCRSR (static_cast<SwPaM *>(&__r))
#define PCURCRSR (static_cast<SwPaM *>(&__r))
#define FOREACHPAM_START(pCURSH) \
#define FOREACHPAM_START(pCURSH) \
BOOST_FOREACH(SwPaM& __r, (pCURSH)->rangeRing
()) \
for(SwPaM& __r : (pCURSH)->GetRingContainer
()) \
{
{
#define FOREACHPAM_END() }
#define FOREACHPAM_END() }
...
...
sw/inc/ring.hxx
Dosyayı görüntüle @
acf5b740
...
@@ -27,9 +27,7 @@
...
@@ -27,9 +27,7 @@
namespace
sw
namespace
sw
{
{
class
Ring_node_traits
;
template
<
class
T
>
class
RingContainer
;
template
<
class
T
>
class
RingIterator
;
/**
/**
* An intrusive container class double linking the contained nodes
* An intrusive container class double linking the contained nodes
* @example sw/qa/core/uwriter.cxx
* @example sw/qa/core/uwriter.cxx
...
@@ -68,8 +66,8 @@ namespace sw
...
@@ -68,8 +66,8 @@ namespace sw
*/
*/
Ring
(
T
*
pRing
);
Ring
(
T
*
pRing
);
public
:
public
:
typedef
Ring
Iterator
<
T
>
iterato
r
;
typedef
Ring
Container
<
T
>
ring_containe
r
;
typedef
Ring
Iterator
<
const
T
>
const_iterato
r
;
typedef
Ring
Container
<
const
T
>
const_ring_containe
r
;
virtual
~
Ring
()
virtual
~
Ring
()
{
algo
::
unlink
(
static_cast
<
T
*
>
(
this
));
};
{
algo
::
unlink
(
static_cast
<
T
*
>
(
this
));
};
/**
/**
...
@@ -96,36 +94,13 @@ namespace sw
...
@@ -96,36 +94,13 @@ namespace sw
/** @return the previous item in the ring container */
/** @return the previous item in the ring container */
T
*
GetPrev
()
const
T
*
GetPrev
()
const
{
return
pPrev
;
}
{
return
pPrev
;
}
/**
* iterator access
* @code
* for(Ring<SwPaM>::iterator ppRing = pPaM->beginRing(); ppRing != pPaM->endRing(); ++ppRing)
* do_stuff(*ppRing);
* @endcode
* @TODO: unfortunately we cant name these STL-conforming, as some derived classes
* also derive from other STL containers. This should be fixed though.
* That should allow this to be used directly with C++11s for( : )
* iteration statement.
*/
iterator
beginRing
();
iterator
endRing
();
const_iterator
beginRing
()
const
;
const_iterator
endRing
()
const
;
/**
* simplified iteration with BOOST_FOREACH (example for Ring<SwPaM>):
* @code
* BOOST_FOREACH(SwPaM& rPaM, pPaM->rangeRing())
* do_stuff(rPaM);
* @endcode
*/
std
::
pair
<
iterator
,
iterator
>
rangeRing
()
{
return
std
::
make_pair
(
beginRing
(),
endRing
());
}
std
::
pair
<
const_iterator
,
const_iterator
>
rangeRing
()
const
{
return
std
::
make_pair
(
beginRing
(),
endRing
());
}
/** @return the number of elements in the container */
/** @return the number of elements in the container */
size_t
size
()
const
size_t
size
()
const
{
return
algo
::
count
(
static_cast
<
const
T
*
>
(
this
));
}
{
return
algo
::
count
(
static_cast
<
const
T
*
>
(
this
));
}
/** @return a stl-like container with begin()/end() for iteration */
ring_container
GetRingContainer
();
/** @return a stl-like container with begin()/end() for const iteration */
const_ring_container
GetRingContainer
()
const
;
};
};
template
<
class
T
>
template
<
class
T
>
...
@@ -161,8 +136,37 @@ namespace sw
...
@@ -161,8 +136,37 @@ namespace sw
std
::
swap
(
*
(
&
pPrev
),
*
(
&
pDestRing
->
pPrev
));
std
::
swap
(
*
(
&
pPrev
),
*
(
&
pDestRing
->
pPrev
));
}
}
template
<
class
T
>
class
RingIterator
;
template
<
class
T
>
template
<
class
T
>
class
RingIterator
:
public
boost
::
iterator_facade
<
class
RingContainer
SAL_FINAL
{
T
*
m_pStart
;
public
:
RingContainer
(
T
*
pRing
)
:
m_pStart
(
pRing
)
{};
typedef
RingIterator
<
T
>
iterator
;
typedef
RingIterator
<
const
T
>
const_iterator
;
/**
* iterator access
* @code
* for(Ring<SwPaM>::iterator ppRing = pPaM->beginRing(); ppRing != pPaM->endRing(); ++ppRing)
* do_stuff(*ppRing);
* @endcode
* @TODO: unfortunately we cant name these STL-conforming, as some derived classes
* also derive from other STL containers. This should be fixed though.
* That should allow this to be used directly with C++11s for( : )
* iteration statement.
*/
iterator
begin
();
iterator
end
();
const_iterator
begin
()
const
;
const_iterator
end
()
const
;
///** @return the number of elements in the container */
//size_t size() const
// { return algo::count(static_cast< const T* >(this)); }
};
template
<
class
T
>
class
RingIterator
SAL_FINAL
:
public
boost
::
iterator_facade
<
RingIterator
<
T
>
RingIterator
<
T
>
,
T
,
T
,
boost
::
forward_traversal_tag
,
boost
::
forward_traversal_tag
...
@@ -193,20 +197,28 @@ namespace sw
...
@@ -193,20 +197,28 @@ namespace sw
};
};
template
<
class
T
>
template
<
class
T
>
inline
typename
Ring
<
T
>::
iterator
Ring
<
T
>::
beginRing
()
inline
typename
Ring
<
T
>::
ring_container
Ring
<
T
>::
GetRingContainer
()
{
return
Ring
<
T
>::
iterator
(
static_cast
<
T
*
>
(
this
));
};
{
return
Ring
<
T
>::
ring_container
(
static_cast
<
T
*
>
(
this
));
};
template
<
class
T
>
inline
typename
Ring
<
T
>::
const_ring_container
Ring
<
T
>::
GetRingContainer
()
const
{
return
Ring
<
T
>::
const_ring_container
(
static_cast
<
const
T
*
>
(
this
));
};
template
<
class
T
>
inline
typename
RingContainer
<
T
>::
iterator
RingContainer
<
T
>::
begin
()
{
return
RingContainer
<
T
>::
iterator
(
m_pStart
);
};
template
<
class
T
>
template
<
class
T
>
inline
typename
Ring
<
T
>::
iterator
Ring
<
T
>::
endRing
()
inline
typename
Ring
Container
<
T
>::
iterator
RingContainer
<
T
>::
end
()
{
return
Ring
<
T
>::
iterator
(
static_cast
<
T
*
>
(
this
)
,
false
);
};
{
return
Ring
Container
<
T
>::
iterator
(
m_pStart
,
false
);
};
template
<
class
T
>
template
<
class
T
>
inline
typename
Ring
<
T
>::
const_iterator
Ring
<
T
>::
beginRing
()
const
inline
typename
Ring
Container
<
T
>::
const_iterator
RingContainer
<
T
>::
begin
()
const
{
return
Ring
<
T
>::
const_iterator
(
static_cast
<
const
T
*
>
(
this
)
);
};
{
return
Ring
Container
<
T
>::
const_iterator
(
m_pStart
);
};
template
<
class
T
>
template
<
class
T
>
inline
typename
Ring
<
T
>::
const_iterator
Ring
<
T
>::
endRing
()
const
inline
typename
Ring
Container
<
T
>::
const_iterator
RingContainer
<
T
>::
end
()
const
{
return
Ring
<
T
>::
const_iterator
(
static_cast
<
const
T
*
>
(
this
)
,
false
);
};
{
return
Ring
Container
<
T
>::
const_iterator
(
m_pStart
,
false
);
};
}
}
#endif
#endif
...
...
sw/qa/core/uwriter.cxx
Dosyayı görüntüle @
acf5b740
...
@@ -1317,14 +1317,14 @@ void SwDocTest::testIntrusiveRing()
...
@@ -1317,14 +1317,14 @@ void SwDocTest::testIntrusiveRing()
CPPUNIT_ASSERT_EQUAL
((
*
ppRing
)
->
GetNext
(),
*
ppNext
);
CPPUNIT_ASSERT_EQUAL
((
*
ppRing
)
->
GetNext
(),
*
ppNext
);
CPPUNIT_ASSERT_EQUAL
((
*
ppNext
)
->
GetPrev
(),
*
ppRing
);
CPPUNIT_ASSERT_EQUAL
((
*
ppNext
)
->
GetPrev
(),
*
ppRing
);
}
}
BOOST_FOREACH
(
TestRing
&
r
,
aRing1
.
rangeRing
())
for
(
TestRing
&
r
:
aRing1
.
GetRingContainer
())
{
{
TestRing
*
pRing
=
&
r
;
TestRing
*
pRing
=
&
r
;
CPPUNIT_ASSERT
(
pRing
);
CPPUNIT_ASSERT
(
pRing
);
//pRing->debug();
//pRing->debug();
}
}
const
TestRing
*
pConstRing
=
&
aRing1
;
const
TestRing
*
pConstRing
=
&
aRing1
;
BOOST_FOREACH
(
const
TestRing
&
r
,
pConstRing
->
rangeRing
())
// this should fail without r being const
for
(
const
TestRing
&
r
:
pConstRing
->
GetRingContainer
())
// this should fail without r being const
{
{
const
TestRing
*
pRing
=
&
r
;
const
TestRing
*
pRing
=
&
r
;
CPPUNIT_ASSERT
(
pRing
);
CPPUNIT_ASSERT
(
pRing
);
...
...
sw/source/core/doc/doccorr.cxx
Dosyayı görüntüle @
acf5b740
...
@@ -99,7 +99,7 @@ void PaMCorrAbs( const SwPaM& rRange,
...
@@ -99,7 +99,7 @@ void PaMCorrAbs( const SwPaM& rRange,
if
(
pShell
)
if
(
pShell
)
{
{
BOOST_FOREACH
(
const
SwViewShell
&
rShell
,
pShell
->
rangeRing
())
for
(
const
SwViewShell
&
rShell
:
pShell
->
GetRingContainer
())
{
{
if
(
!
rShell
.
IsA
(
TYPE
(
SwCrsrShell
)))
if
(
!
rShell
.
IsA
(
TYPE
(
SwCrsrShell
)))
continue
;
continue
;
...
@@ -249,7 +249,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
...
@@ -249,7 +249,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
SwCrsrShell
const
*
pShell
=
pDoc
->
GetEditShell
();
SwCrsrShell
const
*
pShell
=
pDoc
->
GetEditShell
();
if
(
pShell
)
if
(
pShell
)
{
{
BOOST_FOREACH
(
const
SwViewShell
&
rShell
,
pShell
->
rangeRing
())
for
(
const
SwViewShell
&
rShell
:
pShell
->
GetRingContainer
())
{
{
if
(
!
rShell
.
IsA
(
TYPE
(
SwCrsrShell
)))
if
(
!
rShell
.
IsA
(
TYPE
(
SwCrsrShell
)))
continue
;
continue
;
...
@@ -262,7 +262,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
...
@@ -262,7 +262,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
((
_pStkCrsr
=
static_cast
<
SwPaM
*>
(
_pStkCrsr
->
GetNext
()))
!=
pCrsrShell
->
GetStkCrsr
())
);
((
_pStkCrsr
=
static_cast
<
SwPaM
*>
(
_pStkCrsr
->
GetNext
()))
!=
pCrsrShell
->
GetStkCrsr
())
);
SwPaM
*
pStartPaM
=
pCrsrShell
->
_GetCrsr
();
SwPaM
*
pStartPaM
=
pCrsrShell
->
_GetCrsr
();
BOOST_FOREACH
(
SwPaM
&
rPaM
,
pStartPaM
->
rangeRing
())
for
(
SwPaM
&
rPaM
:
pStartPaM
->
GetRingContainer
())
{
{
lcl_PaMCorrRel1
(
&
rPaM
,
pOldNode
,
aNewPos
,
nCntIdx
);
lcl_PaMCorrRel1
(
&
rPaM
,
pOldNode
,
aNewPos
,
nCntIdx
);
}
}
...
...
sw/source/core/edit/autofmt.cxx
Dosyayı görüntüle @
acf5b740
...
@@ -2538,7 +2538,7 @@ void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags )
...
@@ -2538,7 +2538,7 @@ void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags )
// There are more than one or a selection is open
// There are more than one or a selection is open
if
(
pCrsr
->
GetNext
()
!=
pCrsr
||
pCrsr
->
HasMark
()
)
if
(
pCrsr
->
GetNext
()
!=
pCrsr
||
pCrsr
->
HasMark
()
)
{
{
BOOST_FOREACH
(
SwPaM
&
rPaM
,
GetCrsr
()
->
rangeRing
())
for
(
SwPaM
&
rPaM
:
GetCrsr
()
->
GetRingContainer
())
{
{
if
(
rPaM
.
HasMark
()
)
if
(
rPaM
.
HasMark
()
)
{
{
...
...
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