Skip to content

Commit

Permalink
prepared version 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbarrette committed Sep 3, 2007
1 parent 5e01b67 commit 69d0251
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 69 deletions.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Changes from version 0.7.0-pre1 to 0.7.1
- mErrorBuffer memset problem fixed
Graziano Giuliani
(Thanks to Graziano Giuliani)
- Fixed HttpPost problem (https://www.rrette.com/pipermail/curlpp/2007-February/000273.html)
(Thanks to Gazi Alankus)

Expand Down
21 changes: 16 additions & 5 deletions curlpp/Form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
#include "Form.hpp"


cURLpp::HttpPost::HttpPost(const Forms &posts)
{
cURLpp::FormPart *form;
Forms::const_iterator pos;
for(pos = posts.begin(); pos != posts.end(); pos++) {
form = (*pos)->clone();
mForms.push_back(form);
form->add(&mFirst, &mLast);
}
}

cURLpp::HttpPost::HttpPost()
: mFirst(NULL)
, mLast(NULL)
Expand All @@ -37,12 +48,12 @@ cURLpp::HttpPost::~HttpPost()


cURLpp::HttpPost &
cURLpp::HttpPost::operator=(const std::list< cURLpp::FormPart * > &posts)
cURLpp::HttpPost::operator=(const Forms &posts)
{
clear();

cURLpp::FormPart *form;
std::list< cURLpp::FormPart * >::const_iterator pos;
Forms::const_iterator pos;
for(pos = posts.begin(); pos != posts.end(); pos++) {
form = (*pos)->clone();
mForms.push_back(form);
Expand All @@ -67,7 +78,7 @@ cURLpp::HttpPost::clear()
mLast = NULL;
}

std::list< cURLpp::FormPart * >::const_iterator pos;
Forms::const_iterator pos;
for(pos = mForms.begin(); pos != mForms.end(); pos++) {
delete (*pos);
}
Expand All @@ -77,10 +88,10 @@ cURLpp::HttpPost::clear()
std::list< cURLpp::FormPart *> cURLpp::HttpPost::getList()
{
//I'm not sure cloning is absolutely necessary.
std::list< cURLpp::FormPart * > newForm;
Forms newForm;

cURLpp::FormPart *form;
std::list< cURLpp::FormPart * >::const_iterator pos;
Forms::const_iterator pos;
for(pos = mForms.begin(); pos != mForms.end(); pos++) {
form = (*pos)->clone();
newForm.push_back(form);
Expand Down
10 changes: 7 additions & 3 deletions curlpp/Form.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,19 @@ namespace cURLpp
*/
class CURLPPAPI HttpPost
{
typedef std::list< cURLpp::FormPart * > Forms;
public:
HttpPost(const Forms &posts);
HttpPost();
~HttpPost();

/**
* initialize the HTTP post with the list of forms. The Forms
* will be cloned.
*/
HttpPost &operator=(const std::list< cURLpp::FormPart * > &posts);
HttpPost &operator=(const Forms &posts);

operator Forms() { return getList(); }


/**
Expand All @@ -67,12 +71,12 @@ namespace cURLpp
/**
* Get the list.
*/
std::list< cURLpp::FormPart *> getList();
Forms getList();

private:
::curl_httppost *mFirst;
::curl_httppost *mLast;
std::list< cURLpp::FormPart *> mForms;
Forms mForms;
};

/**
Expand Down
12 changes: 5 additions & 7 deletions curlpp/Option.inl
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,18 @@ template< typename OptionType >
void
cURLpp::Option< OptionType >::clear()
{
delete mContainer;
mContainer = NULL;
delete mContainer;
mContainer = NULL;
}

template< typename OptionType >
typename cURLpp::Option< OptionType >::ReturnType
cURLpp::Option< OptionType >::getValue() const
{
if(mContainer == NULL)
{
if(mContainer == NULL)
throw cURLpp::UnsetOption(std::string("You are trying to retreive the value of an unset option"));

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

template< typename OptionType, CURLoption option >
Expand Down
49 changes: 0 additions & 49 deletions curlpp/OptionContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,55 +83,6 @@ namespace cURLpp
*/
typename OptionContainer< OptionType >::ValueType mValue;
};

template< >
class CURLPPAPI OptionContainer < std::list<cURLpp::FormPart *> >
{
public:
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::ParamType ParamType;
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::ReturnType ReturnType;
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::ValueType ValueType;
typedef OptionContainerType< std::list<cURLpp::FormPart *> >::HandleOptionType HandleOptionType;

/**
* Contructor. We pass the value of the option.
*/
OptionContainer(OptionContainer< std::list<cURLpp::FormPart *> >::ParamType value);

OptionContainer(OptionContainer< std::list<cURLpp::FormPart *> > &other);

/**
* This function set the argument that will be passed to the
* option call for a handle. It will use the argument passed to
* this function.
*/
void setValue(OptionContainer< std::list<cURLpp::FormPart *> >::ParamType value);

/**
* This function get the argument that is set on the handle.
*/
OptionContainer< std::list<cURLpp::FormPart *> >::ReturnType getValue();

/**
* We call this function to have the value passed to the curl_easy_setopt.
*
* Note: DO NOT USE THIS FUNCTION! It's for internal use only.
*/
OptionContainer< std::list<cURLpp::FormPart *> >::HandleOptionType getHandleOptionValue();


private:
/**
* We cannot call this constructor. We absolutely need an initial value.
*/
OptionContainer();

/**
* Current value of the option.
*/
OptionContainer< std::list<cURLpp::FormPart *> >::ValueType mValue;
};

}

#include "OptionContainer.inl"
Expand Down
4 changes: 2 additions & 2 deletions curlpp/OptionContainer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ template< class OptionType >
void
cURLpp::OptionContainer< OptionType >::setValue(typename OptionContainer< OptionType >::ParamType value)
{
mValue = value;
mValue = value;
}

template< class OptionType >
typename cURLpp::OptionContainer< OptionType >::ReturnType
cURLpp::OptionContainer< OptionType >::getValue()
{
return mValue;
return mValue;
}

template< class OptionType >
Expand Down
4 changes: 2 additions & 2 deletions curlpp/cURLpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#ifndef CURLPP_HPP
#define CURLPP_HPP

#define LIBCURLPP_VERSION "0.7.1-devel"
#define LIBCURLPP_VERSION_NUM 0x000700
#define LIBCURLPP_VERSION "0.7.1"
#define LIBCURLPP_VERSION_NUM 0x000701

#include <string>
#include <curl/curl.h>
Expand Down

0 comments on commit 69d0251

Please sign in to comment.