1 | // |
2 | // Page.h |
3 | // |
4 | // Copyright (c) 2008, Applied Informatics Software Engineering GmbH. |
5 | // and Contributors. |
6 | // |
7 | // SPDX-License-Identifier: BSL-1.0 |
8 | // |
9 | |
10 | |
11 | #ifndef Page_INCLUDED |
12 | #define Page_INCLUDED |
13 | |
14 | |
15 | #include "Poco/Net/NameValueCollection.h" |
16 | #include <sstream> |
17 | |
18 | |
19 | class Page: public Poco::Net::NameValueCollection |
20 | /// This class represents a server page consisting of |
21 | /// handler code and declarations, as well as page attributes. |
22 | { |
23 | public: |
24 | Page(); |
25 | /// Creates a Page. |
26 | |
27 | ~Page(); |
28 | /// Destroys the Page. |
29 | |
30 | std::stringstream& headerDecls(); |
31 | /// Returns the user-specified declarations for the header file. |
32 | |
33 | const std::stringstream& headerDecls() const; |
34 | /// Returns the user-specified declarations for the header file. |
35 | |
36 | std::stringstream& implDecls(); |
37 | /// Returns the user-specified declarations for the source file. |
38 | |
39 | const std::stringstream& implDecls() const; |
40 | /// Returns the user-specified declarations for the source file. |
41 | |
42 | std::stringstream& handler(); |
43 | /// Returns the request handler code. |
44 | |
45 | const std::stringstream& handler() const; |
46 | /// Returns the request prehandler code. |
47 | |
48 | std::stringstream& preHandler(); |
49 | /// Returns the request handler code. |
50 | |
51 | const std::stringstream& preHandler() const; |
52 | /// Returns the request prehandler code. |
53 | |
54 | bool getBool(const std::string& property, bool deflt = false) const; |
55 | /// Returns the boolean value of the given property. |
56 | /// |
57 | /// The return value will be true if the property |
58 | /// has one of the following values: |
59 | /// - true |
60 | /// - yes |
61 | /// - on |
62 | /// |
63 | /// Otherwise, the return value will be false. |
64 | |
65 | int getInt(const std::string& property, int deflt = 0) const; |
66 | /// Returns the integer value of the given property. |
67 | |
68 | private: |
69 | Page(const Page&); |
70 | Page& operator = (const Page&); |
71 | |
72 | std::stringstream ; |
73 | std::stringstream _implDecls; |
74 | std::stringstream _handler; |
75 | std::stringstream _preHandler; |
76 | }; |
77 | |
78 | |
79 | // |
80 | // inlines |
81 | // |
82 | inline std::stringstream& Page::() |
83 | { |
84 | return _headerDecls; |
85 | } |
86 | |
87 | |
88 | inline const std::stringstream& Page::() const |
89 | { |
90 | return _headerDecls; |
91 | } |
92 | |
93 | |
94 | inline std::stringstream& Page::implDecls() |
95 | { |
96 | return _implDecls; |
97 | } |
98 | |
99 | |
100 | inline const std::stringstream& Page::implDecls() const |
101 | { |
102 | return _implDecls; |
103 | } |
104 | |
105 | |
106 | inline std::stringstream& Page::handler() |
107 | { |
108 | return _handler; |
109 | } |
110 | |
111 | |
112 | inline const std::stringstream& Page::handler() const |
113 | { |
114 | return _handler; |
115 | } |
116 | |
117 | |
118 | inline std::stringstream& Page::preHandler() |
119 | { |
120 | return _preHandler; |
121 | } |
122 | |
123 | |
124 | inline const std::stringstream& Page::preHandler() const |
125 | { |
126 | return _preHandler; |
127 | } |
128 | |
129 | |
130 | #endif // Page_INCLUDED |
131 | |