| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (C) 2013, Opera Software ASA. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef BufferedLineReader_h | 31 #ifndef BufferedLineReader_h |
| 32 #define BufferedLineReader_h | 32 #define BufferedLineReader_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "platform/text/SegmentedString.h" | 35 #include "platform/text/SegmentedString.h" |
| 36 #include "wtf/Allocator.h" |
| 36 #include "wtf/text/StringBuilder.h" | 37 #include "wtf/text/StringBuilder.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 // Line collection helper for the WebVTT Parser. | 41 // Line collection helper for the WebVTT Parser. |
| 41 // | 42 // |
| 42 // Converts a stream of data (== a sequence of Strings) into a set of | 43 // Converts a stream of data (== a sequence of Strings) into a set of |
| 43 // lines. CR, LR or CRLF are considered linebreaks. Normalizes NULs (U+0000) | 44 // lines. CR, LR or CRLF are considered linebreaks. Normalizes NULs (U+0000) |
| 44 // to 'REPLACEMENT CHARACTER' (U+FFFD) and does not return the linebreaks as | 45 // to 'REPLACEMENT CHARACTER' (U+FFFD) and does not return the linebreaks as |
| 45 // part of the result. | 46 // part of the result. |
| 46 class CORE_EXPORT BufferedLineReader { | 47 class CORE_EXPORT BufferedLineReader { |
| 48 DISALLOW_ALLOCATION(); |
| 47 WTF_MAKE_NONCOPYABLE(BufferedLineReader); | 49 WTF_MAKE_NONCOPYABLE(BufferedLineReader); |
| 48 public: | 50 public: |
| 49 BufferedLineReader() | 51 BufferedLineReader() |
| 50 : m_endOfStream(false) | 52 : m_endOfStream(false) |
| 51 , m_maybeSkipLF(false) { } | 53 , m_maybeSkipLF(false) { } |
| 52 | 54 |
| 53 // Append data to the internal buffer. | 55 // Append data to the internal buffer. |
| 54 void append(const String& data) | 56 void append(const String& data) |
| 55 { | 57 { |
| 56 ASSERT(!m_endOfStream); | 58 ASSERT(!m_endOfStream); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 80 | 82 |
| 81 SegmentedString m_buffer; | 83 SegmentedString m_buffer; |
| 82 StringBuilder m_lineBuffer; | 84 StringBuilder m_lineBuffer; |
| 83 bool m_endOfStream; | 85 bool m_endOfStream; |
| 84 bool m_maybeSkipLF; | 86 bool m_maybeSkipLF; |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } // namespace blink | 89 } // namespace blink |
| 88 | 90 |
| 89 #endif | 91 #endif |
| OLD | NEW |