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
53294e81
Kaydet (Commit)
53294e81
authored
Şub 28, 2012
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move template out of header
üst
60f97f3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
24 deletions
+39
-24
string.hxx
comphelper/inc/comphelper/string.hxx
+2
-24
string.cxx
comphelper/source/misc/string.cxx
+37
-0
No files found.
comphelper/inc/comphelper/string.hxx
Dosyayı görüntüle @
53294e81
...
...
@@ -46,22 +46,6 @@
// go into the stable URE API:
namespace
comphelper
{
namespace
string
{
namespace
detail
{
template
<
typename
T
,
typename
U
>
T
*
string_alloc
(
sal_Int32
nLen
)
{
//Clearly this is somewhat cosy with the sal implmentation
//rtl_[u]String contains U buffer[1], so an input of nLen
//allocates a buffer of nLen + 1 and we'll ensure a null termination
T
*
newStr
=
(
T
*
)
rtl_allocateMemory
(
sizeof
(
T
)
+
sizeof
(
U
)
*
nLen
);
newStr
->
refCount
=
1
;
newStr
->
length
=
nLen
;
newStr
->
buffer
[
nLen
]
=
0
;
return
newStr
;
}
}
/** Allocate a new string containing space for a given number of characters.
The reference count of the new string will be 1. The length of the string
...
...
@@ -82,10 +66,7 @@ namespace detail
@param len
the number of characters.
*/
COMPHELPER_DLLPUBLIC
inline
rtl_uString
*
SAL_CALL
rtl_uString_alloc
(
sal_Int32
nLen
)
{
return
detail
::
string_alloc
<
rtl_uString
,
sal_Unicode
>
(
nLen
);
}
COMPHELPER_DLLPUBLIC
rtl_uString
*
SAL_CALL
rtl_uString_alloc
(
sal_Int32
nLen
);
/** Allocate a new string containing space for a given number of characters.
...
...
@@ -107,10 +88,7 @@ COMPHELPER_DLLPUBLIC inline rtl_uString * SAL_CALL rtl_uString_alloc(sal_Int32 n
@param len
the number of characters.
*/
COMPHELPER_DLLPUBLIC
inline
rtl_String
*
SAL_CALL
rtl_string_alloc
(
sal_Int32
nLen
)
{
return
detail
::
string_alloc
<
rtl_String
,
sal_Char
>
(
nLen
);
}
COMPHELPER_DLLPUBLIC
rtl_String
*
SAL_CALL
rtl_string_alloc
(
sal_Int32
nLen
);
/** Removes all occurrences of a character from within the source string
...
...
comphelper/source/misc/string.cxx
Dosyayı görüntüle @
53294e81
...
...
@@ -401,6 +401,43 @@ bool isdigitAsciiString(const rtl::OUString &rString)
return
tmpl_is_OPER_AsciiString
<
isdigitAscii
>
(
rString
);
}
namespace
{
template
<
typename
T
,
typename
U
>
T
*
string_alloc
(
sal_Int32
nLen
)
{
//Clearly this is somewhat cosy with the sal implmentation
//rtl_[u]String contains U buffer[1], so an input of nLen
//allocates a buffer of nLen + 1 and we'll ensure a null termination
T
*
newStr
=
(
sal
::
static_int_cast
<
sal_uInt32
>
(
nLen
)
<=
((
SAL_MAX_UINT32
-
sizeof
(
T
))
/
sizeof
(
U
)))
?
(
T
*
)
rtl_allocateMemory
(
sizeof
(
T
)
+
nLen
*
sizeof
(
U
))
:
NULL
;
if
(
!
newStr
)
throw
std
::
bad_alloc
();
newStr
->
refCount
=
1
;
newStr
->
length
=
nLen
;
newStr
->
buffer
[
nLen
]
=
0
;
return
newStr
;
}
}
rtl_uString
*
SAL_CALL
rtl_uString_alloc
(
sal_Int32
nLen
)
{
return
string_alloc
<
rtl_uString
,
sal_Unicode
>
(
nLen
);
}
rtl_String
*
SAL_CALL
rtl_string_alloc
(
sal_Int32
nLen
)
{
return
string_alloc
<
rtl_String
,
sal_Char
>
(
nLen
);
}
}
}
/* 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