souffle  2.0.2-371-g6315b36
HtmlGenerator.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2016, The Souffle Developers. All rights reserved
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 #pragma once
10 
19 #include <sstream>
20 #include <string>
21 
22 namespace souffle {
23 namespace profile {
24 
25 /*
26  * Class linking the html, css, and js into one html file
27  * so that a data variable can be inserted in the middle of the two strings and written to a file.
28  *
29  */
31 public:
32  static std::string getHtml(std::string json) {
33  return getFirstHalf() + json + getSecondHalf();
34  }
35 
36 protected:
37  static std::string getFirstHalf() {
38  std::stringstream ss;
40  << html::htmlHeadBottom << html::htmlBodyTop << "<script>data=";
41  return ss.str();
42  }
43  static std::string getSecondHalf() {
44  std::stringstream ss;
45  ss << "</script>" << wrapJs(html::jsTableSort) << wrapJs(html::jsChartistMin)
48  return ss.str();
49  }
50  static std::string wrapCss(const std::string& css) {
51  return "<style>" + css + "</style>";
52  }
53  static std::string wrapJs(const std::string& js) {
54  return "<script>" + js + "</script>";
55  }
56 };
57 
58 } // namespace profile
59 } // namespace souffle
souffle::profile::html::jsChartistPlugin
std::string jsChartistPlugin
Definition: htmlJsChartistPlugin.h:6
htmlJsChartistPlugin.h
souffle::profile::HtmlGenerator::getHtml
static std::string getHtml(std::string json)
Definition: HtmlGenerator.h:32
souffle::profile::html::htmlHeadBottom
std::string htmlHeadBottom
Definition: htmlMain.h:20
souffle::profile::HtmlGenerator::getSecondHalf
static std::string getSecondHalf()
Definition: HtmlGenerator.h:43
souffle::profile::HtmlGenerator::getFirstHalf
static std::string getFirstHalf()
Definition: HtmlGenerator.h:37
souffle::profile::html::cssChartist
std::string cssChartist
Definition: htmlCssChartist.h:6
htmlJsTableSort.h
souffle::profile::HtmlGenerator::wrapJs
static std::string wrapJs(const std::string &js)
Definition: HtmlGenerator.h:53
souffle::profile::html::cssStyle
std::string cssStyle
Definition: htmlCssStyle.h:8
souffle::profile::html::htmlBodyTop
std::string htmlBodyTop
Definition: htmlMain.h:24
souffle::profile::html::jsMain
std::string jsMain
Definition: htmlJsMain.h:14
htmlJsChartistMin.h
souffle::profile::HtmlGenerator
Definition: HtmlGenerator.h:30
souffle::profile::html::jsUtil
std::string jsUtil
Definition: htmlJsUtil.h:6
htmlMain.h
souffle::profile::html::jsTableSort
std::string jsTableSort
Definition: htmlJsTableSort.h:6
souffle::profile::html::htmlHeadTop
std::string htmlHeadTop
Definition: htmlMain.h:6
souffle::profile::HtmlGenerator::wrapCss
static std::string wrapCss(const std::string &css)
Definition: HtmlGenerator.h:50
htmlCssStyle.h
htmlJsMain.h
htmlCssChartist.h
htmlJsUtil.h
souffle
Definition: AggregateOp.h:25
souffle::profile::html::htmlBodyBottom
std::string htmlBodyBottom
Definition: htmlMain.h:242
souffle::profile::ss
class souffle::profile::Tui ss
Definition: Tui.h:336