00001 /* ${copyright}$ */ 00002 /* $Id: PollRsp.H 1040 2009-10-01 17:49:12Z fneves $ */ 00007 #ifndef __POLL_RSP_H__ 00008 #define __POLL_RSP_H__ 00009 00010 #include <string> 00011 #include <map> 00012 #include <memory> 00013 00014 #include "libepp_nicbr.H" 00015 00016 #include "Response.H" 00017 #include "CommonData.H" 00018 00019 using std::string; 00020 using std::map; 00021 using std::auto_ptr; 00022 00023 LIBEPP_NICBR_NS_BEGIN 00024 00026 class PollRsp : public Response 00027 { 00028 public: 00029 struct MsgContent { 00030 string value; 00031 map< string, string, less<string> > attributes; 00032 }; 00033 00035 PollRsp(bool reset = true) : Response(false) 00036 { 00037 if (reset) { 00038 this->reset(); 00039 } 00040 } 00041 00043 00046 void set_count(const string &count) { _count = count; } 00047 00049 00052 void set_id(const string &id) { _id = id; } 00053 00055 00059 void set_qDate(const string &qDate) { _qDate = qDate; } 00060 00062 00065 void set_lang(const string &lang) { _lang = lang; } 00066 00068 00071 void set_text(const string &text) { _text = text; } 00072 00074 00077 void set_content(const map< string, MsgContent, less<string> > &content) 00078 { 00079 _content = content; 00080 } 00081 00083 00087 void set_response(Response *resp, const ActionType type) { 00088 _type = type; 00089 _response = auto_ptr<Response>(resp); 00090 } 00091 00093 00096 string get_count() const { return _count; } 00097 00099 00102 string get_id() const { return _id; } 00103 00105 00108 string get_qDate() const { return _qDate; } 00109 00111 00114 string get_lang() const { return _lang; } 00115 00117 00120 string get_text() const { return _text; } 00121 00123 00126 map< string, MsgContent, less<string> > get_content() const 00127 { 00128 return _content; 00129 } 00130 00132 00135 ActionType get_response_type() const { return _type; } 00136 00138 00141 Response* get_response() { return _response.get(); } 00142 00144 void reset() { 00145 Response::reset(); 00146 _count = ""; 00147 _id = ""; 00148 _lang = "en"; 00149 _text = ""; 00150 _content.clear(); 00151 _response = auto_ptr<Response>(new Response()); 00152 _type = UNSET_ACTION; 00153 } 00154 00155 protected: 00157 string _count; 00158 00160 string _id; 00161 00163 string _qDate; 00164 00166 string _lang; 00167 00169 string _text; 00170 00172 map< string, MsgContent, less<string> > _content; 00173 00175 ActionType _type; 00176 00178 auto_ptr<Response> _response; 00179 00180 }; 00181 00182 LIBEPP_NICBR_NS_END 00183 #endif //__POLL_RSP_H__