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
764600bc
Kaydet (Commit)
764600bc
authored
Kas 19, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Apply pimpl to ResStringArray, to hide its internals.
Change-Id: I23969735f35e221a1aad39081ee63d02066d856f
üst
1b9aaba0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
34 deletions
+61
-34
resary.hxx
include/tools/resary.hxx
+13
-25
resary.cxx
tools/source/rc/resary.cxx
+48
-9
No files found.
include/tools/resary.hxx
Dosyayı görüntüle @
764600bc
...
@@ -19,42 +19,30 @@
...
@@ -19,42 +19,30 @@
#ifndef INCLUDED_TOOLS_RESARY_HXX
#ifndef INCLUDED_TOOLS_RESARY_HXX
#define INCLUDED_TOOLS_RESARY_HXX
#define INCLUDED_TOOLS_RESARY_HXX
#include <boost/noncopyable.hpp>
#include <vector>
#include <tools/toolsdllapi.h>
#include <tools/toolsdllapi.h>
#include <
tools/resid
.hxx>
#include <
rtl/ustring
.hxx>
#define RESARRAY_INDEX_NOTFOUND (0xffffffff)
#define RESARRAY_INDEX_NOTFOUND (0xffffffff)
class
TOOLS_DLLPUBLIC
ResStringArray
:
private
boost
::
noncopyable
class
ResId
;
{
private
:
struct
ImplResStringItem
{
OUString
m_aStr
;
sal_IntPtr
m_nValue
;
ImplResStringItem
(
const
OUString
&
rStr
,
long
nValue
=
0
)
:
class
TOOLS_DLLPUBLIC
ResStringArray
m_aStr
(
rStr
),
{
m_nValue
(
nValue
)
struct
Impl
;
{}
Impl
*
mpImpl
;
};
std
::
vector
<
ImplResStringItem
>
m_aStrings
;
ResStringArray
(
const
ResStringArray
&
);
// disabled
ResStringArray
&
operator
=
(
const
ResStringArray
&
);
// disabled
public
:
public
:
ResStringArray
(
const
ResId
&
rResId
);
ResStringArray
(
const
ResId
&
rResId
);
~
ResStringArray
();
~
ResStringArray
();
const
OUString
GetString
(
sal_uInt32
nIndex
)
const
OUString
GetString
(
sal_uInt32
nIndex
)
const
;
{
return
(
nIndex
<
m_aStrings
.
size
())
?
m_aStrings
[
nIndex
].
m_aStr
:
OUString
();
}
sal_IntPtr
GetValue
(
sal_uInt32
nIndex
)
const
;
sal_IntPtr
GetValue
(
sal_uInt32
nIndex
)
const
sal_uInt32
Count
()
const
;
{
return
(
nIndex
<
m_aStrings
.
size
())
?
m_aStrings
[
nIndex
].
m_nValue
:
-
1
;
}
sal_uInt32
FindIndex
(
sal_IntPtr
nValue
)
const
;
sal_uInt32
Count
()
const
{
return
sal_uInt32
(
m_aStrings
.
size
());
}
sal_uInt32
AddItem
(
const
OUString
&
rString
,
sal_IntPtr
nValue
);
sal_uInt32
FindIndex
(
sal_IntPtr
nValue
)
const
;
sal_uInt32
AddItem
(
const
OUString
&
rString
,
sal_IntPtr
nValue
);
};
};
#endif
#endif
...
...
tools/source/rc/resary.cxx
Dosyayı görüntüle @
764600bc
...
@@ -17,11 +17,34 @@
...
@@ -17,11 +17,34 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
*/
#include <tools/resmgr.hxx>
#include <tools/resary.hxx>
#include <tools/resary.hxx>
#include <tools/resmgr.hxx>
#include <tools/rcid.h>
#include <tools/rcid.h>
ResStringArray
::
ResStringArray
(
const
ResId
&
rResId
)
#include <vector>
namespace
{
struct
ImplResStringItem
{
OUString
m_aStr
;
sal_IntPtr
m_nValue
;
ImplResStringItem
(
const
OUString
&
rStr
,
long
nValue
=
0
)
:
m_aStr
(
rStr
),
m_nValue
(
nValue
)
{
}
};
}
struct
ResStringArray
::
Impl
{
std
::
vector
<
ImplResStringItem
>
m_aStrings
;
};
ResStringArray
::
ResStringArray
(
const
ResId
&
rResId
)
:
mpImpl
(
new
Impl
)
{
{
rResId
.
SetRT
(
RSC_STRINGARRAY
);
rResId
.
SetRT
(
RSC_STRINGARRAY
);
ResMgr
*
pMgr
=
rResId
.
GetResMgr
();
ResMgr
*
pMgr
=
rResId
.
GetResMgr
();
...
@@ -32,14 +55,14 @@ ResStringArray::ResStringArray( const ResId& rResId )
...
@@ -32,14 +55,14 @@ ResStringArray::ResStringArray( const ResId& rResId )
const
sal_uInt32
nItems
=
pMgr
->
ReadLong
();
const
sal_uInt32
nItems
=
pMgr
->
ReadLong
();
if
(
nItems
)
if
(
nItems
)
{
{
m_aStrings
.
reserve
(
nItems
);
m
pImpl
->
m
_aStrings
.
reserve
(
nItems
);
for
(
sal_uInt32
i
=
0
;
i
<
nItems
;
i
++
)
for
(
sal_uInt32
i
=
0
;
i
<
nItems
;
i
++
)
{
{
// load string
// load string
m
_aStrings
.
push_back
(
ImplResStringItem
(
pMgr
->
ReadString
()
)
);
m
pImpl
->
m_aStrings
.
push_back
(
ImplResStringItem
(
pMgr
->
ReadString
())
);
// load value
// load value
m_aStrings
[
i
].
m_nValue
=
pMgr
->
ReadLong
();
m
pImpl
->
m
_aStrings
[
i
].
m_nValue
=
pMgr
->
ReadLong
();
}
}
}
}
}
}
...
@@ -47,14 +70,30 @@ ResStringArray::ResStringArray( const ResId& rResId )
...
@@ -47,14 +70,30 @@ ResStringArray::ResStringArray( const ResId& rResId )
ResStringArray
::~
ResStringArray
()
ResStringArray
::~
ResStringArray
()
{
{
delete
mpImpl
;
}
OUString
ResStringArray
::
GetString
(
sal_uInt32
nIndex
)
const
{
return
(
nIndex
<
mpImpl
->
m_aStrings
.
size
())
?
mpImpl
->
m_aStrings
[
nIndex
].
m_aStr
:
OUString
();
}
sal_IntPtr
ResStringArray
::
GetValue
(
sal_uInt32
nIndex
)
const
{
return
(
nIndex
<
mpImpl
->
m_aStrings
.
size
())
?
mpImpl
->
m_aStrings
[
nIndex
].
m_nValue
:
-
1
;
}
sal_uInt32
ResStringArray
::
Count
()
const
{
return
sal_uInt32
(
mpImpl
->
m_aStrings
.
size
());
}
}
sal_uInt32
ResStringArray
::
FindIndex
(
sal_IntPtr
nValue
)
const
sal_uInt32
ResStringArray
::
FindIndex
(
sal_IntPtr
nValue
)
const
{
{
const
sal_uInt32
nItems
=
m_aStrings
.
size
();
const
sal_uInt32
nItems
=
m
pImpl
->
m
_aStrings
.
size
();
for
(
sal_uInt32
i
=
0
;
i
<
nItems
;
i
++
)
for
(
sal_uInt32
i
=
0
;
i
<
nItems
;
i
++
)
{
{
if
(
m_aStrings
[
i
].
m_nValue
==
nValue
)
if
(
mpImpl
->
m_aStrings
[
i
].
m_nValue
==
nValue
)
return
i
;
return
i
;
}
}
return
RESARRAY_INDEX_NOTFOUND
;
return
RESARRAY_INDEX_NOTFOUND
;
...
@@ -62,8 +101,8 @@ sal_uInt32 ResStringArray::FindIndex( sal_IntPtr nValue ) const
...
@@ -62,8 +101,8 @@ sal_uInt32 ResStringArray::FindIndex( sal_IntPtr nValue ) const
sal_uInt32
ResStringArray
::
AddItem
(
const
OUString
&
rString
,
sal_IntPtr
nValue
)
sal_uInt32
ResStringArray
::
AddItem
(
const
OUString
&
rString
,
sal_IntPtr
nValue
)
{
{
m
_aStrings
.
push_back
(
ImplResStringItem
(
rString
,
nValue
));
m
pImpl
->
m_aStrings
.
push_back
(
ImplResStringItem
(
rString
,
nValue
));
return
m_aStrings
.
size
();
return
m
pImpl
->
m
_aStrings
.
size
();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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