Support string(StringPiece) for mozc string_piece.
REF_BUG=
REF_CL=154256400
REF_TIME=2017-04-26T12:43:24+09:00
REF_TIME_RAW=1493178204 +0900
Toshiyuki Hanaoka
7 years ago
115 | 115 |
return string(!empty() ? data() : "", size());
|
116 | 116 |
}
|
117 | 117 |
|
|
118 |
explicit operator string() const {
|
|
119 |
return string(!empty() ? data() : "", size());
|
|
120 |
}
|
|
121 |
|
118 | 122 |
void CopyToString(string *target) const;
|
119 | 123 |
void AppendToString(string *target) const;
|
120 | 124 |
|
502 | 502 |
ASSERT_EQ(c, s3);
|
503 | 503 |
string s4(e.as_string());
|
504 | 504 |
ASSERT_TRUE(s4.empty());
|
|
505 |
|
|
506 |
// cast to string
|
|
507 |
c = StringPiece("foobar");
|
|
508 |
ASSERT_EQ(string("foobar"), string(c));
|
|
509 |
c = StringPiece("foobar", 6);
|
|
510 |
ASSERT_EQ(string("foobar"), string(c));
|
|
511 |
c = StringPiece("foobarfoobar", 6);
|
|
512 |
ASSERT_EQ(string("foobar"), string(c));
|
|
513 |
string s5 = string(e);
|
|
514 |
ASSERT_TRUE(s5.empty());
|
505 | 515 |
}
|
506 | 516 |
|
507 | 517 |
TEST(StringPieceTest, CheckNULL) {
|
29 | 29 |
|
30 | 30 |
MAJOR=2
|
31 | 31 |
MINOR=21
|
32 | |
BUILD=2708
|
|
32 |
BUILD=2709
|
33 | 33 |
REVISION=102
|
34 | 34 |
# This version represents the version of Mozc IME engine (converter, predictor,
|
35 | 35 |
# etc.). This version info is included both in the Mozc server and in the Mozc
|