From 6da434b5b235b2489b5b63b0ac49be40b2da0f49 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 12 Sep 2012 20:22:11 +0200 Subject: [PATCH] strbuffer: change basic_buffer to BasicBuffer --- src/helpers.h | 4 ++-- src/scrollpad.h | 4 ++-- src/strbuffer.h | 56 ++++++++++++++++++++++++------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/helpers.h b/src/helpers.h index d7b4462e..3df02b5b 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -328,7 +328,7 @@ template <> struct StringConverter { }; template -void stringToBuffer(Iterator first, Iterator last, NC::basic_buffer &buf) +void stringToBuffer(Iterator first, Iterator last, NC::BasicBuffer &buf) { for (auto it = first; it != last; ++it) { @@ -403,7 +403,7 @@ void stringToBuffer(Iterator first, Iterator last, NC::basic_buffer -void stringToBuffer(const std::basic_string &s, NC::basic_buffer &buf) +void stringToBuffer(const std::basic_string &s, NC::BasicBuffer &buf) { stringToBuffer(s.begin(), s.end(), buf); } diff --git a/src/scrollpad.h b/src/scrollpad.h index 9a419ab7..ac1d3976 100644 --- a/src/scrollpad.h +++ b/src/scrollpad.h @@ -55,7 +55,7 @@ struct Scrollpad: public Window /// @param for_each indicates whether function searches through whole text and sets /// given format for all occurences of given string or stops after first occurence /// @return true if at least one occurence of the string was found, false otherwise - /// @see basic_buffer::setFormatting() + /// @see BasicBuffer::setFormatting() bool setFormatting(short val_b, const std::wstring &s, short val_e, bool case_sensitive, bool for_each = 1); @@ -65,7 +65,7 @@ struct Scrollpad: public Window /// Removes all format flags and colors that was applied /// by the most recent call to setFormatting() function /// @see setFormatting() - /// @see basic_buffer::removeFormatting() + /// @see BasicBuffer::removeFormatting() void removeFormatting(); /// @return text stored in internal buffer diff --git a/src/strbuffer.h b/src/strbuffer.h index f75472e0..8d570b67 100644 --- a/src/strbuffer.h +++ b/src/strbuffer.h @@ -31,7 +31,7 @@ namespace NC {// /// Buffer template class that can store text along with its /// format attributes. The content can be easily printed to /// window or taken as raw string at any time. -template class basic_buffer +template class BasicBuffer { friend struct Scrollpad; @@ -61,11 +61,11 @@ template class basic_buffer public: /// Constructs an empty buffer - basic_buffer() { } + BasicBuffer() { } /// Constructs a buffer from the existed one /// @param b copied buffer - basic_buffer(const basic_buffer &b); + BasicBuffer(const BasicBuffer &b); /// @return raw content of the buffer without formatting informations const std::basic_string &str() const; @@ -111,49 +111,49 @@ public: /// Clears the content of the buffer and its formatting informations void clear(); - basic_buffer &operator<<(int n) + BasicBuffer &operator<<(int n) { m_string += intTo< std::basic_string >::apply(n); return *this; } - basic_buffer &operator<<(long int n) + BasicBuffer &operator<<(long int n) { m_string += longIntTo< std::basic_string >::apply(n); return *this; } - basic_buffer &operator<<(unsigned int n) + BasicBuffer &operator<<(unsigned int n) { m_string += unsignedIntTo< std::basic_string >::apply(n); return *this; } - basic_buffer &operator<<(unsigned long int n) + BasicBuffer &operator<<(unsigned long int n) { m_string += unsignedLongIntTo< std::basic_string >::apply(n); return *this; } - basic_buffer &operator<<(char c) + BasicBuffer &operator<<(char c) { m_string += c; return *this; } - basic_buffer &operator<<(wchar_t wc) + BasicBuffer &operator<<(wchar_t wc) { m_string += wc; return *this; } - basic_buffer &operator<<(const CharT *s) + BasicBuffer &operator<<(const CharT *s) { m_string += s; return *this; } - basic_buffer &operator<<(const std::basic_string &s) + BasicBuffer &operator<<(const std::basic_string &s) { m_string += s; return *this; @@ -161,20 +161,20 @@ public: /// Handles colors /// @return reference to itself - basic_buffer &operator<<(Color color); + BasicBuffer &operator<<(Color color); /// Handles format flags /// @return reference to itself - basic_buffer &operator<<(Format f); + BasicBuffer &operator<<(Format f); /// Handles copying one buffer to another using operator<<() /// @param buf buffer to be copied /// @return reference to itself - basic_buffer &operator<<(const basic_buffer &buf); + BasicBuffer &operator<<(const BasicBuffer &buf); /// Friend operator that handles printing /// the content of buffer to window object - friend Window &operator<<(Window &w, const basic_buffer &buf) + friend Window &operator<<(Window &w, const BasicBuffer &buf) { const std::basic_string &s = buf.m_string; if (buf.m_format.empty()) @@ -211,20 +211,20 @@ private: }; /// Standard buffer that uses narrow characters -typedef basic_buffer Buffer; +typedef BasicBuffer Buffer; /// Standard buffer that uses wide characters -typedef basic_buffer WBuffer; +typedef BasicBuffer WBuffer; -template basic_buffer::basic_buffer(const basic_buffer &b) +template BasicBuffer::BasicBuffer(const BasicBuffer &b) : m_string(b.m_string), m_format(b.m_format) { } -template const std::basic_string &basic_buffer::str() const +template const std::basic_string &BasicBuffer::str() const { return m_string; } -template bool basic_buffer::setFormatting( +template bool BasicBuffer::setFormatting( short val_b, std::basic_string s, short val_e, @@ -261,7 +261,7 @@ template bool basic_buffer::setFormatting( return result; } -template void basic_buffer::removeFormatting( +template void BasicBuffer::removeFormatting( short val_b, std::basic_string pattern, short val_e, @@ -294,12 +294,12 @@ template void basic_buffer::removeFormatting( } } -template void basic_buffer::removeFormatting() +template void BasicBuffer::removeFormatting() { m_format.clear(); } -template void basic_buffer::write( +template void BasicBuffer::write( Window &w, size_t &start_pos, size_t width, @@ -357,13 +357,13 @@ template void basic_buffer::write( w << *this; } -template void basic_buffer::clear() +template void BasicBuffer::clear() { m_string.clear(); m_format.clear(); } -template void basic_buffer::loadAttribute(Window &w, short value) const +template void BasicBuffer::loadAttribute(Window &w, short value) const { if (value < fmtNone) w << Color(value); @@ -371,7 +371,7 @@ template void basic_buffer::loadAttribute(Window &w, sho w << Format(value); } -template basic_buffer &basic_buffer::operator<<(Color color) +template BasicBuffer &BasicBuffer::operator<<(Color color) { FormatPos f; f.Position = m_string.length(); @@ -380,12 +380,12 @@ template basic_buffer &basic_buffer::operator<<(C return *this; } -template basic_buffer &basic_buffer::operator<<(Format f) +template BasicBuffer &BasicBuffer::operator<<(Format f) { return operator<<(Color(f)); } -template basic_buffer &basic_buffer::operator<<(const basic_buffer &buf) +template BasicBuffer &BasicBuffer::operator<<(const BasicBuffer &buf) { size_t length = m_string.length(); m_string += buf.m_string;