Change Text Sample set_style to AppendStyle

To ensure that the style data is formatted correctly, changing the
set_style method to AppendStyle so that joining values will be
done in controlled setting.

Change-Id: Ia88e2d260b11339e6777ff018813e8aeb802a501
This commit is contained in:
Aaron Vaage 2017-09-14 10:31:16 -07:00
parent 0adf0492ab
commit 28385c0fc0
2 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,13 @@ void TextSample::SetTime(uint64_t start_time, uint64_t end_time) {
duration_ = end_time - start_time;
}
void TextSample::AppendStyle(const std::string& style) {
if (settings_.length()) {
settings_ += " ";
}
settings_ += style;
}
void TextSample::AppendPayload(const std::string& payload) {
if (payload_.length()) {
payload_ += "\n";

View File

@ -26,8 +26,8 @@ class TextSample {
uint64_t EndTime() const;
void set_id(const std::string& id) { id_ = id; }
void set_settings(const std::string& settings) { settings_ = settings; }
void SetTime(uint64_t start_time, uint64_t end_time);
void AppendStyle(const std::string& style);
void AppendPayload(const std::string& payload);
private: