Chromium Code Reviews| Index: media/base/text_buffer.cc |
| diff --git a/media/base/text_buffer.cc b/media/base/text_buffer.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7a230a473ea3e5e7a33143ef4ee304a8c167a508 |
| --- /dev/null |
| +++ b/media/base/text_buffer.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "media/base/text_buffer.h" |
| + |
| +namespace media { |
| + |
| +TextBuffer::TextBuffer(const base::TimeDelta& timestamp, |
| + const base::TimeDelta& duration) |
| + : timestamp_(timestamp), |
| + duration_(duration) { |
| +} |
| + |
| +TextBuffer::~TextBuffer() {} |
| + |
| +void TextBuffer::set_string( |
| + const uint8* buf, |
| + int buflen, |
| + std::string* str) { |
| + if (buf == NULL || buflen <= 0) { |
|
fgalligan1
2013/09/04 22:23:09
Add DCHECK(str)
Matthew Heaney (Chromium)
2013/09/13 19:51:54
OBE
|
| + str->clear(); |
| + } else { |
| + str->assign(buf, buf + buflen); |
| + } |
| +} |
| + |
| +void TextBuffer::set_id(const uint8* id, int id_size) { |
| + set_string(id, id_size, &id_); |
| +} |
| + |
| +void TextBuffer::set_settings(const uint8* settings, int settings_size) { |
| + set_string(settings, settings_size, &settings_); |
| +} |
| + |
| +void TextBuffer::set_text(const uint8* text, int text_size) { |
| + set_string(text, text_size, &text_); |
| +} |
| + |
| +} // namespace media |