support of usage colors in sdcv output

This commit is contained in:
Evgeniy Dushistov
2013-07-07 14:43:53 +00:00
parent 7ddc3e2ea9
commit f5c62baeb9
3 changed files with 144 additions and 107 deletions

View File

@@ -7,17 +7,14 @@
#include "lib.hpp"
#include "readline.hpp"
using std::string;
using std::vector;
//this structure is wrapper and it need for unification
//results of search whith return Dicts class
struct TSearchResult {
string bookname;
string def;
string exp;
std::string bookname;
std::string def;
std::string exp;
TSearchResult(const string& bookname_, const string& def_, const string& exp_)
TSearchResult(const std::string& bookname_, const std::string& def_, const std::string& exp_)
: bookname(bookname_), def(def_), exp(exp_)
{
}
@@ -29,17 +26,19 @@ typedef std::vector<TSearchResult> TSearchResultList;
//of it
class Library : public Libs {
public:
Library(bool uinput, bool uoutput) :
utf8_input(uinput), utf8_output(uoutput) {}
Library(bool uinput, bool uoutput, bool colorize_output):
utf8_input_(uinput), utf8_output_(uoutput), colorize_output_(colorize_output) {}
bool process_phrase(const char *loc_str, IReadLine &io, bool force=false);
bool process_phrase(const char *loc_str, IReadLine &io, bool force = false);
private:
bool utf8_input, utf8_output;
bool utf8_input_;
bool utf8_output_;
bool colorize_output_;
void SimpleLookup(const string &str, TSearchResultList& res_list);
void LookupWithFuzzy(const string &str, TSearchResultList& res_list);
void LookupWithRule(const string &str, TSearchResultList& res_lsit);
void LookupData(const string &str, TSearchResultList& res_list);
void SimpleLookup(const std::string &str, TSearchResultList& res_list);
void LookupWithFuzzy(const std::string &str, TSearchResultList& res_list);
void LookupWithRule(const std::string &str, TSearchResultList& res_lsit);
void LookupData(const std::string &str, TSearchResultList& res_list);
void print_search_result(FILE *out, const TSearchResult & res);
};