From 69d0251443d0ff38ed472070046ec92c87af51a1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Barrette-LaPierre Date: Mon, 3 Sep 2007 09:38:08 -0400 Subject: [PATCH] prepared version 0.7.1 --- CHANGES | 2 +- curlpp/Form.cpp | 21 ++++++++++++---- curlpp/Form.hpp | 10 +++++--- curlpp/Option.inl | 12 ++++------ curlpp/OptionContainer.hpp | 49 -------------------------------------- curlpp/OptionContainer.inl | 4 ++-- curlpp/cURLpp.hpp | 4 ++-- 7 files changed, 33 insertions(+), 69 deletions(-) diff --git a/CHANGES b/CHANGES index a9b40be..ef82508 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/curlpp/Form.cpp b/curlpp/Form.cpp index f310e9e..5d05695 100644 --- a/curlpp/Form.cpp +++ b/curlpp/Form.cpp @@ -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) @@ -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); @@ -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); } @@ -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); diff --git a/curlpp/Form.hpp b/curlpp/Form.hpp index eba76e8..ee9ec59 100644 --- a/curlpp/Form.hpp +++ b/curlpp/Form.hpp @@ -41,7 +41,9 @@ namespace cURLpp */ class CURLPPAPI HttpPost { + typedef std::list< cURLpp::FormPart * > Forms; public: + HttpPost(const Forms &posts); HttpPost(); ~HttpPost(); @@ -49,7 +51,9 @@ namespace cURLpp * 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(); } /** @@ -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; }; /** diff --git a/curlpp/Option.inl b/curlpp/Option.inl index e59f448..1c2a046 100644 --- a/curlpp/Option.inl +++ b/curlpp/Option.inl @@ -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 > diff --git a/curlpp/OptionContainer.hpp b/curlpp/OptionContainer.hpp index 26adcf0..16c867c 100644 --- a/curlpp/OptionContainer.hpp +++ b/curlpp/OptionContainer.hpp @@ -83,55 +83,6 @@ namespace cURLpp */ typename OptionContainer< OptionType >::ValueType mValue; }; - - template< > - class CURLPPAPI OptionContainer < std::list > - { - public: - typedef OptionContainerType< std::list >::ParamType ParamType; - typedef OptionContainerType< std::list >::ReturnType ReturnType; - typedef OptionContainerType< std::list >::ValueType ValueType; - typedef OptionContainerType< std::list >::HandleOptionType HandleOptionType; - - /** - * Contructor. We pass the value of the option. - */ - OptionContainer(OptionContainer< std::list >::ParamType value); - - OptionContainer(OptionContainer< std::list > &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 >::ParamType value); - - /** - * This function get the argument that is set on the handle. - */ - OptionContainer< std::list >::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 >::HandleOptionType getHandleOptionValue(); - - - private: - /** - * We cannot call this constructor. We absolutely need an initial value. - */ - OptionContainer(); - - /** - * Current value of the option. - */ - OptionContainer< std::list >::ValueType mValue; - }; - } #include "OptionContainer.inl" diff --git a/curlpp/OptionContainer.inl b/curlpp/OptionContainer.inl index 7bb99e9..8ef247f 100644 --- a/curlpp/OptionContainer.inl +++ b/curlpp/OptionContainer.inl @@ -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 > diff --git a/curlpp/cURLpp.hpp b/curlpp/cURLpp.hpp index d5f3a8f..f601adf 100644 --- a/curlpp/cURLpp.hpp +++ b/curlpp/cURLpp.hpp @@ -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 #include