From a80bf2a7bf81377baff391791f39c985249e9a5f Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Tue, 10 Mar 2009 22:47:39 +0100 Subject: [PATCH] use typename keyword instead of class as it's more logical --- src/display.h | 4 +-- src/helpers.h | 4 +-- src/menu.h | 94 ++++++++++++++++++++++++------------------------- src/screen.h | 14 ++++---- src/scrollpad.h | 2 +- src/strbuffer.h | 22 ++++++------ 6 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/display.h b/src/display.h index 6bb2be7a..3069a078 100644 --- a/src/display.h +++ b/src/display.h @@ -29,12 +29,12 @@ namespace Display { std::string Columns(std::string); - template void Generic(const T &t, void *, Menu *menu) + template void Generic(const T &t, void *, Menu *menu) { *menu << t; } - template void Pairs(const std::pair &pair, void *, Menu< std::pair > *menu) + template void Pairs(const std::pair &pair, void *, Menu< std::pair > *menu) { *menu << pair.first; } diff --git a/src/helpers.h b/src/helpers.h index 9ffe5c51..69726a80 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -37,7 +37,7 @@ class CaseInsensitiveSorting bool operator()(MPD::Song *, MPD::Song *); bool operator()(const MPD::Item &, const MPD::Item &); - template bool operator()(const std::pair &a, const std::pair &b) + template bool operator()(const std::pair &a, const std::pair &b) { std::string aa = a.first; std::string bb = b.first; @@ -47,7 +47,7 @@ class CaseInsensitiveSorting } }; -template std::string StringPairToString(const std::pair &pair, void *) +template std::string StringPairToString(const std::pair &pair, void *) { return pair.first; } diff --git a/src/menu.h b/src/menu.h index 3f4f357b..a625ff7f 100644 --- a/src/menu.h +++ b/src/menu.h @@ -66,7 +66,7 @@ namespace NCurses virtual bool isFiltered() = 0; }; - template class Menu : public Window, public List + template class Menu : public Window, public List { typedef void (*ItemDisplayer) (const T &, void *, Menu *); typedef std::string (*GetStringFunction) (const T &, void *); @@ -83,7 +83,7 @@ namespace NCurses bool isStatic; }; - template class InternalSorting + template class InternalSorting { Comparison cmp; @@ -151,7 +151,7 @@ namespace NCurses virtual void Reset(); virtual void Clear(bool clrscr = 1); - template void Sort(size_t beginning = 0) + template void Sort(size_t beginning = 0) { if (itsOptions.empty()) return; @@ -209,7 +209,7 @@ namespace NCurses template <> std::string Menu::GetOption(size_t pos); } -template NCurses::Menu::Menu(size_t startx, +template NCurses::Menu::Menu(size_t startx, size_t starty, size_t width, size_t height, @@ -231,7 +231,7 @@ template NCurses::Menu::Menu(size_t startx, { } -template NCurses::Menu::Menu(const Menu &m) : Window(m) +template NCurses::Menu::Menu(const Menu &m) : Window(m) { itsOptions = m.itsOptions; itsItemDisplayer = m.itsItemDisplayer; @@ -242,18 +242,18 @@ template NCurses::Menu::Menu(const Menu &m) : Window(m) highlightEnabled = m.highlightEnabled; } -template NCurses::Menu::~Menu() +template NCurses::Menu::~Menu() { for (option_iterator it = itsOptions.begin(); it != itsOptions.end(); it++) delete *it; } -template void NCurses::Menu::Reserve(size_t size) +template void NCurses::Menu::Reserve(size_t size) { itsOptions.reserve(size); } -template void NCurses::Menu::ResizeBuffer(size_t size) +template void NCurses::Menu::ResizeBuffer(size_t size) { itsOptions.resize(size); for (size_t i = 0; i < size; i++) @@ -261,27 +261,27 @@ template void NCurses::Menu::ResizeBuffer(size_t size) itsOptions[i] = new Option(); } -template void NCurses::Menu::AddOption(const T &item, bool is_bold, bool is_static) +template void NCurses::Menu::AddOption(const T &item, bool is_bold, bool is_static) { itsOptions.push_back(new Option(item, is_bold, is_static)); } -template void NCurses::Menu::AddSeparator() +template void NCurses::Menu::AddSeparator() { itsOptions.push_back(0); } -template void NCurses::Menu::InsertOption(size_t pos, const T &item, bool is_bold, bool is_static) +template void NCurses::Menu::InsertOption(size_t pos, const T &item, bool is_bold, bool is_static) { itsOptions.insert(itsOptions.begin()+pos, new Option(item, is_bold, is_static)); } -template void NCurses::Menu::InsertSeparator(size_t pos) +template void NCurses::Menu::InsertSeparator(size_t pos) { itsOptions.insert(itsOptions.begin()+pos, 0); } -template void NCurses::Menu::DeleteOption(size_t pos) +template void NCurses::Menu::DeleteOption(size_t pos) { if (itsOptions.empty()) return; @@ -304,26 +304,26 @@ template void NCurses::Menu::DeleteOption(size_t pos) Window::Clear(); } -template void NCurses::Menu::IntoSeparator(size_t pos) +template void NCurses::Menu::IntoSeparator(size_t pos) { delete itsOptions.at(pos); itsOptions[pos] = 0; } -template void NCurses::Menu::BoldOption(int index, bool bold) +template void NCurses::Menu::BoldOption(int index, bool bold) { if (!itsOptions.at(index)) return; itsOptions[index]->isBold = bold; } -template +template void NCurses::Menu::Swap(size_t one, size_t two) { std::swap(itsOptions.at(one), itsOptions.at(two)); } -template void NCurses::Menu::Refresh() +template void NCurses::Menu::Refresh() { if (itsOptionsPtr->empty()) { @@ -386,7 +386,7 @@ template void NCurses::Menu::Refresh() Window::Refresh(); } -template void NCurses::Menu::Scroll(Where where) +template void NCurses::Menu::Scroll(Where where) { if (itsOptionsPtr->empty()) return; @@ -492,13 +492,13 @@ template void NCurses::Menu::Scroll(Where where) } } -template void NCurses::Menu::Reset() +template void NCurses::Menu::Reset() { itsHighlight = 0; itsBeginning = 0; } -template void NCurses::Menu::ClearFiltered() +template void NCurses::Menu::ClearFiltered() { itsFilteredOptions.clear(); itsFilteredRealPositions.clear(); @@ -506,7 +506,7 @@ template void NCurses::Menu::ClearFiltered() itsOptionsPtr = &itsOptions; } -template void NCurses::Menu::Clear(bool clrscr) +template void NCurses::Menu::Clear(bool clrscr) { for (option_iterator it = itsOptions.begin(); it != itsOptions.end(); it++) delete *it; @@ -518,7 +518,7 @@ template void NCurses::Menu::Clear(bool clrscr) Window::Clear(); } -template bool NCurses::Menu::isBold(int id) +template bool NCurses::Menu::isBold(int id) { id = id == -1 ? itsHighlight : id; if (!itsOptionsPtr->at(id)) @@ -526,21 +526,21 @@ template bool NCurses::Menu::isBold(int id) return (*itsOptionsPtr)[id]->isBold; } -template void NCurses::Menu::Select(int id, bool value) +template void NCurses::Menu::Select(int id, bool value) { if (!itsOptionsPtr->at(id)) return; (*itsOptionsPtr)[id]->isSelected = value; } -template void NCurses::Menu::Static(int id, bool value) +template void NCurses::Menu::Static(int id, bool value) { if (!itsOptionsPtr->at(id)) return; (*itsOptionsPtr)[id]->isStatic = value; } -template bool NCurses::Menu::isSelected(int id) const +template bool NCurses::Menu::isSelected(int id) const { id = id == -1 ? itsHighlight : id; if (!itsOptionsPtr->at(id)) @@ -548,7 +548,7 @@ template bool NCurses::Menu::isSelected(int id) const return (*itsOptionsPtr)[id]->isSelected; } -template bool NCurses::Menu::isStatic(int id) const +template bool NCurses::Menu::isStatic(int id) const { id = id == -1 ? itsHighlight : id; if (!itsOptionsPtr->at(id)) @@ -556,7 +556,7 @@ template bool NCurses::Menu::isStatic(int id) const return (*itsOptionsPtr)[id]->isStatic; } -template bool NCurses::Menu::hasSelected() const +template bool NCurses::Menu::hasSelected() const { for (option_const_iterator it = itsOptionsPtr->begin(); it != itsOptionsPtr->end(); it++) if (*it && (*it)->isSelected) @@ -564,30 +564,30 @@ template bool NCurses::Menu::hasSelected() const return false; } -template void NCurses::Menu::GetSelected(std::vector &v) const +template void NCurses::Menu::GetSelected(std::vector &v) const { for (size_t i = 0; i < itsOptionsPtr->size(); i++) if ((*itsOptionsPtr)[i]->isSelected) v.push_back(i); } -template void NCurses::Menu::Highlight(size_t pos) +template void NCurses::Menu::Highlight(size_t pos) { itsHighlight = pos; itsBeginning = pos-itsHeight/2; } -template size_t NCurses::Menu::Size() const +template size_t NCurses::Menu::Size() const { return itsOptionsPtr->size(); } -template size_t NCurses::Menu::Choice() const +template size_t NCurses::Menu::Choice() const { return itsHighlight; } -template size_t NCurses::Menu::RealChoice() const +template size_t NCurses::Menu::RealChoice() const { size_t result = 0; for (option_const_iterator it = itsOptionsPtr->begin(); it != itsOptionsPtr->begin()+itsHighlight; it++) @@ -596,7 +596,7 @@ template size_t NCurses::Menu::RealChoice() const return result; } -template bool NCurses::Menu::Search(const std::string &constraint, size_t beginning, int flags) +template bool NCurses::Menu::Search(const std::string &constraint, size_t beginning, int flags) { itsFound.clear(); itsSearchConstraint.clear(); @@ -616,7 +616,7 @@ template bool NCurses::Menu::Search(const std::string &constraint, return !itsFound.empty(); } -template void NCurses::Menu::NextFound(bool wrap) +template void NCurses::Menu::NextFound(bool wrap) { if (itsFound.empty()) return; @@ -627,7 +627,7 @@ template void NCurses::Menu::NextFound(bool wrap) Highlight(*itsFound.begin()); } -template void NCurses::Menu::PrevFound(bool wrap) +template void NCurses::Menu::PrevFound(bool wrap) { if (itsFound.empty()) return; @@ -638,7 +638,7 @@ template void NCurses::Menu::PrevFound(bool wrap) Highlight(*itsFound.rbegin()); } -template void NCurses::Menu::ApplyFilter(const std::string &filter, size_t beginning, int flags) +template void NCurses::Menu::ApplyFilter(const std::string &filter, size_t beginning, int flags) { if (filter == itsFilter) return; @@ -670,12 +670,12 @@ template void NCurses::Menu::ApplyFilter(const std::string &filter, Window::Clear(); } -template const std::string &NCurses::Menu::GetFilter() +template const std::string &NCurses::Menu::GetFilter() { return itsFilter; } -template std::string NCurses::Menu::GetOption(size_t pos) +template std::string NCurses::Menu::GetOption(size_t pos) { if (itsOptionsPtr->at(pos) && itsGetStringFunction) return itsGetStringFunction((*itsOptionsPtr)[pos]->Item, itsGetStringFunctionUserData); @@ -683,63 +683,63 @@ template std::string NCurses::Menu::GetOption(size_t pos) return ""; } -template T &NCurses::Menu::Back() +template T &NCurses::Menu::Back() { if (!itsOptionsPtr->back()) throw InvalidItem(); return itsOptionsPtr->back()->Item; } -template const T &NCurses::Menu::Back() const +template const T &NCurses::Menu::Back() const { if (!itsOptionsPtr->back()) throw InvalidItem(); return itsOptionsPtr->back()->Item; } -template T &NCurses::Menu::Current() +template T &NCurses::Menu::Current() { if (!itsOptionsPtr->at(itsHighlight)) throw InvalidItem(); return (*itsOptionsPtr)[itsHighlight]->Item; } -template const T &NCurses::Menu::Current() const +template const T &NCurses::Menu::Current() const { if (!itsOptionsPtr->at(itsHighlight)) throw InvalidItem(); return (*itsOptionsPtr)[itsHighlight]->Item; } -template T &NCurses::Menu::at(size_t i) +template T &NCurses::Menu::at(size_t i) { if (!itsOptionsPtr->at(i)) throw InvalidItem(); return (*itsOptionsPtr)[i]->Item; } -template const T &NCurses::Menu::at(size_t i) const +template const T &NCurses::Menu::at(size_t i) const { if (!itsOptions->at(i)) throw InvalidItem(); return (*itsOptionsPtr)[i]->Item; } -template const T &NCurses::Menu::operator[](size_t i) const +template const T &NCurses::Menu::operator[](size_t i) const { if (!(*itsOptionsPtr)[i]) throw InvalidItem(); return (*itsOptionsPtr)[i]->Item; } -template T &NCurses::Menu::operator[](size_t i) +template T &NCurses::Menu::operator[](size_t i) { if (!(*itsOptionsPtr)[i]) throw InvalidItem(); return (*itsOptionsPtr)[i]->Item; } -template NCurses::Menu *NCurses::Menu::EmptyClone() const +template NCurses::Menu *NCurses::Menu::EmptyClone() const { return new NCurses::Menu(GetStartX(), GetStartY(), GetWidth(), GetHeight(), itsTitle, itsBaseColor, itsBorder); } diff --git a/src/screen.h b/src/screen.h index 1cdf3324..87050a44 100644 --- a/src/screen.h +++ b/src/screen.h @@ -63,7 +63,7 @@ class BasicScreen bool hasToBeResized; }; -template class Screen : public BasicScreen +template class Screen : public BasicScreen { public: Screen() : w(0) { } @@ -82,32 +82,32 @@ template class Screen : public BasicScreen WindowType *w; }; -template void *Screen::Cmp() +template void *Screen::Cmp() { return w; } -template WindowType *Screen::Main() +template WindowType *Screen::Main() { return w; } -template void Screen::Refresh() +template void Screen::Refresh() { w->Display(); } -template void Screen::RefreshWindow() +template void Screen::RefreshWindow() { w->Display(); } -template void Screen::ReadKey(int &input) +template void Screen::ReadKey(int &input) { w->ReadKey(input); } -template void Screen::Scroll(Where where, const int *key) +template void Screen::Scroll(Where where, const int *key) { if (!Config.fancy_scrolling && key) { diff --git a/src/scrollpad.h b/src/scrollpad.h index 6bde25ad..ab891376 100644 --- a/src/scrollpad.h +++ b/src/scrollpad.h @@ -43,7 +43,7 @@ namespace NCurses virtual void Resize(size_t, size_t); virtual void Clear(bool = 1); - template Scrollpad &operator<<(const T &t) + template Scrollpad &operator<<(const T &t) { itsBuffer << t; return *this; diff --git a/src/strbuffer.h b/src/strbuffer.h index b6eb0a52..54c45a85 100644 --- a/src/strbuffer.h +++ b/src/strbuffer.h @@ -28,7 +28,7 @@ namespace NCurses { - template class basic_buffer + template class basic_buffer { struct FormatPos { @@ -53,7 +53,7 @@ namespace NCurses void SetTemp(std::basic_string *); void Clear(); - template basic_buffer &operator<<(const T &t) + template basic_buffer &operator<<(const T &t) { itsString << t; return *this; @@ -71,12 +71,12 @@ namespace NCurses typedef basic_buffer WBuffer; } -template std::basic_string NCurses::basic_buffer::Str() const +template std::basic_string NCurses::basic_buffer::Str() const { return itsString.str(); } -template void NCurses::basic_buffer::SetFormatting(short vb, const std::basic_string &s, short ve, bool for_each) +template void NCurses::basic_buffer::SetFormatting(short vb, const std::basic_string &s, short ve, bool for_each) { std::basic_string base = itsString.str(); FormatPos fp; @@ -95,24 +95,24 @@ template void NCurses::basic_buffer::SetFormatting(short vb, const } } -template void NCurses::basic_buffer::SetTemp(std::basic_string *tmp) +template void NCurses::basic_buffer::SetTemp(std::basic_string *tmp) { itsTempString = tmp; } -template void NCurses::basic_buffer::Clear() +template void NCurses::basic_buffer::Clear() { itsString.str(std::basic_string()); itsFormat.clear(); } -template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(std::ostream &(*os)(std::ostream&)) +template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(std::ostream &(*os)(std::ostream&)) { itsString << os; return *this; } -template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(const Color &color) +template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(const Color &color) { FormatPos f; f.Position = itsString.str().length(); @@ -121,12 +121,12 @@ template NCurses::basic_buffer &NCurses::basic_buffer::operator< return *this; } -template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(const Format &f) +template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(const Format &f) { return operator<<(Color(f)); } -template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(const NCurses::basic_buffer &buf) +template NCurses::basic_buffer &NCurses::basic_buffer::operator<<(const NCurses::basic_buffer &buf) { size_t len = itsString.str().length(); itsString << buf.itsString.str(); @@ -138,7 +138,7 @@ template NCurses::basic_buffer &NCurses::basic_buffer::operator< return *this; } -template NCurses::Window &operator<<(NCurses::Window &w, const NCurses::basic_buffer &buf) +template NCurses::Window &operator<<(NCurses::Window &w, const NCurses::basic_buffer &buf) { const std::basic_string &s = buf.itsTempString ? *buf.itsTempString : buf.itsString.str(); if (buf.itsFormat.empty())