summaryrefslogtreecommitdiff
path: root/src/search_engine.h
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-10-05 20:50:14 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-10-05 20:58:07 +0200
commit044464962c9ccbf9ff017379e67724ce58553b60 (patch)
tree5c4ac5252f73bc32c3670170a99d2903d00121fb /src/search_engine.h
parente40edade0e005a28f7db0a7e6dc51a2acb734aae (diff)
initial restoration of support for encodings different than utf-8
Diffstat (limited to 'src/search_engine.h')
-rw-r--r--src/search_engine.h94
1 files changed, 47 insertions, 47 deletions
diff --git a/src/search_engine.h b/src/search_engine.h
index 8a5455a7..171307bf 100644
--- a/src/search_engine.h
+++ b/src/search_engine.h
@@ -27,53 +27,7 @@
#include "mpdpp.h"
#include "screen.h"
-struct SEItem
-{
- SEItem() : isThisSong(false), itsBuffer(0) { }
- SEItem(NC::Buffer *buf) : isThisSong(false), itsBuffer(buf) { }
- SEItem(const MPD::Song &s) : isThisSong(true), itsSong(s) { }
- SEItem(const SEItem &ei) { *this = ei; }
- ~SEItem() {
- if (!isThisSong)
- delete itsBuffer;
- }
-
- NC::Buffer &mkBuffer() {
- assert(!isThisSong);
- delete itsBuffer;
- itsBuffer = new NC::Buffer();
- return *itsBuffer;
- }
-
- bool isSong() const { return isThisSong; }
-
- NC::Buffer &buffer() { assert(!isThisSong && itsBuffer); return *itsBuffer; }
- MPD::Song &song() { assert(isThisSong); return itsSong; }
-
- const NC::Buffer &buffer() const { assert(!isThisSong && itsBuffer); return *itsBuffer; }
- const MPD::Song &song() const { assert(isThisSong); return itsSong; }
-
- SEItem &operator=(const SEItem &se) {
- if (this == &se)
- return *this;
- isThisSong = se.isThisSong;
- if (se.isThisSong)
- itsSong = se.itsSong;
- else if (se.itsBuffer)
- itsBuffer = new NC::Buffer(*se.itsBuffer);
- else
- itsBuffer = 0;
- return *this;
- }
-
- private:
- bool isThisSong;
-
- NC::Buffer *itsBuffer;
- MPD::Song itsSong;
-};
-
-struct SearchEngine: Screen<NC::Menu<SEItem>>, Filterable, HasSongs, Searchable, Tabbable
+struct SearchEngine: Screen<NC::Menu<struct SEItem>>, Filterable, HasSongs, Searchable, Tabbable
{
SearchEngine();
@@ -135,6 +89,52 @@ private:
static bool MatchToPattern;
};
+struct SEItem
+{
+ SEItem() : m_is_song(false), m_buffer(0) { }
+ SEItem(NC::Buffer *buf) : m_is_song(false), m_buffer(buf) { }
+ SEItem(const MPD::Song &s) : m_is_song(true), m_song(s) { }
+ SEItem(const SEItem &ei) { *this = ei; }
+ ~SEItem() {
+ if (!m_is_song)
+ delete m_buffer;
+ }
+
+ NC::Buffer &mkBuffer() {
+ assert(!m_is_song);
+ delete m_buffer;
+ m_buffer = new NC::Buffer();
+ return *m_buffer;
+ }
+
+ bool isSong() const { return m_is_song; }
+
+ NC::Buffer &buffer() { assert(!m_is_song && m_buffer); return *m_buffer; }
+ MPD::Song &song() { assert(m_is_song); return m_song; }
+
+ const NC::Buffer &buffer() const { assert(!m_is_song && m_buffer); return *m_buffer; }
+ const MPD::Song &song() const { assert(m_is_song); return m_song; }
+
+ SEItem &operator=(const SEItem &se) {
+ if (this == &se)
+ return *this;
+ m_is_song = se.m_is_song;
+ if (se.m_is_song)
+ m_song = se.m_song;
+ else if (se.m_buffer)
+ m_buffer = new NC::Buffer(*se.m_buffer);
+ else
+ m_buffer = 0;
+ return *this;
+ }
+
+private:
+ bool m_is_song;
+
+ NC::Buffer *m_buffer;
+ MPD::Song m_song;
+};
+
extern SearchEngine *mySearcher;
#endif // NCMPCPP_SEARCH_ENGINE_H