add SkString::append(const char c)
R=bsalomon@google.com Review URL: https://codereview.chromium.org/14813013 git-svn-id: http://skia.googlecode.com/svn/trunk@9081 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
6d58ad3a82
commit
3a8d3d06ea
@ -168,6 +168,7 @@ public:
|
|||||||
void insertScalar(size_t offset, SkScalar);
|
void insertScalar(size_t offset, SkScalar);
|
||||||
|
|
||||||
void append(const SkString& str) { this->insert((size_t)-1, str); }
|
void append(const SkString& str) { this->insert((size_t)-1, str); }
|
||||||
|
void append(const char c) { this->insert((size_t)-1, &c, 1); }
|
||||||
void append(const char text[]) { this->insert((size_t)-1, text); }
|
void append(const char text[]) { this->insert((size_t)-1, text); }
|
||||||
void append(const char text[], size_t len) { this->insert((size_t)-1, text, len); }
|
void append(const char text[], size_t len) { this->insert((size_t)-1, text, len); }
|
||||||
void appendUnichar(SkUnichar uni) { this->insertUnichar((size_t)-1, uni); }
|
void appendUnichar(SkUnichar uni) { this->insertUnichar((size_t)-1, uni); }
|
||||||
@ -194,7 +195,7 @@ public:
|
|||||||
|
|
||||||
SkString& operator+=(const SkString& s) { this->append(s); return *this; }
|
SkString& operator+=(const SkString& s) { this->append(s); return *this; }
|
||||||
SkString& operator+=(const char text[]) { this->append(text); return *this; }
|
SkString& operator+=(const char text[]) { this->append(text); return *this; }
|
||||||
SkString& operator+=(const char c) { this->append(&c, 1); return *this; }
|
SkString& operator+=(const char c) { this->append(c); return *this; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swap contents between this and other. This function is guaranteed
|
* Swap contents between this and other. This function is guaranteed
|
||||||
|
@ -92,6 +92,18 @@ static void TestString(skiatest::Reporter* reporter) {
|
|||||||
f.prepend("hello ");
|
f.prepend("hello ");
|
||||||
REPORTER_ASSERT(reporter, a.equals("hello world") && a == e && a == f);
|
REPORTER_ASSERT(reporter, a.equals("hello world") && a == e && a == f);
|
||||||
|
|
||||||
|
a.reset();
|
||||||
|
a.append(SkString("string"));
|
||||||
|
a.append("text");
|
||||||
|
a.append('c');
|
||||||
|
REPORTER_ASSERT(reporter, a.equals("stringtextc"));
|
||||||
|
|
||||||
|
a.reset();
|
||||||
|
a += 'c';
|
||||||
|
a += "text";
|
||||||
|
a += SkString("string");
|
||||||
|
REPORTER_ASSERT(reporter, a.equals("ctextstring"));
|
||||||
|
|
||||||
a.reset();
|
a.reset();
|
||||||
b.resize(0);
|
b.resize(0);
|
||||||
REPORTER_ASSERT(reporter, a.isEmpty() && b.isEmpty() && a == b);
|
REPORTER_ASSERT(reporter, a.isEmpty() && b.isEmpty() && a == b);
|
||||||
|
Loading…
Reference in New Issue
Block a user