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
edc96a15
Kaydet (Commit)
edc96a15
authored
Haz 26, 2015
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add optimized OUString += literal overload
Change-Id: Ib34196185f90204a71598f2c659c3fddce7a0e4d
üst
1de776a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
0 deletions
+75
-0
ustring.h
include/rtl/ustring.h
+24
-0
ustring.hxx
include/rtl/ustring.hxx
+18
-0
test_oustring_concat.cxx
sal/qa/rtl/strings/test_oustring_concat.cxx
+8
-0
ustring.cxx
sal/rtl/ustring.cxx
+24
-0
sal.map
sal/util/sal.map
+1
-0
No files found.
include/rtl/ustring.h
Dosyayı görüntüle @
edc96a15
...
@@ -1434,6 +1434,30 @@ SAL_DLLPUBLIC sal_Unicode * SAL_CALL rtl_uString_getStr(
...
@@ -1434,6 +1434,30 @@ SAL_DLLPUBLIC sal_Unicode * SAL_CALL rtl_uString_getStr(
SAL_DLLPUBLIC
void
SAL_CALL
rtl_uString_newConcat
(
SAL_DLLPUBLIC
void
SAL_CALL
rtl_uString_newConcat
(
rtl_uString
**
newStr
,
rtl_uString
*
left
,
rtl_uString
*
right
)
SAL_THROW_EXTERN_C
();
rtl_uString
**
newStr
,
rtl_uString
*
left
,
rtl_uString
*
right
)
SAL_THROW_EXTERN_C
();
/** Create a new string that is the concatenation of two other strings.
The new string does not necessarily have a reference count of 1 (in cases
where the ASCII string is empty), so it must not be modified without
checking the reference count.
@param newString
pointer to the new string. The pointed-to data must be null or a valid
string.
@param left
a valid string.
@param right must not be null and must point to memory of at least
\p rightLength ASCII bytes
@param rightLength the length of the \p right string; must be non-negative
@since LibreOffice 5.1
*/
SAL_DLLPUBLIC
void
SAL_CALL
rtl_uString_newConcatAsciiL
(
rtl_uString
**
newString
,
rtl_uString
*
left
,
char
const
*
right
,
sal_Int32
rightLength
);
/** Create a new string by replacing a substring of another string.
/** Create a new string by replacing a substring of another string.
The new string results from replacing a number of characters (count),
The new string results from replacing a number of characters (count),
...
...
include/rtl/ustring.hxx
Dosyayı görüntüle @
edc96a15
...
@@ -424,6 +424,24 @@ public:
...
@@ -424,6 +424,24 @@ public:
return
*
this
;
return
*
this
;
}
}
/** Append an ASCII string literal to this string.
@param literal an 8-bit ASCII-only string literal
@since LibreOffice 5.1
*/
template
<
typename
T
>
typename
libreoffice_internal
::
ConstCharArrayDetector
<
T
,
OUString
&>::
Type
operator
+=
(
T
&
literal
)
{
assert
(
libreoffice_internal
::
ConstCharArrayDetector
<
T
>::
isValid
(
literal
));
rtl_uString_newConcatAsciiL
(
&
pData
,
pData
,
libreoffice_internal
::
ConstCharArrayDetector
<
T
>::
toPointer
(
literal
),
libreoffice_internal
::
ConstCharArrayDetector
<
T
>::
length
);
return
*
this
;
}
#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/**
/**
@overload
@overload
...
...
sal/qa/rtl/strings/test_oustring_concat.cxx
Dosyayı görüntüle @
edc96a15
...
@@ -40,12 +40,14 @@ class StringConcat : public CppUnit::TestFixture
...
@@ -40,12 +40,14 @@ class StringConcat : public CppUnit::TestFixture
{
{
private
:
private
:
void
checkConcat
();
void
checkConcat
();
void
checkConcatAsciiL
();
void
checkEnsureCapacity
();
void
checkEnsureCapacity
();
void
checkAppend
();
void
checkAppend
();
void
checkInvalid
();
void
checkInvalid
();
CPPUNIT_TEST_SUITE
(
StringConcat
);
CPPUNIT_TEST_SUITE
(
StringConcat
);
CPPUNIT_TEST
(
checkConcat
);
CPPUNIT_TEST
(
checkConcat
);
CPPUNIT_TEST
(
checkConcatAsciiL
);
CPPUNIT_TEST
(
checkEnsureCapacity
);
CPPUNIT_TEST
(
checkEnsureCapacity
);
CPPUNIT_TEST
(
checkAppend
);
CPPUNIT_TEST
(
checkAppend
);
CPPUNIT_TEST
(
checkInvalid
);
CPPUNIT_TEST
(
checkInvalid
);
...
@@ -71,6 +73,12 @@ void test::oustring::StringConcat::checkConcat()
...
@@ -71,6 +73,12 @@ void test::oustring::StringConcat::checkConcat()
CPPUNIT_ASSERT_EQUAL
((
typeid
(
OUStringConcat
<
OUStringBuffer
,
OUString
>
)),
typeid
(
OUStringBuffer
(
"foo"
)
+
OUString
(
"bar"
)));
CPPUNIT_ASSERT_EQUAL
((
typeid
(
OUStringConcat
<
OUStringBuffer
,
OUString
>
)),
typeid
(
OUStringBuffer
(
"foo"
)
+
OUString
(
"bar"
)));
}
}
void
test
::
oustring
::
StringConcat
::
checkConcatAsciiL
()
{
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"foo"
),
OUString
(
"foo"
)
+=
""
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"foobar"
),
OUString
(
"foo"
)
+=
"bar"
);
}
void
test
::
oustring
::
StringConcat
::
checkEnsureCapacity
()
void
test
::
oustring
::
StringConcat
::
checkEnsureCapacity
()
{
{
rtl_uString
*
str
=
NULL
;
rtl_uString
*
str
=
NULL
;
...
...
sal/rtl/ustring.cxx
Dosyayı görüntüle @
edc96a15
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
#include <cassert>
#include <cassert>
#include <cstdlib>
#include <cstdlib>
#include <limits>
#include <stdexcept>
#include <osl/diagnose.h>
#include <osl/diagnose.h>
#include <osl/interlck.h>
#include <osl/interlck.h>
...
@@ -595,6 +597,28 @@ void SAL_CALL rtl_uString_newFromCodePoints(
...
@@ -595,6 +597,28 @@ void SAL_CALL rtl_uString_newFromCodePoints(
RTL_LOG_STRING_NEW
(
*
newString
);
RTL_LOG_STRING_NEW
(
*
newString
);
}
}
void
rtl_uString_newConcatAsciiL
(
rtl_uString
**
newString
,
rtl_uString
*
left
,
char
const
*
right
,
sal_Int32
rightLength
)
{
assert
(
newString
!=
nullptr
);
assert
(
left
!=
nullptr
);
assert
(
right
!=
nullptr
);
assert
(
rightLength
>=
0
);
if
(
left
->
length
>
std
::
numeric_limits
<
sal_Int32
>::
max
()
-
rightLength
)
{
throw
std
::
length_error
(
"rtl_uString_newConcatAsciiL"
);
}
sal_Int32
n
=
left
->
length
+
rightLength
;
rtl_uString_assign
(
newString
,
left
);
rtl_uString_ensureCapacity
(
newString
,
n
);
sal_Unicode
*
p
=
(
*
newString
)
->
buffer
+
(
*
newString
)
->
length
;
for
(
sal_Int32
i
=
0
;
i
!=
rightLength
;
++
i
)
{
p
[
i
]
=
static_cast
<
unsigned
char
>
(
right
[
i
]);
}
(
*
newString
)
->
buffer
[
n
]
=
0
;
(
*
newString
)
->
length
=
n
;
}
/* ======================================================================= */
/* ======================================================================= */
static
int
rtl_ImplGetFastUTF8UnicodeLen
(
const
sal_Char
*
pStr
,
sal_Int32
nLen
,
bool
*
ascii
)
static
int
rtl_ImplGetFastUTF8UnicodeLen
(
const
sal_Char
*
pStr
,
sal_Int32
nLen
,
bool
*
ascii
)
...
...
sal/util/sal.map
Dosyayı görüntüle @
edc96a15
...
@@ -685,6 +685,7 @@ LIBO_UDK_5.0 { # symbols available in >= LibO 5.0
...
@@ -685,6 +685,7 @@ LIBO_UDK_5.0 { # symbols available in >= LibO 5.0
LIBO_UDK_5.1 { # symbols available in >= LibO 5.1
LIBO_UDK_5.1 { # symbols available in >= LibO 5.1
global:
global:
rtl_uString_newConcatAsciiL;
rtl_uString_newReplaceAllToAsciiL;
rtl_uString_newReplaceAllToAsciiL;
rtl_uString_newReplaceFirstToAsciiL;
rtl_uString_newReplaceFirstToAsciiL;
} LIBO_UDK_5.0;
} LIBO_UDK_5.0;
...
...
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