Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit d069803

Browse files
committed
更名PlainMessage的GetText/SetText为Text
1 parent dee2da5 commit d069803

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

UnitTest/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST(MessageChain_Test, Add_and_Get) {
1919
MessageChain mc;
2020
mc.Add(PlainMessage("Hello"));
2121
auto m = mc.GetFirst<PlainMessage>();
22-
ASSERT_TRUE(m.GetText() == "Hello");
22+
ASSERT_TRUE(m.Text() == "Hello");
2323
}
2424

2525
TEST(MessageChain_Test, GetAll) {
@@ -29,8 +29,8 @@ TEST(MessageChain_Test, GetAll) {
2929
mc.Add(PlainMessage("Hi"));
3030
auto m = mc.GetAll<PlainMessage>();
3131
ASSERT_TRUE(m.size() == 2);
32-
ASSERT_TRUE(m[0].GetText() == "Hello");
33-
ASSERT_TRUE(m[1].GetText() == "Hi");
32+
ASSERT_TRUE(m[0].Text() == "Hello");
33+
ASSERT_TRUE(m[1].Text() == "Hi");
3434
}
3535

3636
TEST(MessageChain_Test, Count) {
@@ -48,7 +48,7 @@ TEST(MessageChain_Test, get_at) {
4848
mc.Add(PlainMessage("Hi"));
4949
ASSERT_TRUE(mc[0]->GetType() == "Plain");
5050
auto mptr = std::dynamic_pointer_cast<PlainMessage>(mc[1]);
51-
ASSERT_TRUE(mptr->GetText() == "Hi");
51+
ASSERT_TRUE(mptr->Text() == "Hi");
5252
}
5353

5454
TEST(MessageChain_Test, Clear) {
@@ -69,7 +69,7 @@ TEST(MessageChain_Test, Remove) {
6969
mc.Remove(PlainMessage("Hello"));
7070
ASSERT_TRUE(mc.Count() == 1);
7171
auto mptr = std::dynamic_pointer_cast<PlainMessage>(mc[0]);
72-
ASSERT_TRUE(mptr->GetText() == "Hi");
72+
ASSERT_TRUE(mptr->Text() == "Hi");
7373
}
7474

7575
TEST(MessageChain_Test, GetPlainText) {

include/defs/messages/PlainMessage.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace Cyan
4444
}
4545
virtual ~PlainMessage() {}
4646

47-
const string& GetText() const { return text_; }
48-
void SetText(const string& text) { this->text_ = text; }
47+
const string& Text() const { return text_; }
48+
void Text(const string& text) { this->text_ = text; }
4949

5050
private:
5151
string type_ = "Plain";

src/MessageChain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace Cyan
102102
auto mptr = std::dynamic_pointer_cast<PlainMessage>(m);
103103
if (mptr)
104104
{
105-
ss << mptr->GetText();
105+
ss << mptr->Text();
106106
}
107107

108108
}
@@ -119,7 +119,7 @@ namespace Cyan
119119
auto mptr = std::dynamic_pointer_cast<PlainMessage>(m);
120120
if (mptr)
121121
{
122-
return mptr->GetText();
122+
return mptr->Text();
123123
}
124124
}
125125
}

0 commit comments

Comments
 (0)