22 #ifndef LYRICSERVER_H_ 23 #define LYRICSERVER_H_ 27 #include "Helper/Logger/Logger.h" 36 QString server_address;
40 bool include_start_tag;
46 void addReplacement(QString rep, QString rep_with){
47 replacements[rep] = rep_with;
50 #define STR_TRUE QString("true") 51 #define STR_FALSE QString("false") 53 void print_xml()
const 56 sp_log(Log::Info) <<
"<ServerTemplate>";
57 sp_log(Log::Info) <<
" <name>\"" << display_str <<
"\"</name>";
58 sp_log(Log::Info) <<
" <server_address>\"" << server_address <<
"\"</server_address>";
59 sp_log(Log::Info) <<
" <call_policy>\"" << call_policy <<
"\"</call_policy>";
62 sp_log(Log::Info) <<
" <include_start_tag>" << (include_start_tag ? STR_TRUE : STR_FALSE) <<
"</include_start_tag>";
63 sp_log(Log::Info) <<
" <include_end_tag>" << (include_end_tag ? STR_TRUE : STR_FALSE) <<
"</include_end_tag>";
64 sp_log(Log::Info) <<
" <is_numeric>" << (is_numeric ? STR_TRUE : STR_FALSE) <<
"</is_numeric>";
65 sp_log(Log::Info) <<
" <to_lower>" << (to_lower ? STR_TRUE : STR_FALSE) <<
"</to_lower>";
66 sp_log(Log::Info) <<
" <error>\"" << error <<
"\"</error>";
68 for(QString key : replacements.keys()){
69 sp_log(Log::Info) <<
" <replacement>";
70 sp_log(Log::Info) <<
" <from>\"" << key <<
"\"</from>";
71 sp_log(Log::Info) <<
" <to>\"" << replacements[key] <<
"\"</to>";
72 sp_log(Log::Info) <<
" </replacement>";
75 sp_log(Log::Info) <<
"</ServerTemplate>";
78 void print_json()
const 80 sp_log(Log::Info) <<
" {";
81 sp_log(Log::Info) <<
" \"ServerName\": \"" + display_str +
"\",";
82 sp_log(Log::Info) <<
" \"ServerAddress\": \"" + server_address +
"\",";
83 sp_log(Log::Info) <<
" \"CallPolicy\": \"" + call_policy +
"\",";
84 sp_log(Log::Info) <<
" \"IncludeStartTag\": " + QString::number(include_start_tag) +
",";
85 sp_log(Log::Info) <<
" \"IncludeEndTag\": " + QString::number(include_end_tag) +
",";
86 sp_log(Log::Info) <<
" \"IsNumeric\": " + QString::number(is_numeric) +
",";
87 sp_log(Log::Info) <<
" \"ToLower\": " + QString::number(to_lower) +
",";
88 sp_log(Log::Info) <<
" \"Error\": \"" + error +
"\",";
90 sp_log(Log::Info) <<
" \"Replacements\": [";
92 for(
const QString& str : replacements.keys()){
93 sp_log(Log::Info) <<
" {";
94 sp_log(Log::Info) <<
" \"OrgString\": \"" + str +
"\",";
95 sp_log(Log::Info) <<
" \"RepString\": \"" + replacements[str] +
"\"";
96 sp_log(Log::Info) <<
" },";
99 sp_log(Log::Info) <<
" ]";
101 sp_log(Log::Info) <<
" \"BorderTags\": [";
102 for(
const QString& str : start_end_tag.keys()){
104 key.replace(
"\"",
"\\\"");
105 QString value = start_end_tag[str];
106 value.replace(
"\"",
"\\\"");
108 sp_log(Log::Info) <<
" {";
109 sp_log(Log::Info) <<
" \"StartTag\": \"" + key +
"\",";
110 sp_log(Log::Info) <<
" \"EndTag\": \"" + value +
"\"";
111 sp_log(Log::Info) <<
" },";
114 sp_log(Log::Info) <<
" ]";
115 sp_log(Log::Info) <<
" }";
The ServerTemplate struct.
Definition: LyricServer.h:33