fileio-html.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30 */
31 
32 #ifndef RACK_FILE_IO_HTML
33 #define RACK_FILE_IO_HTML
34 
35 #include <string>
36 
37 #include <drain/RegExp.h>
38 
39 #include <drain/prog/CommandBank.h>
40 #include <drain/prog/CommandInstaller.h>
41 #include <drain/util/FileInfo.h>
42 #include <drain/util/TreeHTML.h>
43 
44 
45 #include "hi5/Hi5.h"
46 
47 #include "resources.h"
48 
49 namespace rack {
50 
51 
53 
54 public:
55 
56  void setBaseDir(const drain::FilePath::path_t & dir){
57  basedir = dir;
58  };
59 
61 
62  // Returns the root of the HTML document, that is the <HTML> element. Prepares style etc. if not set already
63  drain::TreeHTML & getHtml();
64 
65  int visitPrefix(const Hi5Tree & tree, const Hi5Tree::path_t & odimPath);
66 
67  inline
68  int visitPostfix(const Hi5Tree & tree, const Hi5Tree::path_t & odimPath){
69  return 0;
70  };
71 
72  static
73  drain::TreeHTML & addTogglerScript(drain::TreeHTML & head, const std::string key = "toggler-script");
74 
75  static
76  drain::TreeHTML & addTogglerStyle(drain::TreeHTML & head, const std::string key = "toggler-style");
77 
78 protected:
79 
80  drain::TreeHTML html;
81 
82 
83 };
84 
85 
86 } // rack::
87 
88 
89 #endif
90 
Definition: fileio-html.h:52
static drain::TreeHTML & addTogglerStyle(drain::TreeHTML &head, const std::string key="toggler-style")
Definition: fileio-html.cpp:73
static drain::TreeHTML & addTogglerScript(drain::TreeHTML &head, const std::string key="toggler-script")
Definition: fileio-html.cpp:49
NodeHTML::xml_tree_t TreeHTML
The HTML data structure.
Definition: TreeHTML.h:136
Definition: DataSelector.cpp:44