diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2013-07-09 21:03:18 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2013-07-09 21:03:18 +0200 |
commit | 12c7dc2f5bd6d2b2bc9fabd17bf97b00e20fd431 (patch) | |
tree | 410f60a4335ea63a819e0e827b19398c2c4f317a | |
parent | 54d11a464c5aa99e2db22a428110297e16430ac7 (diff) |
scrollpad: pass boost::regex flags explicitly
-rw-r--r-- | src/lastfm_service.cpp | 4 | ||||
-rw-r--r-- | src/scrollpad.cpp | 12 | ||||
-rw-r--r-- | src/scrollpad.h | 5 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/lastfm_service.cpp b/src/lastfm_service.cpp index 8c3ac14f..d0b11f52 100644 --- a/src/lastfm_service.cpp +++ b/src/lastfm_service.cpp @@ -106,8 +106,8 @@ bool ArtistInfo::checkArgs(const Args &args) void ArtistInfo::colorizeOutput(NC::Scrollpad &w) { - w.setProperties(NC::Format::Bold, "\n\nSimilar artists:\n", NC::Format::NoBold, 0); - w.setProperties(Config.color2, "\n * ", NC::Color::End, 0); + w.setProperties(NC::Format::Bold, "\n\nSimilar artists:\n", NC::Format::NoBold, 0, boost::regex::literal); + w.setProperties(Config.color2, "\n * ", NC::Color::End, 0, boost::regex::literal); } bool ArtistInfo::parse(std::string &data) diff --git a/src/scrollpad.cpp b/src/scrollpad.cpp index 47fa0db2..6ca868e2 100644 --- a/src/scrollpad.cpp +++ b/src/scrollpad.cpp @@ -26,10 +26,10 @@ namespace {// template <typename PropT> -bool regexSearch(NC::Buffer &buf, PropT begin, const std::string &ws, PropT end, size_t id) +bool regexSearch(NC::Buffer &buf, PropT begin, const std::string &ws, PropT end, size_t id, boost::regex::flag_type flags) { try { - boost::regex rx(ws, boost::regex::icase); + boost::regex rx(ws, flags); auto first = boost::sregex_iterator(buf.str().begin(), buf.str().end(), rx); auto last = boost::sregex_iterator(); bool success = first != last; @@ -268,14 +268,14 @@ void Scrollpad::reset() m_beginning = 0; } -bool Scrollpad::setProperties(Color begin, const std::string &s, Color end, size_t id) +bool Scrollpad::setProperties(Color begin, const std::string &s, Color end, size_t id, boost::regex::flag_type flags) { - return regexSearch(m_buffer, begin, s, end, id); + return regexSearch(m_buffer, begin, s, end, id, flags); } -bool Scrollpad::setProperties(Format begin, const std::string &s, Format end, size_t id) +bool Scrollpad::setProperties(Format begin, const std::string &s, Format end, size_t id, boost::regex::flag_type flags) { - return regexSearch(m_buffer, begin, s, end, id); + return regexSearch(m_buffer, begin, s, end, id, flags); } void Scrollpad::removeProperties(size_t id) diff --git a/src/scrollpad.h b/src/scrollpad.h index 188ce9a9..1f47d3b9 100644 --- a/src/scrollpad.h +++ b/src/scrollpad.h @@ -21,6 +21,7 @@ #ifndef NCMPCPP_SCROLLPAD_H #define NCMPCPP_SCROLLPAD_H +#include <boost/regex.hpp> #include "window.h" #include "strbuffer.h" @@ -46,8 +47,8 @@ struct Scrollpad: public Window void flush(); void reset(); - bool setProperties(Color begin, const std::string &s, Color end, size_t id = -2); - bool setProperties(Format begin, const std::string &s, Format end, size_t id = -2); + bool setProperties(Color begin, const std::string &s, Color end, size_t id = -2, boost::regex::flag_type flags = boost::regex::icase); + bool setProperties(Format begin, const std::string &s, Format end, size_t id = -2, boost::regex::flag_type flags = boost::regex::icase); void removeProperties(size_t id = -2); template <typename ItemT> |