00001 /* ${copyright}$ */ 00002 /* $Id: PollRsp.H 620 2006-03-21 15:24:02Z cesar $ */ 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() { return _count; } 00097 00099 00102 string get_id() { return _id; } 00103 00105 00108 string get_qDate() { return _qDate; } 00109 00111 00114 string get_lang() { return _lang; } 00115 00117 00120 string get_text() { return _text; } 00121 00123 00126 map< string, MsgContent, less<string> > get_content() { return _content; } 00127 00129 00132 ActionType get_response_type() { return _type; } 00133 00135 00138 Response* get_response() { return _response.get(); } 00139 00141 void reset() { 00142 Response::reset(); 00143 _count = ""; 00144 _id = ""; 00145 _lang = "en"; 00146 _text = ""; 00147 _content.clear(); 00148 _response = auto_ptr<Response>(new Response()); 00149 _type = UNSET_ACTION; 00150 } 00151 00152 protected: 00154 string _count; 00155 00157 string _id; 00158 00160 string _qDate; 00161 00163 string _lang; 00164 00166 string _text; 00167 00169 map< string, MsgContent, less<string> > _content; 00170 00172 ActionType _type; 00173 00175 auto_ptr<Response> _response; 00176 00177 }; 00178 00179 LIBEPP_NICBR_NS_END 00180 #endif //__POLL_RSP_H__