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
92fec304
Kaydet (Commit)
92fec304
authored
Mar 26, 2012
tarafından
Luboš Luňák
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
string literal overloads for OUStringBuffer
üst
0a08973d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
ustrbuf.hxx
sal/inc/rtl/ustrbuf.hxx
+18
-0
test_oustring_stringliterals.cxx
sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+12
-0
No files found.
sal/inc/rtl/ustrbuf.hxx
Dosyayı görüntüle @
92fec304
...
...
@@ -405,6 +405,24 @@ public:
return
*
this
;
}
/**
@overload
This function accepts an ASCII string literal as its argument.
@since LibreOffice 3.6
*/
template
<
int
N
>
OUStringBuffer
&
append
(
const
char
(
&
literal
)[
N
]
)
{
rtl_uStringbuffer_insert_ascii
(
&
pData
,
&
nCapacity
,
getLength
(),
literal
,
N
-
1
);
return
*
this
;
}
/**
It is an error to call this overload. Strings cannot directly use non-const char[].
@internal
*/
template
<
int
N
>
OUStringBuffer
&
append
(
char
(
&
literal
)[
N
]
);
/**
Appends the string representation of the <code>sal_Bool</code>
...
...
sal/qa/rtl/strings/test_oustring_stringliterals.cxx
Dosyayı görüntüle @
92fec304
...
...
@@ -37,6 +37,7 @@ extern bool rtl_string_unittest_const_literal;
#include <cppunit/extensions/HelperMacros.h>
#include "rtl/string.h"
#include "rtl/ustring.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/oustringostreaminserter.hxx"
namespace
test
{
namespace
oustring
{
...
...
@@ -48,6 +49,7 @@ private:
void
checkUsage
();
void
checkExtraIntArgument
();
void
checkNonconstChar
();
void
checkBuffer
();
void
testcall
(
const
char
str
[]
);
// invalid conversions will trigger templated OUString ctor that creates an empty string
...
...
@@ -59,6 +61,7 @@ CPPUNIT_TEST(checkCtors);
CPPUNIT_TEST
(
checkUsage
);
CPPUNIT_TEST
(
checkExtraIntArgument
);
CPPUNIT_TEST
(
checkNonconstChar
);
CPPUNIT_TEST
(
checkBuffer
);
CPPUNIT_TEST_SUITE_END
();
};
...
...
@@ -160,6 +163,15 @@ void test::oustring::StringLiterals::checkNonconstChar()
CPPUNIT_ASSERT
(
rtl
::
OUString
(
"foobar"
)
==
rtl
::
OUString
(
"footest"
).
replaceAll
(
consttest
,
constbar
));
}
void
test
::
oustring
::
StringLiterals
::
checkBuffer
()
{
rtl
::
OUStringBuffer
buf
;
buf
.
append
(
"foo"
);
CPPUNIT_ASSERT
(
buf
.
toString
()
==
"foo"
);
buf
.
append
(
"bar"
);
CPPUNIT_ASSERT
(
buf
.
toString
()
==
"foobar"
);
}
}}
// namespace
CPPUNIT_TEST_SUITE_REGISTRATION
(
test
::
oustring
::
StringLiterals
);
...
...
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