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
d7b4e6b4
Kaydet (Commit)
d7b4e6b4
authored
Agu 07, 2015
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
svtools: convert boost::ptr_set to std::unordered_map
Change-Id: I2b5a57978e693f3b08726a09a0d1f6cc32d9f593
üst
c64a7ce1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
100 deletions
+16
-100
precompiled_svt.hxx
svtools/inc/pch/precompiled_svt.hxx
+0
-1
fileview.cxx
svtools/source/contnr/fileview.cxx
+16
-99
No files found.
svtools/inc/pch/precompiled_svt.hxx
Dosyayı görüntüle @
d7b4e6b4
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2drange.hxx>
#include <boost/noncopyable.hpp>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <boost/optional.hpp>
#include <boost/ptr_container/ptr_set.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <memory>
#include <memory>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_ptr.hpp>
...
...
svtools/source/contnr/fileview.cxx
Dosyayı görüntüle @
d7b4e6b4
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
#include <algorithm>
#include <algorithm>
#include <vector>
#include <vector>
#include <unordered_map>
#include <tools/urlobj.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <comphelper/string.hxx>
...
@@ -71,7 +72,6 @@
...
@@ -71,7 +72,6 @@
#include <unotools/intlwrapper.hxx>
#include <unotools/intlwrapper.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/syslocale.hxx>
#include <svl/urlfilter.hxx>
#include <svl/urlfilter.hxx>
#include <boost/ptr_container/ptr_set.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <o3tl/typed_flags_set.hxx>
#include <o3tl/typed_flags_set.hxx>
...
@@ -228,88 +228,17 @@ public:
...
@@ -228,88 +228,17 @@ public:
virtual
void
ExcecuteContextMenuAction
(
sal_uInt16
nSelectedPopentry
)
SAL_OVERRIDE
;
virtual
void
ExcecuteContextMenuAction
(
sal_uInt16
nSelectedPopentry
)
SAL_OVERRIDE
;
};
};
// class HashedEntry --------------------------------------------------
class
HashedEntry
{
// just a special String which can be compared on equality much faster
protected
:
OUString
maName
;
sal_Int32
mnHashCode
;
public
:
inline
HashedEntry
(
const
OUString
&
rName
);
inline
HashedEntry
(
const
INetURLObject
&
rURL
);
virtual
~
HashedEntry
();
inline
bool
operator
==
(
const
HashedEntry
&
rRef
)
const
;
inline
bool
operator
!=
(
const
HashedEntry
&
rRef
)
const
;
inline
bool
operator
<
(
const
HashedEntry
&
rRef
)
const
;
};
inline
HashedEntry
::
HashedEntry
(
const
OUString
&
rName
)
:
maName
(
rName
),
mnHashCode
(
rName
.
hashCode
()
)
{
}
inline
HashedEntry
::
HashedEntry
(
const
INetURLObject
&
rURL
)
:
maName
(
rURL
.
GetMainURL
(
INetURLObject
::
NO_DECODE
)
),
mnHashCode
(
maName
.
hashCode
()
)
{
}
HashedEntry
::~
HashedEntry
()
{
}
inline
bool
HashedEntry
::
operator
==
(
const
HashedEntry
&
rRef
)
const
{
return
mnHashCode
==
rRef
.
mnHashCode
&&
maName
==
rRef
.
maName
;
}
inline
bool
HashedEntry
::
operator
!=
(
const
HashedEntry
&
rRef
)
const
{
return
mnHashCode
!=
rRef
.
mnHashCode
||
maName
!=
rRef
.
maName
;
}
inline
bool
HashedEntry
::
operator
<
(
const
HashedEntry
&
rRef
)
const
{
if
(
mnHashCode
==
rRef
.
mnHashCode
)
return
maName
.
reverseCompareTo
(
rRef
.
maName
)
<
0
;
else
return
mnHashCode
<
rRef
.
mnHashCode
;
}
// class NameTranslationEntry -----------------------------------------
class
NameTranslationEntry
:
public
HashedEntry
{
// a fast comparable String and another String, which is used to get a substitution for a given String
protected
:
OUString
maTranslatedName
;
public
:
inline
NameTranslationEntry
(
const
OString
&
rOriginalName
,
const
OString
&
rTranslatedName
);
inline
const
OUString
&
GetTranslation
()
const
;
};
inline
NameTranslationEntry
::
NameTranslationEntry
(
const
OString
&
rOrg
,
const
OString
&
rTrans
)
:
HashedEntry
(
OStringToOUString
(
rOrg
,
RTL_TEXTENCODING_ASCII_US
))
,
maTranslatedName
(
OStringToOUString
(
rTrans
,
RTL_TEXTENCODING_UTF8
))
{
}
inline
const
OUString
&
NameTranslationEntry
::
GetTranslation
()
const
{
return
maTranslatedName
;
}
// class NameTranslationList -----------------------------------------
// class NameTranslationList -----------------------------------------
// provides a list of _unique_ Entries
// provides a list of _unique_ Entries
class
NameTranslationList
:
protected
boost
::
ptr_set
<
HashedEntry
>
class
NameTranslationList
{
// contains a list of substitutes of strings for a given folder (as URL)
{
// contains a list of substitutes of strings for a given folder (as URL)
// explanation of the circumstances see in remarks for Init();
// explanation of the circumstances see in remarks for Init();
protected
:
protected
:
INetURLObject
maTransFile
;
// URL of file with translation entries
INetURLObject
maTransFile
;
// URL of file with translation entries
HashedEntry
maHashedURL
;
// for future purposes when dealing with a set of cached
/// for future purposes when dealing with a set of cached NameTranslationLists
// NameTranslationLists
OUString
m_HashedURL
;
private
:
private
:
std
::
unordered_map
<
OUString
,
OUString
,
OUStringHash
>
m_Translation
;
const
OUString
maTransFileName
;
const
OUString
maTransFileName
;
void
Init
();
// reads the translation file and fills the (internal) list
void
Init
();
// reads the translation file and fills the (internal) list
...
@@ -318,14 +247,11 @@ public:
...
@@ -318,14 +247,11 @@ public:
// rBaseURL: path to folder for which the translation of the entries
// rBaseURL: path to folder for which the translation of the entries
// should be done
// should be done
using
boost
::
ptr_set
<
HashedEntry
>::
operator
==
;
using
boost
::
ptr_set
<
HashedEntry
>::
operator
!=
;
inline
bool
operator
!=
(
const
HashedEntry
&
rRef
)
const
;
const
OUString
*
Translate
(
const
OUString
&
rName
)
const
;
const
OUString
*
Translate
(
const
OUString
&
rName
)
const
;
// returns NULL, if rName can't be found
// returns NULL, if rName can't be found
inline
const
OUString
&
GetTransTableFileName
()
const
;
inline
const
OUString
&
GetTransTableFileName
()
const
;
OUString
const
&
GetHashedURL
()
{
return
m_HashedURL
;
}
// returns the name for the file, which contains the translation strings
// returns the name for the file, which contains the translation strings
};
};
...
@@ -356,7 +282,12 @@ void NameTranslationList::Init()
...
@@ -356,7 +282,12 @@ void NameTranslationList::Init()
sal_uInt16
nKeyCnt
=
aConfig
.
GetKeyCount
();
sal_uInt16
nKeyCnt
=
aConfig
.
GetKeyCount
();
for
(
sal_uInt16
nCnt
=
0
;
nCnt
<
nKeyCnt
;
++
nCnt
)
for
(
sal_uInt16
nCnt
=
0
;
nCnt
<
nKeyCnt
;
++
nCnt
)
insert
(
new
NameTranslationEntry
(
aConfig
.
GetKeyName
(
nCnt
),
aConfig
.
ReadKey
(
nCnt
)
)
);
{
m_Translation
.
insert
(
std
::
make_pair
(
OStringToOUString
(
aConfig
.
GetKeyName
(
nCnt
),
RTL_TEXTENCODING_ASCII_US
),
OStringToOUString
(
aConfig
.
ReadKey
(
nCnt
),
RTL_TEXTENCODING_UTF8
)
));
}
}
}
}
}
catch
(
Exception
const
&
)
{}
catch
(
Exception
const
&
)
{}
...
@@ -364,29 +295,17 @@ void NameTranslationList::Init()
...
@@ -364,29 +295,17 @@ void NameTranslationList::Init()
NameTranslationList
::
NameTranslationList
(
const
INetURLObject
&
rBaseURL
)
:
NameTranslationList
::
NameTranslationList
(
const
INetURLObject
&
rBaseURL
)
:
maTransFile
(
rBaseURL
),
maTransFile
(
rBaseURL
),
m
aHashedURL
(
rBaseURL
),
m
_HashedURL
(
rBaseURL
.
GetMainURL
(
INetURLObject
::
NO_DECODE
)
),
maTransFileName
(
OUString
(
".nametranslation.table"
)
)
maTransFileName
(
OUString
(
".nametranslation.table"
)
)
{
{
maTransFile
.
insertName
(
maTransFileName
);
maTransFile
.
insertName
(
maTransFileName
);
Init
();
Init
();
}
}
inline
bool
NameTranslationList
::
operator
!=
(
const
HashedEntry
&
rRef
)
const
{
return
maHashedURL
!=
rRef
;
}
const
OUString
*
NameTranslationList
::
Translate
(
const
OUString
&
rName
)
const
const
OUString
*
NameTranslationList
::
Translate
(
const
OUString
&
rName
)
const
{
{
HashedEntry
aRef
(
rName
);
auto
const
iter
(
m_Translation
.
find
(
rName
));
const
NameTranslationEntry
*
pSearch
=
NULL
;
return
(
iter
!=
m_Translation
.
end
())
?
&
iter
->
second
:
nullptr
;
for
(
const_iterator
it
=
begin
();
it
!=
end
();
++
it
)
if
(
(
*
it
)
==
aRef
)
{
pSearch
=
static_cast
<
const
NameTranslationEntry
*>
(
&*
it
);
}
return
pSearch
?
&
pSearch
->
GetTranslation
()
:
NULL
;
}
}
// class NameTranslator_Impl ------------------------------------------
// class NameTranslator_Impl ------------------------------------------
...
@@ -1525,11 +1444,9 @@ NameTranslator_Impl::~NameTranslator_Impl()
...
@@ -1525,11 +1444,9 @@ NameTranslator_Impl::~NameTranslator_Impl()
void
NameTranslator_Impl
::
SetActualFolder
(
const
INetURLObject
&
rActualFolder
)
void
NameTranslator_Impl
::
SetActualFolder
(
const
INetURLObject
&
rActualFolder
)
{
{
HashedEntry
aActFolder
(
rActualFolder
);
if
(
mpActFolder
)
if
(
mpActFolder
)
{
{
if
(
*
mpActFolder
!=
aActFolder
)
if
(
mpActFolder
->
GetHashedURL
()
!=
rActualFolder
.
GetMainURL
(
INetURLObject
::
NO_DECODE
)
)
{
{
delete
mpActFolder
;
delete
mpActFolder
;
mpActFolder
=
new
NameTranslationList
(
rActualFolder
);
mpActFolder
=
new
NameTranslationList
(
rActualFolder
);
...
...
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