00001 /* vim: set et sw=3 tw=0 fo=croqlaw cino=t0: 00002 * 00003 * Astxx, the Asterisk C++ API and Utility Library. 00004 * Copyright (C) 2005-2007 Matthew A. Nicholson 00005 * Copyright (C) 2005-2007 Digium, Inc. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License version 2.1 as published by the Free Software Foundation. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00027 #ifndef ASTXX_MANAGER_ACTION_GETVAR_H 00028 #define ASTXX_MANAGER_ACTION_GETVAR_H 00029 00030 #include <astxx/manager/basic_action.h> 00031 #include <astxx/manager/action/error.h> 00032 #include <astxx/manager/message.h> 00033 00034 namespace astxx { 00035 namespace manager { 00036 namespace action { 00041 class getvar : public basic_action { 00042 public: 00047 getvar(const std::string& channel, const std::string& variable) : channel(channel), variable(variable) { 00048 } 00049 00050 message::action action() const { 00051 message::action action("Getvar"); 00052 action["Channel"] = channel; 00053 action["Variable"] = variable; 00054 return action; 00055 } 00056 00061 message::response handle_response(message::response response) { 00062 basic_action::handle_response(response); 00063 m_value = response["Value"]; 00064 return response; 00065 } 00066 00070 std::string value() { 00071 return m_value; 00072 } 00073 00077 operator std::string() { 00078 return m_value; 00079 } 00080 00081 private: 00082 std::string channel; 00083 std::string variable; 00084 std::string m_value; 00085 }; 00086 } 00087 } 00088 } 00089 00090 #endif
1.5.6