OptionSetter.inl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) <2002-2006> <Jean-Philippe Barrette-LaPierre>
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining
  5. * a copy of this software and associated documentation files
  6. * (curlpp), to deal in the Software without restriction,
  7. * including without limitation the rights to use, copy, modify, merge,
  8. * publish, distribute, sublicense, and/or sell copies of the Software,
  9. * and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included
  13. * in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef CURLPP_OPTIONSETTER_INL
  24. #define CURLPP_OPTIONSETTER_INL
  25. #include <string>
  26. template<typename OptionValueType, CURLoption optionType>
  27. void
  28. curlpp::internal::OptionSetter<OptionValueType, optionType>
  29. ::setOpt(internal::CurlHandle * handle, ParamType value)
  30. {
  31. handle->option(optionType, value);
  32. }
  33. template<CURLoption optionType>
  34. void
  35. curlpp::internal::OptionSetter<std::string, optionType>
  36. ::setOpt(internal::CurlHandle * handle, ParamType value)
  37. {
  38. handle->option(optionType, (void *)value.c_str());
  39. }
  40. template<CURLoption optionType>
  41. void
  42. curlpp::internal::OptionSetter<std::list<std::string>, optionType>
  43. ::setOpt(internal::CurlHandle * handle, ParamType value)
  44. {
  45. handle->option(optionType, (void *)value.cslist());
  46. }
  47. #endif