/usr/include/curlpp/Option.hpp is in libcurlpp-dev 0.7.3-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | /*
* Copyright (c) <2002-2009> <Jean-Philippe Barrette-LaPierre>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (curlpp), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef CURLPP_OPTION_HPP
#define CURLPP_OPTION_HPP
#include "internal/buildconfig.h"
#include "internal/OptionContainer.hpp"
#include "OptionBase.hpp"
namespace curlpp
{
class Easy;
/**
* This class is representing an option that you set on a class.
*
* We use utilspp::pointer_on_member_function and utilspp::type_trait to simplify
* the declaration of an option object.
*/
template<typename OT>
class CURLPPAPI Option : public curlpp::OptionBase
{
public:
typedef OT OptionType;
typedef typename internal::OptionContainer<OptionType>::ParamType ParamType;
typedef typename internal::OptionContainer<OptionType>::ValueType ValueType;
typedef typename internal::OptionContainer<OptionType>::ReturnType ReturnType;
typedef typename internal::OptionContainer<OptionType>::HandleOptionType HandleOptionType;
protected:
/**
* The constructor takes the a value to set a handle.
*/
Option(CURLoption option, typename Option<OptionType>::ParamType value);
/**
* The construction will copy the value of the Option passed in argument.
*/
Option(const Option<OptionType> & other);
/**
* The constructor will contain an unset option value.
* Note that if you try to retreive the value of this option
* before calling the curlpp::Option::setValue function it will
* throw a UnsetOption exception.
*/
Option(CURLoption option);
public:
/**
* What can I say? Everyone is dying one time or another...
*/
virtual ~Option();
/**
* This function will set the value that will be set on handle when we
* will call the "update" function on a handle.
*/
void setValue(typename Option<OptionType>::ParamType value);
/**
* This function will return the value that this option was set to.
*
* Note: if you didn't set any value by the curlpp::Option::setValue function,
* or the handle option value, retreived by the curlpp::Option::updateMeToHandle
* function, is a unset value, it will throw a UnsetOption exception.
*/
typename Option<OptionType>::ReturnType getValue() const;
/**
* This function will reset the option value. That means that if you try to
* retreive the value of this option, or if you try to set this option to a
* handle, it will throw an UnsetOption exception.
*/
virtual void clear();
/**
* Will update the value of the option with the value of the
* option passed is argument.
*/
virtual void updateMeToOption(const OptionBase & other);
private:
/**
* This function will update the given handle to the value previously set,
* by the curlpp::Option::setValue function.
*/
void setOpt(curlpp::Easy * handle) const;
/**
* This function will update the current value of the option to the handle
* option value.
*/
void getOpt(curlpp::Easy * handle);
protected:
/**
* the class that actually have the value.
*/
typename curlpp::internal::OptionContainer<OptionType> * mContainer;
};
/**
* This class is just a wrapper around curlpp::Option, in order to
* be able to typedef Options.
*/
template<typename OptionType, CURLoption opt>
class CURLPPAPI OptionTrait : public Option<OptionType>
{
friend class Easy;
public:
static const CURLoption option = opt;
/**
* The constructor takes the a value to set a handle.
*/
OptionTrait(typename Option<OptionType>::ParamType value);
/**
* The constructor will contain an unset option value.
* Note that if you try to retreive the value of this option
* before calling the curlpp::Option::setValue function it will
* throw a UnsetOption exception.
*/
OptionTrait();
/**
* Return a copy of the current option.
* Note that the option value is copied too.
*/
virtual OptionTrait * clone() const;
private:
/**
* will call the actual libcurl option function with the value we got
* on the handle.
*/
virtual void updateHandleToMe(internal::CurlHandle * handle) const;
};
/**
* This class is just a wrapper around curlpp::OptionTrait, in order to
* be able to have "No value" option, like SslDefaultEngine.
*/
template<CURLoption option>
class CURLPPAPI NoValueOptionTrait : public OptionTrait<bool, option>
{
public:
NoValueOptionTrait();
/**
* Return a copy of the current option.
* Note that the option value is copied too.
*/
virtual NoValueOptionTrait * clone() const;
};
/**
* This class is used when the option is not implemented.
*/
template<typename OptionType>
class CURLPPAPI NotAvailableOptionTrait : public Option<OptionType>
{
public:
/**
* The constructor takes the a value to set a handle.
*/
NotAvailableOptionTrait(typename Option<OptionType>::ParamType value);
/**
* The constructor will contain an unset option value.
* Note that if you try to retreive the value of this option
* before calling the curlpp::Option::setValue function it will
* throw a UnsetOption exception.
*/
NotAvailableOptionTrait();
/**
* Return a copy of the current option.
* Note that the option value is copied too.
*/
virtual NotAvailableOptionTrait * clone() const;
private:
/**
* will call the actual libcurl option function with the value we got
* on the handle.
*/
virtual void updateHandleToMe(internal::CurlHandle * handle) const;
};
} // namespace curlpp
namespace cURLpp = curlpp;
#ifdef CURLPP_INCLUDE_TEMPLATE_DEFINITIONS
#include "Option.inl"
#endif
#endif // #ifndef CURLPP_OPTION_HPP
|