kopia lustrzana https://gitlab.com/tomaszg/geostat
Move code for printing out header html to common.h
rodzic
ea4be4b4fe
commit
1cb10f3ce2
11
common.cpp
11
common.cpp
|
@ -283,6 +283,17 @@ int sum(const Caches& cc, int Cache::*ptr) {
|
|||
return std::accumulate(cc.begin(), cc.end(), 0, [&](const int& a, const Cache& b) { return std::move(a) + b.*ptr; });
|
||||
}
|
||||
|
||||
void header_html() {
|
||||
std::cout << "<!DOCTYPE html>\n";
|
||||
std::cout << "<html lang=\"en\">\n";
|
||||
std::cout << " <head>\n";
|
||||
std::cout << " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
|
||||
std::cout << " <link rel=\"stylesheet\" type=\"text/css\" href=\"geo.css?ver=12\">\n";
|
||||
std::cout << " <title>Geocaching stats</title>\n";
|
||||
std::cout << "</head>\n";
|
||||
std::cout << "<body>\n";
|
||||
}
|
||||
|
||||
void footer_html() {
|
||||
std::cout << "<footer>\n";
|
||||
std::cout << "Stats generated by <a href=\"https://gitlab.com/tomaszg/geostat\">GeoStat</a>.<br>\n";
|
||||
|
|
1
common.h
1
common.h
|
@ -23,4 +23,5 @@ void sum_html(const Caches& cc, int Cache::*ptr, const std::string& caption);
|
|||
float sum(const Caches& cc, float Cache::*ptr);
|
||||
int sum(const Caches& cc, int Cache::*ptr);
|
||||
|
||||
void header_html();
|
||||
void footer_html();
|
||||
|
|
|
@ -46,14 +46,8 @@ int main(int argc, char** argv) {
|
|||
caches_by_user2.push_back(&i);
|
||||
}
|
||||
|
||||
std::cout << "<!DOCTYPE html>\n";
|
||||
std::cout << "<html lang=\"en\">\n";
|
||||
std::cout << " <head>\n";
|
||||
std::cout << " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
|
||||
std::cout << " <link rel=\"stylesheet\" type=\"text/css\" href=\"geo.css?ver=12\">\n";
|
||||
std::cout << " <title>Geocaching stats</title>\n";
|
||||
std::cout << "</head>\n";
|
||||
std::cout << "<body>\n";
|
||||
header_html();
|
||||
|
||||
std::cout << "<header>\n";
|
||||
std::cout << "<h1><a href=\"/geo\">Geocaching stats</a> for user profiles:</h1>\n";
|
||||
std::cout << "<img alt=\"OCpl\" src=\"https://wiki.opencaching.eu/images/b/b7/Oc-pl.png\"> <a href=\"" << ocpl_user_profile1 << "\">" << ocpl_user1 << "</a><br>\n";
|
||||
|
|
10
geostat.cpp
10
geostat.cpp
|
@ -322,14 +322,8 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
std::cout << "<!DOCTYPE html>\n";
|
||||
std::cout << "<html lang=\"en\">\n";
|
||||
std::cout << " <head>\n";
|
||||
std::cout << " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
|
||||
std::cout << " <link rel=\"stylesheet\" type=\"text/css\" href=\"geo.css?ver=12\">\n";
|
||||
std::cout << " <title>Geocaching stats</title>\n";
|
||||
std::cout << "</head>\n";
|
||||
std::cout << "<body>\n";
|
||||
header_html();
|
||||
|
||||
std::cout << "<header>\n";
|
||||
std::cout << "<h1><a href=\"/geo\">Geocaching stats</a> for user profiles:</h1>\n";
|
||||
if (!ocpl_user.empty())
|
||||
|
|
Ładowanie…
Reference in New Issue