Codebase list mozc / c8f69fb
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
3 changed file(s) with 15 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
115115 return string(!empty() ? data() : "", size());
116116 }
117117
118 explicit operator string() const {
119 return string(!empty() ? data() : "", size());
120 }
121
118122 void CopyToString(string *target) const;
119123 void AppendToString(string *target) const;
120124
502502 ASSERT_EQ(c, s3);
503503 string s4(e.as_string());
504504 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());
505515 }
506516
507517 TEST(StringPieceTest, CheckNULL) {
2929
3030 MAJOR=2
3131 MINOR=21
32 BUILD=2708
32 BUILD=2709
3333 REVISION=102
3434 # This version represents the version of Mozc IME engine (converter, predictor,
3535 # etc.). This version info is included both in the Mozc server and in the Mozc