libmoost
/home/mhx/git/github/libmoost/include/moost/murcl/option.hpp
Go to the documentation of this file.
00001 /* vim:set ts=3 sw=3 sts=3 et: */
00036 #ifndef FM_LAST_MOOST_MURCL_OPTION_HPP__
00037 #define FM_LAST_MOOST_MURCL_OPTION_HPP__
00038 
00039 #include <vector>
00040 
00041 #include <curl/curl.h>
00042 
00043 #include <boost/shared_ptr.hpp>
00044 
00045 #include "option_setter.hpp"
00046 
00047 namespace moost { namespace murcl {
00048 
00060 class option_base
00061 {
00062 public:
00063    virtual ~option_base() {}
00064 };
00065 
00069 typedef std::vector<boost::shared_ptr<option_base> > option_stash;
00070 
00079 template <typename OptTraits>
00080 class option : public option_base
00081 {
00082 public:
00083    typedef OptTraits option_traits;
00084 
00085    /*
00086    * @brief Construct and set a LibCurl option
00087    *
00088    * @param handle
00089    *     a valid LibCurl interface handle
00090    * @param val
00091    *     the value being set for this option
00092    */
00093    option(
00094       typename option_traits::handle_type handle,
00095       typename option_traits::value_type const & val
00096       )
00097       : val_(val)
00098    {
00099       option_setter<typename option_traits::curl_option,
00100          typename option_traits::value_type>::set(handle, val_);
00101    }
00102 
00103 private:
00104    typename option_traits::value_type val_;
00105 };
00106 
00107 }}
00108 
00109 #endif //FM_LAST_MOOST_MURCL_OPTION_HPP__