-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfilesystem__handler_8h_source.html
309 lines (307 loc) · 44.1 KB
/
filesystem__handler_8h_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!-- HTML header for doxygen 1.8.16-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jinja2C++ reference: D:/projects/work/Personal/Jinja2Cpp/Jinja2Cpp/include/jinja2cpp/filesystem_handler.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="dxg_stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/javascript">
(function(a,e,f,g,b,c,d){a[b]||(a.FintezaCoreObject=b,a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)},a[b].l=1*new Date,c=e.createElement(f),d=e.getElementsByTagName(f)[0],c.async=!0,c.defer=!0,c.src=g,d&&d.parentNode&&d.parentNode.insertBefore(c,d))})
(window,document,"script","https://content.mql5.com/core.js","fz");
fz("register","website",{id:"figfqiucisqvbkzruorbjefvctzljtvfeo",trackLinks:true,timeOnPage:true});
</script>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><a href="https://jinja2cpp.dev/"><img alt="Logo" src="Jinja2Cpp_logo1.jpg" width="100" height="100"/></a></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Jinja2C++
 <span id="projectnumber">1.0 reference</span>
</div>
<div id="projectbrief">Jinja2 C++ (and for C++) almost full-conformance template engine implementation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('filesystem__handler_8h_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">filesystem_handler.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="filesystem__handler_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#</span><span class="preprocessor">ifndef</span> <span class="preprocessor">JINJA2CPP_FILESYSTEM_HANDLER_H</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#</span><span class="preprocessor">define</span> <span class="preprocessor">JINJA2CPP_FILESYSTEM_HANDLER_H</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">nonstd</span><span class="preprocessor">/</span><span class="preprocessor">variant</span><span class="preprocessor">.</span><span class="preprocessor">hpp</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">nonstd</span><span class="preprocessor">/</span><span class="preprocessor">optional</span><span class="preprocessor">.</span><span class="preprocessor">hpp</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">iostream</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">memory</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">string</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">unordered_map</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor"><</span><span class="preprocessor">chrono</span><span class="preprocessor">></span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="keyword">namespace</span> <a class="code" href="namespacejinja2.html">jinja2</a></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> {</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="keyword">template</span><<span class="keyword">typename</span> CharT></div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="namespacejinja2.html#a85d70f287601a33897f58a50e964dd3d"> 17</a></span> <span class="keyword">using</span> FileStreamPtr = std::unique_ptr<std::basic_istream<CharT>, <span class="keywordtype">void</span> (*)(std::basic_istream<CharT>*)>;</div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="namespacejinja2.html#ab5d363d70df829219a7b5652328977c6"> 18</a></span> <span class="keyword">using</span> CharFileStreamPtr = FileStreamPtr<<span class="keywordtype">char</span>>;</div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="namespacejinja2.html#ad07d25b586e095c48d73b504a49d4697"> 19</a></span> <span class="keyword">using</span> WCharFileStreamPtr = FileStreamPtr<<span class="keywordtype">wchar_t</span>>;</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment">/*!</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * \brief Generic interface to filesystem handlers (loaders)</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> * This interface should be implemented in order to provide custom file system handler. Interface provides most-common methods which are called by</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment"> * the template environment to load the particular template. `OpenStream` methods return the unique pointer to the generic `istream` object implementation.</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"> * So, the exact type (ex. `ifstream`, `istringstream` etc.) of input stream is unspecified. In order to delete stream object correctly returned pointer</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> * provide the custom deleter which should properly delete the stream object.</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="classjinja2_1_1_i_filesystem_handler.html"> 29</a></span> <span class="keyword">class</span> <a class="code" href="classjinja2_1_1_i_filesystem_handler.html">IFilesystemHandler</a></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> {</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">public</span>:</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="comment">//! Destructor</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keyword">virtual</span> ~<a class="code" href="classjinja2_1_1_i_filesystem_handler.html#af1e98b85bed16d51148d42d64fb07e40">IFilesystemHandler</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="comment"> * \brief Method is called to open the file with the specified name in 'narrow-char' mode.</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="comment"> * Method should return unique pointer to the std::istream object with custom deleter (\ref CharFileStreamPtr) . Deleter should properly delete pointee</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="comment"> * stream object.</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="comment"> * @param name Name of the file to open</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="comment"> * @return Opened stream object or empty pointer in case of any error</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keyword">virtual</span> CharFileStreamPtr <a class="code" href="classjinja2_1_1_i_filesystem_handler.html#ab20beae340570f352193bd12819d8efd">OpenStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="comment"> * \brief Method is called to open the file with the specified name in 'wide-char' mode.</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment"> * Method should return unique pointer to the std::wistream object with custom deleter (\ref WCharFileStreamPtr) . Deleter should properly delete pointee</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <span class="comment"> * stream object.</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="comment"> * @param name Name of the file to open</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="comment"> * @return Opened stream object or empty pointer in case of any error</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keyword">virtual</span> WCharFileStreamPtr <a class="code" href="classjinja2_1_1_i_filesystem_handler.html#a76b088ac5bcff7ecd673b45ef59906cb">OpenWStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span> <span class="comment"> * \brief Method is called to obtain the modification date of the specified file (if applicable)</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="comment"> * If the underlaying filesystem supports retrival of the last modification date of the file this method should return this date when called. In other</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="comment"> * case it should return the empty optional object. Main purpose of this method is to help templates loader to determine the necessity of cached template</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="comment"> * reload</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span> <span class="comment"> * @param name Name of the file to get the last modification date</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> <span class="comment"> * @return Last modification date (if applicable) or empty optional object otherwise</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keyword">virtual</span> nonstd::optional<std::chrono::system_clock::time_point> <a class="code" href="classjinja2_1_1_i_filesystem_handler.html#a9bceaeb724626d1f9055e5be8ee5cc9f">GetLastModificationDate</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> };</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="namespacejinja2.html#a32bf43791bb27a1280da8fdf13cbfdde"> 68</a></span> <span class="keyword">using</span> FilesystemHandlerPtr = std::shared_ptr<<a class="code" href="classjinja2_1_1_i_filesystem_handler.html">IFilesystemHandler</a>>;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="comment">/*!</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> <span class="comment"> * \brief Filesystem handler for files stored in memory</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="comment"> * This filesystem handler implements the simple dictionary object which maps name of the file to it's content. New files can be added by \ref AddFile</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="comment"> * methods. Content of the files automatically converted to narrow/wide strings representation if necessary.</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classjinja2_1_1_memory_file_system.html"> 76</a></span> <span class="keyword">class</span> <a class="code" href="classjinja2_1_1_memory_file_system.html">MemoryFileSystem</a> : <span class="keyword">public</span> <a class="code" href="classjinja2_1_1_i_filesystem_handler.html">IFilesystemHandler</a></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> {</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">public</span>:</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment"> * \brief Add new narrow-char "file" to the filesystem handler</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="comment"> * Adds new file entry to the internal dictionary object or overwrite the existing one. New entry contains the specified content of the file</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment"> * @param fileName Name of the file to add</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment"> * @param fileContent Content of the file to add</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordtype">void</span> <a class="code" href="classjinja2_1_1_memory_file_system.html#a865ec7b8bd9a0813a39bb6652679bb42">AddFile</a>(std::string fileName, std::string fileContent);</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment"> * \brief Add new wide-char "file" to the filesystem handler</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment"> * Adds new file entry to the internal dictionary object or overwrite the existing one. New entry contains the specified content of the file</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="comment"> * @param fileName Name of the file to add</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="comment"> * @param fileContent Content of the file to add</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordtype">void</span> <a class="code" href="classjinja2_1_1_memory_file_system.html#a044dad0aca740f2fd4085b1216f7a77c">AddFile</a>(std::string fileName, std::wstring fileContent);</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  CharFileStreamPtr <a class="code" href="classjinja2_1_1_memory_file_system.html#aef0bb8aecde68e0aeff2e530461d39b8">OpenStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> <span class="keyword">override</span>;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  WCharFileStreamPtr <a class="code" href="classjinja2_1_1_memory_file_system.html#a008a9a04f0961215e0cbc5d739d2df7f">OpenWStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> <span class="keyword">override</span>;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  nonstd::optional<std::chrono::system_clock::time_point> <a class="code" href="classjinja2_1_1_memory_file_system.html#aa2552ba005db25f41d4c7b3d589d3092">GetLastModificationDate</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> <span class="keyword">override</span>;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="keyword">private</span>:</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keyword">struct</span> FileContent</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  {</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  nonstd::optional<std::string> narrowContent;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  nonstd::optional<std::wstring> wideContent;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  };</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keyword">mutable</span> std::unordered_map<std::string, FileContent> m_filesMap;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> };</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> <span class="comment">/*!</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="comment"> * \brief Filesystem handler for files stored on the filesystem</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="comment"> * This filesystem handler is an interface to the real file system. Root directory for file name mapping provided as a constructor argument. Each name (path) of</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="comment"> * the file to open is appended to the root directory path and then passed to the stream open methods.</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="classjinja2_1_1_real_file_system.html"> 117</a></span> <span class="keyword">class</span> <a class="code" href="classjinja2_1_1_real_file_system.html">RealFileSystem</a> : <span class="keyword">public</span> <a class="code" href="classjinja2_1_1_i_filesystem_handler.html">IFilesystemHandler</a></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> {</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="keyword">public</span>:</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="comment"> * \brief Initializing/default constructor</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="comment"> * @param rootFolder Path to the root folder. This path is used as a root for every opened file</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keyword">explicit</span> <a class="code" href="classjinja2_1_1_real_file_system.html#ab899b30e63953fe4986ea6eed4a9154f">RealFileSystem</a>(std::string rootFolder = <span class="stringliteral">"."</span>);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> </div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> <span class="comment"> * \brief Reset path to the root folder to the new value</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="comment"> * @param newRoot New path to the root folder</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="classjinja2_1_1_real_file_system.html#a9f0cc85c4b789461985384d11459e651"> 132</a></span>  <span class="keywordtype">void</span> <a class="code" href="classjinja2_1_1_real_file_system.html#a9f0cc85c4b789461985384d11459e651">SetRootFolder</a>(std::string newRoot)</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  {</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  m_rootFolder = std::move(newRoot);</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  }</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span> </div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="comment"> * \brief Get path to the current root folder</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span> <span class="comment"> * @return</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="classjinja2_1_1_real_file_system.html#ad288eb3c219e1eb87b2739226b234247"> 142</a></span>  <span class="keyword">const</span> std::string& <a class="code" href="classjinja2_1_1_real_file_system.html#ad288eb3c219e1eb87b2739226b234247">GetRootFolder</a>() <span class="keyword">const</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  {</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keywordflow">return</span> m_rootFolder;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  }</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="comment"> * \brief Get full path to the specified file.</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span> <span class="comment"> * Appends specified name of the file to the current root folder and returns it</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span> <span class="comment"> * @param name Name of the file to get path to</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span> <span class="comment"> * @return Full path to the file</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  std::string <a class="code" href="classjinja2_1_1_real_file_system.html#a751cc72eebbcdb274a18ff268b2c69cf">GetFullFilePath</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span> </div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  CharFileStreamPtr <a class="code" href="classjinja2_1_1_real_file_system.html#aa92284a328d2adfa13ef05049862b284">OpenStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> <span class="keyword">override</span>;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  WCharFileStreamPtr <a class="code" href="classjinja2_1_1_real_file_system.html#ae463b6ab90e75c2bd5f540347ff91f9f">OpenWStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> <span class="keyword">override</span>;</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="comment">/*!</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="comment"> * \brief Open the specified file as a binary stream</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span> <span class="comment"> * Opens the specified file in the binary mode (instead of text).</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="comment"> * @param name Name of the file to get the last modification date</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment"> * @return Last modification date (if applicable) or empty optional object otherwise</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  CharFileStreamPtr <a class="code" href="classjinja2_1_1_real_file_system.html#a238060f1c2188986766f08f470ef55a3">OpenByteStream</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  nonstd::optional<std::chrono::system_clock::time_point> <a class="code" href="classjinja2_1_1_real_file_system.html#a5c0ceaf6dbc6dd19875107431f77e528">GetLastModificationDate</a>(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span> <span class="keyword">override</span>;</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span> </div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span> <span class="keyword">private</span>:</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  std::string m_rootFolder;</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span> };</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span> } <span class="comment">// jinja2</span></div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span> </div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span> <span class="preprocessor">#</span><span class="preprocessor">endif</span> <span class="comment">// FILESYSTEM_HANDLER_H</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aclassjinja2_1_1_i_filesystem_handler_html_a9bceaeb724626d1f9055e5be8ee5cc9f"><div class="ttname"><a href="classjinja2_1_1_i_filesystem_handler.html#a9bceaeb724626d1f9055e5be8ee5cc9f">jinja2::IFilesystemHandler::GetLastModificationDate</a></div><div class="ttdeci">virtual nonstd::optional< std::chrono::system_clock::time_point > GetLastModificationDate(const std::string &name) const =0</div><div class="ttdoc">Method is called to obtain the modification date of the specified file (if applicable)</div></div>
<div class="ttc" id="aclassjinja2_1_1_memory_file_system_html_a008a9a04f0961215e0cbc5d739d2df7f"><div class="ttname"><a href="classjinja2_1_1_memory_file_system.html#a008a9a04f0961215e0cbc5d739d2df7f">jinja2::MemoryFileSystem::OpenWStream</a></div><div class="ttdeci">WCharFileStreamPtr OpenWStream(const std::string &name) const override</div><div class="ttdoc">Method is called to open the file with the specified name in 'wide-char' mode.</div></div>
<div class="ttc" id="aclassjinja2_1_1_i_filesystem_handler_html"><div class="ttname"><a href="classjinja2_1_1_i_filesystem_handler.html">jinja2::IFilesystemHandler</a></div><div class="ttdoc">Generic interface to filesystem handlers (loaders)</div><div class="ttdef"><b>Definition:</b> filesystem_handler.h:29</div></div>
<div class="ttc" id="aclassjinja2_1_1_i_filesystem_handler_html_af1e98b85bed16d51148d42d64fb07e40"><div class="ttname"><a href="classjinja2_1_1_i_filesystem_handler.html#af1e98b85bed16d51148d42d64fb07e40">jinja2::IFilesystemHandler::~IFilesystemHandler</a></div><div class="ttdeci">virtual ~IFilesystemHandler()=default</div><div class="ttdoc">Destructor.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_ad288eb3c219e1eb87b2739226b234247"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#ad288eb3c219e1eb87b2739226b234247">jinja2::RealFileSystem::GetRootFolder</a></div><div class="ttdeci">const std::string & GetRootFolder() const</div><div class="ttdoc">Get path to the current root folder.</div><div class="ttdef"><b>Definition:</b> filesystem_handler.h:142</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_a5c0ceaf6dbc6dd19875107431f77e528"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#a5c0ceaf6dbc6dd19875107431f77e528">jinja2::RealFileSystem::GetLastModificationDate</a></div><div class="ttdeci">nonstd::optional< std::chrono::system_clock::time_point > GetLastModificationDate(const std::string &name) const override</div><div class="ttdoc">Method is called to obtain the modification date of the specified file (if applicable)</div></div>
<div class="ttc" id="aclassjinja2_1_1_memory_file_system_html_a044dad0aca740f2fd4085b1216f7a77c"><div class="ttname"><a href="classjinja2_1_1_memory_file_system.html#a044dad0aca740f2fd4085b1216f7a77c">jinja2::MemoryFileSystem::AddFile</a></div><div class="ttdeci">void AddFile(std::string fileName, std::wstring fileContent)</div><div class="ttdoc">Add new wide-char "file" to the filesystem handler.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_ae463b6ab90e75c2bd5f540347ff91f9f"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#ae463b6ab90e75c2bd5f540347ff91f9f">jinja2::RealFileSystem::OpenWStream</a></div><div class="ttdeci">WCharFileStreamPtr OpenWStream(const std::string &name) const override</div><div class="ttdoc">Method is called to open the file with the specified name in 'wide-char' mode.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_aa92284a328d2adfa13ef05049862b284"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#aa92284a328d2adfa13ef05049862b284">jinja2::RealFileSystem::OpenStream</a></div><div class="ttdeci">CharFileStreamPtr OpenStream(const std::string &name) const override</div><div class="ttdoc">Method is called to open the file with the specified name in 'narrow-char' mode.</div></div>
<div class="ttc" id="aclassjinja2_1_1_memory_file_system_html_aa2552ba005db25f41d4c7b3d589d3092"><div class="ttname"><a href="classjinja2_1_1_memory_file_system.html#aa2552ba005db25f41d4c7b3d589d3092">jinja2::MemoryFileSystem::GetLastModificationDate</a></div><div class="ttdeci">nonstd::optional< std::chrono::system_clock::time_point > GetLastModificationDate(const std::string &name) const override</div><div class="ttdoc">Method is called to obtain the modification date of the specified file (if applicable)</div></div>
<div class="ttc" id="aclassjinja2_1_1_memory_file_system_html"><div class="ttname"><a href="classjinja2_1_1_memory_file_system.html">jinja2::MemoryFileSystem</a></div><div class="ttdoc">Filesystem handler for files stored in memory.</div><div class="ttdef"><b>Definition:</b> filesystem_handler.h:76</div></div>
<div class="ttc" id="aclassjinja2_1_1_i_filesystem_handler_html_a76b088ac5bcff7ecd673b45ef59906cb"><div class="ttname"><a href="classjinja2_1_1_i_filesystem_handler.html#a76b088ac5bcff7ecd673b45ef59906cb">jinja2::IFilesystemHandler::OpenWStream</a></div><div class="ttdeci">virtual WCharFileStreamPtr OpenWStream(const std::string &name) const =0</div><div class="ttdoc">Method is called to open the file with the specified name in 'wide-char' mode.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_a238060f1c2188986766f08f470ef55a3"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#a238060f1c2188986766f08f470ef55a3">jinja2::RealFileSystem::OpenByteStream</a></div><div class="ttdeci">CharFileStreamPtr OpenByteStream(const std::string &name) const</div><div class="ttdoc">Open the specified file as a binary stream.</div></div>
<div class="ttc" id="aclassjinja2_1_1_i_filesystem_handler_html_ab20beae340570f352193bd12819d8efd"><div class="ttname"><a href="classjinja2_1_1_i_filesystem_handler.html#ab20beae340570f352193bd12819d8efd">jinja2::IFilesystemHandler::OpenStream</a></div><div class="ttdeci">virtual CharFileStreamPtr OpenStream(const std::string &name) const =0</div><div class="ttdoc">Method is called to open the file with the specified name in 'narrow-char' mode.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_a9f0cc85c4b789461985384d11459e651"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#a9f0cc85c4b789461985384d11459e651">jinja2::RealFileSystem::SetRootFolder</a></div><div class="ttdeci">void SetRootFolder(std::string newRoot)</div><div class="ttdoc">Reset path to the root folder to the new value.</div><div class="ttdef"><b>Definition:</b> filesystem_handler.h:132</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_ab899b30e63953fe4986ea6eed4a9154f"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#ab899b30e63953fe4986ea6eed4a9154f">jinja2::RealFileSystem::RealFileSystem</a></div><div class="ttdeci">RealFileSystem(std::string rootFolder=".")</div><div class="ttdoc">Initializing/default constructor.</div></div>
<div class="ttc" id="aclassjinja2_1_1_memory_file_system_html_aef0bb8aecde68e0aeff2e530461d39b8"><div class="ttname"><a href="classjinja2_1_1_memory_file_system.html#aef0bb8aecde68e0aeff2e530461d39b8">jinja2::MemoryFileSystem::OpenStream</a></div><div class="ttdeci">CharFileStreamPtr OpenStream(const std::string &name) const override</div><div class="ttdoc">Method is called to open the file with the specified name in 'narrow-char' mode.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html">jinja2::RealFileSystem</a></div><div class="ttdoc">Filesystem handler for files stored on the filesystem.</div><div class="ttdef"><b>Definition:</b> filesystem_handler.h:117</div></div>
<div class="ttc" id="aclassjinja2_1_1_memory_file_system_html_a865ec7b8bd9a0813a39bb6652679bb42"><div class="ttname"><a href="classjinja2_1_1_memory_file_system.html#a865ec7b8bd9a0813a39bb6652679bb42">jinja2::MemoryFileSystem::AddFile</a></div><div class="ttdeci">void AddFile(std::string fileName, std::string fileContent)</div><div class="ttdoc">Add new narrow-char "file" to the filesystem handler.</div></div>
<div class="ttc" id="aclassjinja2_1_1_real_file_system_html_a751cc72eebbcdb274a18ff268b2c69cf"><div class="ttname"><a href="classjinja2_1_1_real_file_system.html#a751cc72eebbcdb274a18ff268b2c69cf">jinja2::RealFileSystem::GetFullFilePath</a></div><div class="ttdeci">std::string GetFullFilePath(const std::string &name) const</div><div class="ttdoc">Get full path to the specified file.</div></div>
<div class="ttc" id="anamespacejinja2_html"><div class="ttname"><a href="namespacejinja2.html">jinja2</a></div><div class="ttdef"><b>Definition:</b> nlohmann_json.h:8</div></div>
<!-- HTML footer for doxygen 1.8.16-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_23f8282126866178e90c602aff72b450.html">Jinja2Cpp</a></li><li class="navelem"><a class="el" href="dir_5591f313ba7c2b438083bb4a221c083a.html">include</a></li><li class="navelem"><a class="el" href="dir_0f010399f65a277aac918f682439e564.html">jinja2cpp</a></li><li class="navelem"><a class="el" href="filesystem__handler_8h.html">filesystem_handler.h</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.16 </li>
</ul>
</div>
</body>
</html>