1 /* cclive 2 * Copyright (C) 2013 Toni Gundogdu <legatvs@gmail.com> 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #include <pcrecpp.h> 19 #include <sstream> 20 21 #include <ccquvi> 22 23 namespace quvi 24 { 25 26 // Version. 27 version()28std::string version() 29 { 30 return quvi_version(QUVI_VERSION); 31 } 32 33 typedef std::map<std::string,std::string>::const_iterator smci; 34 _domain_patt_to_s(smci i)35static const std::string _domain_patt_to_s(smci i) 36 { 37 std::string d = (*i).first; 38 #ifndef HAVE_LIBQUVI_0_9 /* Only libquvi 0.4 needs this. */ 39 pcrecpp::RE("%w\\+").GlobalReplace("com", &d); 40 pcrecpp::RE("%").GlobalReplace("", &d); 41 #endif 42 return d; 43 } 44 support_to_s(const std::map<std::string,std::string> & map)45std::string support_to_s(const std::map<std::string,std::string>& map) 46 { 47 std::stringstream b; 48 49 for (smci iter = map.begin(); iter != map.end(); ++iter) 50 b << _domain_patt_to_s(iter) << "\n"; 51 52 return b.str(); 53 } 54 55 } // namespace quvi 56 57 // vim: set ts=2 sw=2 tw=72 expandtab: 58