Skip to content

Commit 69d0251

Browse files
committed
prepared version 0.7.1
1 parent 5e01b67 commit 69d0251

File tree

7 files changed

+33
-69
lines changed

7 files changed

+33
-69
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Changes from version 0.7.0-pre1 to 0.7.1
22
- mErrorBuffer memset problem fixed
3-
Graziano Giuliani
3+
(Thanks to Graziano Giuliani)
44
- Fixed HttpPost problem (https://www.rrette.com/pipermail/curlpp/2007-February/000273.html)
55
(Thanks to Gazi Alankus)
66

curlpp/Form.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
#include "Form.hpp"
2626

2727

28+
cURLpp::HttpPost::HttpPost(const Forms &posts)
29+
{
30+
cURLpp::FormPart *form;
31+
Forms::const_iterator pos;
32+
for(pos = posts.begin(); pos != posts.end(); pos++) {
33+
form = (*pos)->clone();
34+
mForms.push_back(form);
35+
form->add(&mFirst, &mLast);
36+
}
37+
}
38+
2839
cURLpp::HttpPost::HttpPost()
2940
: mFirst(NULL)
3041
, mLast(NULL)
@@ -37,12 +48,12 @@ cURLpp::HttpPost::~HttpPost()
3748

3849

3950
cURLpp::HttpPost &
40-
cURLpp::HttpPost::operator=(const std::list< cURLpp::FormPart * > &posts)
51+
cURLpp::HttpPost::operator=(const Forms &posts)
4152
{
4253
clear();
4354

4455
cURLpp::FormPart *form;
45-
std::list< cURLpp::FormPart * >::const_iterator pos;
56+
Forms::const_iterator pos;
4657
for(pos = posts.begin(); pos != posts.end(); pos++) {
4758
form = (*pos)->clone();
4859
mForms.push_back(form);
@@ -67,7 +78,7 @@ cURLpp::HttpPost::clear()
6778
mLast = NULL;
6879
}
6980

70-
std::list< cURLpp::FormPart * >::const_iterator pos;
81+
Forms::const_iterator pos;
7182
for(pos = mForms.begin(); pos != mForms.end(); pos++) {
7283
delete (*pos);
7384
}
@@ -77,10 +88,10 @@ cURLpp::HttpPost::clear()
7788
std::list< cURLpp::FormPart *> cURLpp::HttpPost::getList()
7889
{
7990
//I'm not sure cloning is absolutely necessary.
80-
std::list< cURLpp::FormPart * > newForm;
91+
Forms newForm;
8192

8293
cURLpp::FormPart *form;
83-
std::list< cURLpp::FormPart * >::const_iterator pos;
94+
Forms::const_iterator pos;
8495
for(pos = mForms.begin(); pos != mForms.end(); pos++) {
8596
form = (*pos)->clone();
8697
newForm.push_back(form);

curlpp/Form.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@ namespace cURLpp
4141
*/
4242
class CURLPPAPI HttpPost
4343
{
44+
typedef std::list< cURLpp::FormPart * > Forms;
4445
public:
46+
HttpPost(const Forms &posts);
4547
HttpPost();
4648
~HttpPost();
4749

4850
/**
4951
* initialize the HTTP post with the list of forms. The Forms
5052
* will be cloned.
5153
*/
52-
HttpPost &operator=(const std::list< cURLpp::FormPart * > &posts);
54+
HttpPost &operator=(const Forms &posts);
55+
56+
operator Forms() { return getList(); }
5357

5458

5559
/**
@@ -67,12 +71,12 @@ namespace cURLpp
6771
/**
6872
* Get the list.
6973
*/
70-
std::list< cURLpp::FormPart *> getList();
74+
Forms getList();
7175

7276
private:
7377
::curl_httppost *mFirst;
7478
::curl_httppost *mLast;
75-
std::list< cURLpp::FormPart *> mForms;
79+
Forms mForms;
7680
};
7781

7882
/**

curlpp/Option.inl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,18 @@ template< typename OptionType >
9797
void
9898
cURLpp::Option< OptionType >::clear()
9999
{
100-
delete mContainer;
101-
mContainer = NULL;
100+
delete mContainer;
101+
mContainer = NULL;
102102
}
103103

104104
template< typename OptionType >
105105
typename cURLpp::Option< OptionType >::ReturnType
106106
cURLpp::Option< OptionType >::getValue() const
107107
{
108-
if(mContainer == NULL)
109-
{
108+
if(mContainer == NULL)
109+
throw cURLpp::UnsetOption(std::string("You are trying to retreive the value of an unset option"));
110110

111-
throw cURLpp::UnsetOption(std::string("You are trying to retreive the value of an unset option"));
112-
}
113-
return mContainer->getValue();
111+
return mContainer->getValue();
114112
}
115113

116114
template< typename OptionType, CURLoption option >

curlpp/OptionContainer.hpp

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -83,55 +83,6 @@ namespace cURLpp
8383
*/
8484
typename OptionContainer< OptionType >::ValueType mValue;
8585
};
86-
87-
template< >
88-
class CURLPPAPI OptionContainer < std::list<cURLpp::FormPart *> >
89-
{
90-
public:
91-
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::ParamType ParamType;
92-
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::ReturnType ReturnType;
93-
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::ValueType ValueType;
94-
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::HandleOptionType HandleOptionType;
95-
96-
/**
97-
* Contructor. We pass the value of the option.
98-
*/
99-
OptionContainer(OptionContainer< std::list<cURLpp::FormPart *> >::ParamType value);
100-
101-
OptionContainer(OptionContainer< std::list<cURLpp::FormPart *> > &other);
102-
103-
/**
104-
* This function set the argument that will be passed to the
105-
* option call for a handle. It will use the argument passed to
106-
* this function.
107-
*/
108-
void setValue(OptionContainer< std::list<cURLpp::FormPart *> >::ParamType value);
109-
110-
/**
111-
* This function get the argument that is set on the handle.
112-
*/
113-
OptionContainer< std::list<cURLpp::FormPart *> >::ReturnType getValue();
114-
115-
/**
116-
* We call this function to have the value passed to the curl_easy_setopt.
117-
*
118-
* Note: DO NOT USE THIS FUNCTION! It's for internal use only.
119-
*/
120-
OptionContainer< std::list<cURLpp::FormPart *> >::HandleOptionType getHandleOptionValue();
121-
122-
123-
private:
124-
/**
125-
* We cannot call this constructor. We absolutely need an initial value.
126-
*/
127-
OptionContainer();
128-
129-
/**
130-
* Current value of the option.
131-
*/
132-
OptionContainer< std::list<cURLpp::FormPart *> >::ValueType mValue;
133-
};
134-
13586
}
13687

13788
#include "OptionContainer.inl"

curlpp/OptionContainer.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ template< class OptionType >
4040
void
4141
cURLpp::OptionContainer< OptionType >::setValue(typename OptionContainer< OptionType >::ParamType value)
4242
{
43-
mValue = value;
43+
mValue = value;
4444
}
4545

4646
template< class OptionType >
4747
typename cURLpp::OptionContainer< OptionType >::ReturnType
4848
cURLpp::OptionContainer< OptionType >::getValue()
4949
{
50-
return mValue;
50+
return mValue;
5151
}
5252

5353
template< class OptionType >

curlpp/cURLpp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#ifndef CURLPP_HPP
2626
#define CURLPP_HPP
2727

28-
#define LIBCURLPP_VERSION "0.7.1-devel"
29-
#define LIBCURLPP_VERSION_NUM 0x000700
28+
#define LIBCURLPP_VERSION "0.7.1"
29+
#define LIBCURLPP_VERSION_NUM 0x000701
3030

3131
#include <string>
3232
#include <curl/curl.h>

0 commit comments

Comments
 (0)