author | Michael Krelin <hacker@klever.net> | 2008-03-03 17:16:32 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-03-03 17:16:32 (UTC) |
commit | ecb6a585d1fc3705836dc896fe348b970101e8d3 (patch) (unidiff) | |
tree | 2ae11b4109988ab63093c041f8d5925794d51323 /include/opkele | |
parent | 374985b5317d559b561d7f557034661e314f5605 (diff) | |
download | libopkele-ecb6a585d1fc3705836dc896fe348b970101e8d3.zip libopkele-ecb6a585d1fc3705836dc896fe348b970101e8d3.tar.gz libopkele-ecb6a585d1fc3705836dc896fe348b970101e8d3.tar.bz2 |
renamed basic_message to basic_fields
since oauth fieldsets aren't really messages
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/opkele/types.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h index bf50e2b..f63bf5d 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -89,108 +89,104 @@ namespace opkele { | |||
89 | /** | 89 | /** |
90 | * retrieve the association type. | 90 | * retrieve the association type. |
91 | * @return association type | 91 | * @return association type |
92 | */ | 92 | */ |
93 | virtual string assoc_type() const = 0; | 93 | virtual string assoc_type() const = 0; |
94 | /** | 94 | /** |
95 | * retrieve the association secret. | 95 | * retrieve the association secret. |
96 | * @return association secret | 96 | * @return association secret |
97 | */ | 97 | */ |
98 | virtual secret_t secret() const = 0; | 98 | virtual secret_t secret() const = 0; |
99 | /** | 99 | /** |
100 | * retrieve the number of seconds the association expires in. | 100 | * retrieve the number of seconds the association expires in. |
101 | * @return seconds till expiration | 101 | * @return seconds till expiration |
102 | */ | 102 | */ |
103 | virtual int expires_in() const = 0; | 103 | virtual int expires_in() const = 0; |
104 | /** | 104 | /** |
105 | * check whether the association is stateless. | 105 | * check whether the association is stateless. |
106 | * @return true if stateless | 106 | * @return true if stateless |
107 | */ | 107 | */ |
108 | virtual bool stateless() const = 0; | 108 | virtual bool stateless() const = 0; |
109 | /** | 109 | /** |
110 | * check whether the association is expired. | 110 | * check whether the association is expired. |
111 | * @return true if expired | 111 | * @return true if expired |
112 | */ | 112 | */ |
113 | virtual bool is_expired() const = 0; | 113 | virtual bool is_expired() const = 0; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * the shared_ptr<> for association_t object type | 117 | * the shared_ptr<> for association_t object type |
118 | */ | 118 | */ |
119 | typedef tr1mem::shared_ptr<association_t> assoc_t; | 119 | typedef tr1mem::shared_ptr<association_t> assoc_t; |
120 | 120 | ||
121 | class basic_message { | 121 | class basic_fields { |
122 | public: | 122 | public: |
123 | typedef util::forward_iterator_proxy< | 123 | typedef util::forward_iterator_proxy< |
124 | string,const string&,const string* | 124 | string,const string&,const string* |
125 | > fields_iterator; | 125 | > fields_iterator; |
126 | 126 | ||
127 | basic_message() { } | 127 | basic_fields() { } |
128 | virtual ~basic_message() { } | 128 | virtual ~basic_fields() { } |
129 | basic_message(const basic_message& x); | 129 | basic_fields(const basic_fields& x); |
130 | void copy_to(basic_message& x) const; | 130 | void copy_to(basic_fields& x) const; |
131 | void append_to(basic_message& x) const; | 131 | void append_to(basic_fields& x) const; |
132 | 132 | ||
133 | virtual bool has_field(const string& n) const = 0; | 133 | virtual bool has_field(const string& n) const = 0; |
134 | virtual const string& get_field(const string& n) const = 0; | 134 | virtual const string& get_field(const string& n) const = 0; |
135 | 135 | ||
136 | virtual fields_iterator fields_begin() const = 0; | 136 | virtual fields_iterator fields_begin() const = 0; |
137 | virtual fields_iterator fields_end() const = 0; | 137 | virtual fields_iterator fields_end() const = 0; |
138 | 138 | ||
139 | virtual string append_query(const string& url,const char *pfx=0) const; | 139 | virtual string append_query(const string& url,const char *pfx=0) const; |
140 | virtual string query_string(const char *pfx=0) const; | 140 | virtual string query_string(const char *pfx=0) const; |
141 | 141 | ||
142 | virtual void reset_fields(); | 142 | virtual void reset_fields(); |
143 | virtual void set_field(const string& n,const string& v); | 143 | virtual void set_field(const string& n,const string& v); |
144 | virtual void reset_field(const string& n); | 144 | virtual void reset_field(const string& n); |
145 | 145 | ||
146 | }; | 146 | }; |
147 | 147 | ||
148 | class basic_openid_message : public basic_message { | 148 | class basic_openid_message : public basic_fields { |
149 | public: | 149 | public: |
150 | typedef list<string> fields_t; | ||
151 | typedef util::forward_iterator_proxy< | ||
152 | string,const string&,const string* | ||
153 | > fields_iterator; | ||
154 | 150 | ||
155 | basic_openid_message() { } | 151 | basic_openid_message() { } |
156 | basic_openid_message(const basic_openid_message& x); | 152 | basic_openid_message(const basic_openid_message& x); |
157 | 153 | ||
158 | virtual bool has_ns(const string& uri) const; | 154 | virtual bool has_ns(const string& uri) const; |
159 | virtual string get_ns(const string& uri) const; | 155 | virtual string get_ns(const string& uri) const; |
160 | 156 | ||
161 | virtual string append_query(const string& url,const char *pfx="openid.") const { | 157 | virtual string append_query(const string& url,const char *pfx="openid.") const { |
162 | return basic_message::append_query(url,pfx); } | 158 | return basic_fields::append_query(url,pfx); } |
163 | virtual string query_string(const char *pfx="openid.") const { | 159 | virtual string query_string(const char *pfx="openid.") const { |
164 | return basic_message::query_string(pfx); } | 160 | return basic_fields::query_string(pfx); } |
165 | 161 | ||
166 | virtual void from_keyvalues(const string& kv); | 162 | virtual void from_keyvalues(const string& kv); |
167 | virtual void to_keyvalues(ostream& o) const; | 163 | virtual void to_keyvalues(ostream& o) const; |
168 | 164 | ||
169 | virtual void to_htmlhiddens(ostream& o,const char* pfx=0) const; | 165 | virtual void to_htmlhiddens(ostream& o,const char* pfx=0) const; |
170 | 166 | ||
171 | void add_to_signed(const string& fields); | 167 | void add_to_signed(const string& fields); |
172 | string find_ns(const string& uri,const char *pfx) const; | 168 | string find_ns(const string& uri,const char *pfx) const; |
173 | string allocate_ns(const string& uri,const char *pfx); | 169 | string allocate_ns(const string& uri,const char *pfx); |
174 | }; | 170 | }; |
175 | 171 | ||
176 | class openid_message_t : public basic_openid_message, public map<string,string> { | 172 | class openid_message_t : public basic_openid_message, public map<string,string> { |
177 | public: | 173 | public: |
178 | openid_message_t() { } | 174 | openid_message_t() { } |
179 | openid_message_t(const basic_openid_message& x) | 175 | openid_message_t(const basic_openid_message& x) |
180 | : basic_openid_message(x) { } | 176 | : basic_openid_message(x) { } |
181 | 177 | ||
182 | bool has_field(const string& n) const; | 178 | bool has_field(const string& n) const; |
183 | const string& get_field(const string& n) const; | 179 | const string& get_field(const string& n) const; |
184 | virtual fields_iterator fields_begin() const; | 180 | virtual fields_iterator fields_begin() const; |
185 | virtual fields_iterator fields_end() const; | 181 | virtual fields_iterator fields_end() const; |
186 | 182 | ||
187 | void reset_fields(); | 183 | void reset_fields(); |
188 | void set_field(const string& n,const string& v); | 184 | void set_field(const string& n,const string& v); |
189 | void reset_field(const string& n); | 185 | void reset_field(const string& n); |
190 | }; | 186 | }; |
191 | 187 | ||
192 | /** | 188 | /** |
193 | * request/response parameters map | 189 | * request/response parameters map |
194 | */ | 190 | */ |
195 | class params_t : public openid_message_t { | 191 | class params_t : public openid_message_t { |
196 | public: | 192 | public: |