1 |
douglas |
370 |
// Represent |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Represent_hpp_ |
8 |
|
|
#define _Represent_hpp_ |
9 |
|
|
|
10 |
|
|
#include <menes/platform.hpp> |
11 |
|
|
|
12 |
|
|
#ifdef MENES_PRAGMA_ONCE |
13 |
|
|
#pragma once |
14 |
|
|
#endif |
15 |
|
|
|
16 |
|
|
#include <menes-api/console.hpp> |
17 |
douglas |
384 |
#include <menes-api/environment.hpp> |
18 |
douglas |
370 |
#include <menes-ios/string.hpp> |
19 |
douglas |
379 |
#include <menes-xml/textwriter.hpp> |
20 |
douglas |
370 |
|
21 |
douglas |
379 |
#include <map> |
22 |
douglas |
385 |
#include <set> |
23 |
douglas |
373 |
|
24 |
douglas |
387 |
#define _sforeach(type, item, set) \ |
25 |
|
|
for (bool _stop(true); _stop; ) \ |
26 |
|
|
for (const type& _set = set; _stop; _stop = false) \ |
27 |
|
|
_for (type::const_iterator, item, _set.begin(), _set.end()) |
28 |
|
|
|
29 |
douglas |
370 |
class Represent |
30 |
|
|
{ |
31 |
|
|
private: |
32 |
douglas |
385 |
struct Environment |
33 |
|
|
{ |
34 |
|
|
ext::String get(const ext::String& name) { try { return api::TheEnvironment.Get(name); } catch (ext::Exception) { return ext::String(); } } |
35 |
|
|
} env; |
36 |
|
|
struct Item; |
37 |
douglas |
379 |
std::multimap<std::string, std::string> cgi; |
38 |
|
|
void parse(); |
39 |
douglas |
380 |
void headings(xml::TextWriter& xhtml); |
40 |
|
|
void form(xml::TextWriter& xhtml); |
41 |
douglas |
385 |
void output(xml::TextWriter& xhtml); |
42 |
douglas |
387 |
template <typename Type> void output(xml::TextWriter& xhtml, const Item& item, size_t index); |
43 |
|
|
template <typename Type> Type input(const Item& item); |
44 |
|
|
template <typename Type> void normal(xml::TextWriter& xhtml, const Type& type); |
45 |
|
|
template <typename Type> void binary(xml::TextWriter& xhtml, const Type& type); |
46 |
|
|
template <typename Type> void hexadecimal(xml::TextWriter& xhtml, const Type& type); |
47 |
douglas |
370 |
public: |
48 |
|
|
Represent(); |
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
#endif // _Represent_hpp_ |