@@ -341,16 +341,13 @@ set(CPPCMS_PUBLIC_HEADERS | |||
base_view.h | |||
cache_interface.h | |||
cache_pool.h | |||
clone_ptr.h | |||
# connection_forwarder.h | |||
copy_ptr.h | |||
cppcms_error.h | |||
cstdint.h | |||
defs.h | |||
encoding.h | |||
filters.h | |||
form.h | |||
hold_ptr.h | |||
http_context.h | |||
http_cookie.h | |||
http_file.h | |||
@@ -377,7 +374,6 @@ set(CPPCMS_PUBLIC_HEADERS | |||
util.h | |||
view.h | |||
views_pool.h | |||
function.h | |||
${CMAKE_CURRENT_BINARY_DIR}/config.h | |||
) | |||
@@ -676,7 +672,6 @@ set(ALL_TESTS | |||
cache_backend_test | |||
json_test | |||
base64_test | |||
function_test | |||
forwarder_test | |||
jsonrpc_test | |||
) | |||
@@ -752,7 +747,6 @@ add_test(encryptor_test encryptor_test) | |||
add_test(storage_test storage_test) | |||
add_test(json_test json_test) | |||
add_test(cache_backend_test cache_backend_test) | |||
add_test(function_test function_test) | |||
add_test(form_test | |||
form_test "-c" "${CNF}/form_test.js" | |||
@@ -22,7 +22,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "atomic_counter.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "intrusive_ptr.h" | |||
#include <string> | |||
@@ -274,7 +274,7 @@ namespace cppcms { | |||
struct data; // future use | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
application *parent_; | |||
application *root_; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "intrusive_ptr.h" | |||
#include <memory> | |||
@@ -150,7 +150,7 @@ namespace cppcms { | |||
std::string script_name(); | |||
bool matched(basic_app_data &data,std::string script_name,std::string path_info,std::string &matched); | |||
service *srv_; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
namespace details { | |||
@@ -28,7 +28,7 @@ | |||
#include <ctime> | |||
#include <memory> | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "base_content.h" | |||
#include "noncopyable.h" | |||
#include "config.h" | |||
@@ -59,7 +59,7 @@ protected: | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -25,7 +25,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "intrusive_ptr.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "cstdint.h" | |||
namespace cppcms { | |||
@@ -266,7 +266,7 @@ namespace cppcms { | |||
bool notriggers); | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
http::context *context_; | |||
std::set<std::string> triggers_; | |||
intrusive_ptr<impl::base_cache> cache_module_; | |||
@@ -22,7 +22,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "intrusive_ptr.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
namespace cppcms { | |||
namespace json { class value; } | |||
@@ -35,7 +35,7 @@ namespace cppcms { | |||
intrusive_ptr<impl::base_cache> get(); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
} | |||
@@ -256,12 +256,12 @@ intrusive_ptr<connection> connection::self() | |||
} | |||
void connection::async_prepare_request( http::request &request, | |||
function<void(bool)> const &h) | |||
booster::function<void(bool)> const &h) | |||
{ | |||
async_read_headers(boost::bind(&connection::load_content,self(),_1,&request,h)); | |||
} | |||
void connection::aync_wait_for_close_by_peer(function<void()> const &on_eof) | |||
void connection::aync_wait_for_close_by_peer(booster::function<void()> const &on_eof) | |||
{ | |||
async_read_eof(boost::bind(&connection::handle_eof,self(),on_eof)); | |||
} | |||
@@ -24,7 +24,7 @@ | |||
#include "intrusive_ptr.h" | |||
#include <vector> | |||
#include <map> | |||
#include "function.h" | |||
#include <booster/function.h> | |||
#include "config.h" | |||
#include <booster/system_error.h> | |||
@@ -43,10 +43,10 @@ namespace cppcms { | |||
namespace impl { | |||
namespace cgi { | |||
typedef function<void(booster::system::error_code const &e)> handler; | |||
typedef function<void(booster::system::error_code const &e,size_t)> io_handler; | |||
typedef function<void()> callback; | |||
typedef function<void(bool)> ehandler; | |||
typedef booster::function<void(booster::system::error_code const &e)> handler; | |||
typedef booster::function<void(booster::system::error_code const &e,size_t)> io_handler; | |||
typedef booster::function<void()> callback; | |||
typedef booster::function<void(bool)> ehandler; | |||
class acceptor : public util::noncopyable { | |||
public: | |||
@@ -1,77 +0,0 @@ | |||
/////////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Copyright (C) 2008-2010 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU Lesser General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU Lesser General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU Lesser General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#ifndef CPPCMS_UTIL_CLONE_PTR_H | |||
#define CPPCMS_UTIL_CLONE_PTR_H | |||
namespace cppcms { namespace util { | |||
/// | |||
/// \brief a smart pointer similar to std::auto_ptr but it clones (by calling T::clone()) | |||
/// underlying object on copy instead of moving its ownership. | |||
/// | |||
template<typename T> | |||
class clone_ptr { | |||
T *ptr_; | |||
public: | |||
clone_ptr() : ptr_(0) {} | |||
clone_ptr(T *v) : ptr_(v) {} | |||
clone_ptr(clone_ptr const &other) : ptr_(0) | |||
{ | |||
if(other.ptr_) | |||
ptr_=other.ptr_->clone(); | |||
} | |||
clone_ptr const &operator=(clone_ptr const &other) | |||
{ | |||
if(this != &other) { | |||
if(ptr_) { | |||
delete ptr_; | |||
ptr_=0; | |||
} | |||
if(other.ptr_) { | |||
ptr_=other.ptr_->clone(); | |||
} | |||
} | |||
return *this; | |||
} | |||
~clone_ptr() { | |||
if(ptr_) delete ptr_; | |||
} | |||
T *get() const { return ptr_; } | |||
T &operator *() const { return *ptr_; } | |||
T *operator->() const { return ptr_; } | |||
T *release() { T *tmp=ptr_; ptr_=0; return tmp; } | |||
void reset(T *p=0) | |||
{ | |||
if(ptr_) delete ptr_; | |||
ptr_=p; | |||
} | |||
void swap(clone_ptr &other) | |||
{ | |||
T *tmp=other.ptr_; | |||
other.ptr_=ptr_; | |||
ptr_=tmp; | |||
} | |||
}; | |||
}} // cppcms::util | |||
#endif |
@@ -31,7 +31,7 @@ namespace cppcms { | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
std::string ip_; | |||
int port_; | |||
}; | |||
@@ -1,82 +0,0 @@ | |||
/////////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Copyright (C) 2008-2010 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU Lesser General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU Lesser General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU Lesser General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#ifndef CPPCMS_UTIL_COPY_PTR_H | |||
#define CPPCMS_UTIL_COPY_PTR_H | |||
namespace cppcms { namespace util { | |||
/// | |||
/// \brief a smart pointer similar to std::auto_ptr but it copies | |||
/// underlying object on pointer copy instead of moving its ownership. | |||
/// | |||
/// Note: Underlying object has same constness as the pointer itself (not like in ordinary pointer). | |||
/// | |||
/// Don't use it with polymorphic classes. Prefer clone_ptr instead. | |||
/// | |||
template<typename T> | |||
class copy_ptr { | |||
T *ptr_; | |||
public: | |||
copy_ptr() : ptr_(0) {} | |||
copy_ptr(T *v) : ptr_(v) {} | |||
copy_ptr(copy_ptr const &other) : | |||
ptr_(other.ptr_ ? new T(*other.ptr_) : 0) | |||
{ | |||
} | |||
copy_ptr const &operator=(copy_ptr const &other) | |||
{ | |||
if(this != &other) { | |||
if(ptr_) { | |||
delete ptr_; | |||
ptr_=0; | |||
} | |||
if(other.ptr_) { | |||
ptr_=new T(*other.ptr_); | |||
} | |||
} | |||
return *this; | |||
} | |||
~copy_ptr() { | |||
if(ptr_) delete ptr_; | |||
} | |||
T const *get() const { return ptr_; } | |||
T *get() { return ptr_; } | |||
T const &operator *() const { return *ptr_; } | |||
T &operator *() { return *ptr_; } | |||
T const *operator->() const { return ptr_; } | |||
T *operator->() { return ptr_; } | |||
T *release() { T *tmp=ptr_; ptr_=0; return tmp; } | |||
void reset(T *p=0) | |||
{ | |||
if(ptr_) delete ptr_; | |||
ptr_=p; | |||
} | |||
void swap(copy_ptr &other) | |||
{ | |||
T *tmp=other.ptr_; | |||
other.ptr_=ptr_; | |||
ptr_=tmp; | |||
} | |||
}; | |||
}} // cppcms::util | |||
#endif |
@@ -25,7 +25,7 @@ | |||
#include <vector> | |||
#include <iostream> | |||
#include "defs.h" | |||
#include "copy_ptr.h" | |||
#include <booster/copy_ptr.h> | |||
#include "localization.h" | |||
namespace cppcms { | |||
@@ -133,7 +133,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,to_upper const &obj) | |||
@@ -160,7 +160,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,to_lower const &obj) | |||
@@ -189,7 +189,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,to_title const &obj) | |||
@@ -218,7 +218,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,escape const &obj) | |||
@@ -246,7 +246,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,urlencode const &obj) | |||
@@ -273,7 +273,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,base64_urlencode const &obj) | |||
@@ -300,7 +300,7 @@ namespace cppcms { | |||
private: | |||
streamable obj_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
@@ -331,7 +331,7 @@ namespace cppcms { | |||
private: | |||
struct data; | |||
double time_; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,date const &obj) | |||
@@ -357,7 +357,7 @@ namespace cppcms { | |||
private: | |||
struct data; | |||
double time_; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,time const &obj) | |||
@@ -382,7 +382,7 @@ namespace cppcms { | |||
private: | |||
struct data; | |||
double time_; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
inline std::ostream &operator<<(std::ostream &out,datetime const &obj) | |||
@@ -33,7 +33,7 @@ | |||
#include "http_context.h" | |||
#include "http_request.h" | |||
#include "http_response.h" | |||
#include "copy_ptr.h" | |||
#include <booster/copy_ptr.h> | |||
#include "cppcms_error.h" | |||
#include "util.h" | |||
#include "regex.h" | |||
@@ -96,7 +96,7 @@ namespace cppcms { | |||
uint32_t reserved_1; | |||
uint32_t reserved_2; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -331,7 +331,7 @@ namespace cppcms { | |||
form *current_; | |||
unsigned offset_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
@@ -354,7 +354,7 @@ namespace cppcms { | |||
typedef std::pair<base_form *,bool> widget_type; | |||
std::vector<widget_type> elements_; | |||
form *parent_; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -607,7 +607,7 @@ namespace cppcms { | |||
uint32_t reserverd_ : 25; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
/// | |||
@@ -702,7 +702,7 @@ namespace cppcms { | |||
bool validate_charset_; | |||
size_t code_points_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
class CPPCMS_API base_html_input : virtual public base_widget { | |||
@@ -715,7 +715,7 @@ namespace cppcms { | |||
virtual void render_value(form_context &context) = 0; | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
std::string type_; | |||
}; | |||
@@ -757,7 +757,7 @@ namespace cppcms { | |||
private: | |||
int size_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
class CPPCMS_API textarea : public base_text | |||
@@ -789,7 +789,7 @@ namespace cppcms { | |||
int rows_,cols_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -972,7 +972,7 @@ namespace cppcms { | |||
virtual bool validate(); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
password *password_to_check_; | |||
}; | |||
@@ -1000,7 +1000,7 @@ namespace cppcms { | |||
private: | |||
util::regex const *expression_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
/// | |||
@@ -1016,7 +1016,7 @@ namespace cppcms { | |||
private: | |||
static util::regex const email_expression_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
/// | |||
@@ -1058,7 +1058,7 @@ namespace cppcms { | |||
virtual void load(http::context &context); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
std::string identification_; | |||
bool value_; | |||
}; | |||
@@ -1141,7 +1141,7 @@ namespace cppcms { | |||
virtual void clear(); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
struct element { | |||
element(); | |||
@@ -1200,14 +1200,14 @@ namespace cppcms { | |||
private: | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
}; | |||
std::vector<element> elements_; | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
int selected_; | |||
int default_selected_; | |||
@@ -1223,7 +1223,7 @@ namespace cppcms { | |||
virtual void render_input(form_context &context); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
class CPPCMS_API radio : public select_base { | |||
@@ -1239,7 +1239,7 @@ namespace cppcms { | |||
uint32_t reserved_ : 31; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -1267,7 +1267,7 @@ namespace cppcms { | |||
virtual void load(http::context &context); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
bool pressed_; | |||
locale::message value_; | |||
}; | |||
@@ -1,163 +0,0 @@ | |||
/////////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Copyright (C) 2008-2010 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU Lesser General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU Lesser General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU Lesser General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#ifndef CPPCMS_FUNCTION_H | |||
#define CPPCMS_FUNCTION_H | |||
#include "cppcms_error.h" | |||
#include "clone_ptr.h" | |||
namespace cppcms { | |||
template<typename Type> | |||
class function; | |||
class bad_function_call : public cppcms_error { | |||
public: | |||
bad_function_call() : | |||
cppcms_error("cppcms::bad_function_call") | |||
{ | |||
} | |||
}; | |||
#define CPPCMS_FUNCTION \ | |||
template<typename Result CPPCMS_TEMPLATE_PARAMS > \ | |||
class function<Result(CPPCMS_TYPE_PARAMS)> \ | |||
{ \ | |||
public: \ | |||
typedef Result result_type; \ | |||
struct callable { \ | |||
virtual Result call(CPPCMS_TYPE_PARAMS) =0; \ | |||
virtual callable *clone() const = 0; \ | |||
virtual ~callable(){} \ | |||
}; \ | |||
\ | |||
template<typename R,typename F> \ | |||
struct callable_impl : public callable { \ | |||
F func; \ | |||
callable_impl(F f) : func(f){} \ | |||
virtual R call(CPPCMS_TYPE_PARAMS) \ | |||
{ return func(CPPCMS_CALL_PARAMS); } \ | |||
virtual callable *clone() const \ | |||
{ return new callable_impl<R,F>(func); } \ | |||
}; \ | |||
template<typename F> \ | |||
struct callable_impl<void,F> : public callable { \ | |||
F func; \ | |||
callable_impl(F f) : func(f){} \ | |||
virtual void call(CPPCMS_TYPE_PARAMS) \ | |||
{ func(CPPCMS_CALL_PARAMS); } \ | |||
virtual callable *clone() const \ | |||
{ return new callable_impl<void,F>(func); } \ | |||
}; \ | |||
function(){} \ | |||
template<typename F> \ | |||
function(F func) : call_ptr(new callable_impl<Result,F>(func)) \ | |||
{} \ | |||
function(function const &other) : call_ptr(other.call_ptr) {} \ | |||
function const &operator=(function const &other) \ | |||
{ \ | |||
if(this != &other) { call_ptr=other.call_ptr; } \ | |||
return *this; \ | |||
} \ | |||
Result operator()(CPPCMS_TYPE_PARAMS) const \ | |||
{ \ | |||
if(!call_ptr.get()) throw bad_function_call(); \ | |||
return call_ptr->call(CPPCMS_CALL_PARAMS); \ | |||
} \ | |||
bool empty() const { return call_ptr.get()==0; } \ | |||
void swap(function &other) { call_ptr.swap(other.call_ptr); } \ | |||
private: \ | |||
util::clone_ptr<callable> call_ptr; \ | |||
}; \ | |||
#define CPPCMS_TEMPLATE_PARAMS | |||
#define CPPCMS_TYPE_PARAMS | |||
#define CPPCMS_CALL_PARAMS | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1 | |||
#define CPPCMS_TYPE_PARAMS P1 a1 | |||
#define CPPCMS_CALL_PARAMS a1 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2 | |||
#define CPPCMS_CALL_PARAMS a1,a2 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2,typename P3 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2,P3 a3 | |||
#define CPPCMS_CALL_PARAMS a1,a2,a3 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2,typename P3,typename P4 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2,P3 a3,P4 a4 | |||
#define CPPCMS_CALL_PARAMS a1,a2,a3,a4 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2,typename P3,typename P4,typename P5 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2,P3 a3,P4 a4,P5 a5 | |||
#define CPPCMS_CALL_PARAMS a1,a2,a3,a4,a5 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2,typename P3,typename P4,typename P5,typename P6 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2,P3 a3,P4 a4,P5 a5,P6 a6 | |||
#define CPPCMS_CALL_PARAMS a1,a2,a3,a4,a5,a6 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2,typename P3,typename P4,typename P5,typename P6,typename P7 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2,P3 a3,P4 a4,P5 a5,P6 a6,P7 a7 | |||
#define CPPCMS_CALL_PARAMS a1,a2,a3,a4,a5,a6,a7 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#define CPPCMS_TEMPLATE_PARAMS ,typename P1,typename P2,typename P3,typename P4,typename P5,typename P6,typename P7,typename P8 | |||
#define CPPCMS_TYPE_PARAMS P1 a1,P2 a2,P3 a3,P4 a4,P5 a5,P6 a6,P7 a7,P8 a8 | |||
#define CPPCMS_CALL_PARAMS a1,a2,a3,a4,a5,a6,a7,a8 | |||
CPPCMS_FUNCTION | |||
#undef CPPCMS_TEMPLATE_PARAMS | |||
#undef CPPCMS_TYPE_PARAMS | |||
#undef CPPCMS_CALL_PARAMS | |||
#undef CPPCMS_FUNCTION | |||
} // cppcms | |||
#endif |
@@ -1,63 +0,0 @@ | |||
/////////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Copyright (C) 2008-2010 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU Lesser General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU Lesser General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU Lesser General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#ifndef CPPCMS_UTIL_HOLD_PTR_H | |||
#define CPPCMS_UTIL_HOLD_PTR_H | |||
namespace cppcms { namespace util { | |||
/// | |||
/// \brief a smart pointer similar to std::auto_ptr but it is non-copyable and | |||
/// underlying object has same constness as the pointer itself (not like in ordinary pointer). | |||
/// | |||
template<typename T> | |||
class hold_ptr { | |||
T *ptr_; | |||
hold_ptr(hold_ptr const &other); // non copyable | |||
hold_ptr const &operator=(hold_ptr const &other); // non assignable | |||
public: | |||
hold_ptr() : ptr_(0) {} | |||
hold_ptr(T *v) : ptr_(v) {} | |||
~hold_ptr() | |||
{ | |||
if(ptr_) delete ptr_; | |||
} | |||
T const *get() const { return ptr_; } | |||
T *get() { return ptr_; } | |||
T const &operator *() const { return *ptr_; } | |||
T &operator *() { return *ptr_; } | |||
T const *operator->() const { return ptr_; } | |||
T *operator->() { return ptr_; } | |||
T *release() { T *tmp=ptr_; ptr_=0; return tmp; } | |||
void reset(T *p=0) | |||
{ | |||
if(ptr_) delete ptr_; | |||
ptr_=p; | |||
} | |||
void swap(hold_ptr &other) | |||
{ | |||
T *tmp=other.ptr_; | |||
other.ptr_=ptr_; | |||
ptr_=tmp; | |||
} | |||
}; | |||
} } // cppcms::util; | |||
#endif |
@@ -37,7 +37,7 @@ namespace cppcms { | |||
std::string response; | |||
std::vector<std::pair<std::string,std::string> > response_headers; | |||
void async_transfer(function<void(completion_status_type) const &handler,boost::asio::io_service &srv) | |||
void async_transfer(booster::function<void(completion_status_type) const &handler,boost::asio::io_service &srv) | |||
{ | |||
static const boost::regex r("^[hH][Tt][Tt][Pp]://([^:/]+)(:(\\d+))?(.*)$"); | |||
boost::cmatch match; | |||
@@ -102,7 +102,7 @@ namespace cppcms { | |||
/// Send request and get response asynchronously | |||
/// | |||
void async_transfer(function<void(completion_status_type)> const &handler); | |||
void async_transfer(booster::function<void(completion_status_type)> const &handler); | |||
/// | |||
/// Reset the object to initial state for reuse | |||
@@ -128,7 +128,7 @@ namespace cppcms { | |||
void check(); | |||
util::hold_ptr<http_client_impl> impl_; | |||
booster::hold_ptr<http_client_impl> impl_; | |||
}; | |||
} | |||
@@ -185,7 +185,7 @@ context::~context() | |||
{ | |||
} | |||
void context::async_on_peer_reset(function<void()> const &h) | |||
void context::async_on_peer_reset(booster::function<void()> const &h) | |||
{ | |||
// For some wired can't go without bind on SunCC | |||
conn_->aync_wait_for_close_by_peer(boost::bind(h)); | |||
@@ -20,10 +20,10 @@ | |||
#define CPPCMS_HTTP_CONTEXT_H | |||
#include "defs.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "intrusive_ptr.h" | |||
#include "refcounted.h" | |||
#include "function.h" | |||
#include <booster/function.h> | |||
#include <locale> | |||
namespace cppcms { | |||
@@ -136,7 +136,7 @@ namespace cppcms { | |||
operation_aborted ///< Asynchronous operation was canceled | |||
} complition_type; | |||
typedef function<void(complition_type)> handler; | |||
typedef booster::function<void(complition_type)> handler; | |||
/// | |||
/// Send all pending output data to the client and | |||
@@ -165,7 +165,7 @@ namespace cppcms { | |||
/// 2. If async_flush_output fails, this does not mean that | |||
/// this handler would be called as well, so you need to check both | |||
/// | |||
void async_on_peer_reset(function<void()> const &h); | |||
void async_on_peer_reset(booster::function<void()> const &h); | |||
private: | |||
void on_request_ready(bool error); | |||
static void dispatch(intrusive_ptr<application> app,std::string url,bool syncronous); | |||
@@ -173,7 +173,7 @@ namespace cppcms { | |||
intrusive_ptr<context> self(); | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
intrusive_ptr<impl::cgi::connection> conn_; | |||
}; | |||
@@ -20,7 +20,7 @@ | |||
#define CPPCMS_HTTP_COOKIE_H | |||
#include "defs.h" | |||
#include "copy_ptr.h" | |||
#include <booster/copy_ptr.h> | |||
#include <string> | |||
#include <iostream> | |||
@@ -131,7 +131,7 @@ private: | |||
void write(std::ostream &) const; | |||
// for future use | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
// real members | |||
std::string name_; | |||
@@ -20,7 +20,7 @@ | |||
#define CPPCMS_HTTP_FILE_H | |||
#include "defs.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "noncopyable.h" | |||
#include <sstream> | |||
#include <fstream> | |||
@@ -51,7 +51,7 @@ namespace cppcms { namespace http { | |||
uint32_t reserverd_ : 31; | |||
struct impl_data; // for future use | |||
util::hold_ptr<impl_data> d; | |||
booster::hold_ptr<impl_data> d; | |||
friend class request; | |||
}; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include <string> | |||
#include <map> | |||
@@ -126,7 +126,7 @@ namespace http { | |||
form_type post_; | |||
files_type files_; | |||
cookies_type cookies_; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
impl::cgi::connection *conn_; | |||
}; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include <string> | |||
#include <iostream> | |||
@@ -167,7 +167,7 @@ namespace http { | |||
std::string get_async_chunk(); | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
context &context_; | |||
std::ostream *stream_; | |||
@@ -20,7 +20,7 @@ | |||
#define CPPCMS_JSON_H | |||
#include "defs.h" | |||
#include "copy_ptr.h" | |||
#include <booster/copy_ptr.h> | |||
#include <vector> | |||
#include <map> | |||
@@ -261,7 +261,7 @@ namespace json { | |||
d.swap(other.d); | |||
} | |||
private: | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
} d; | |||
friend struct copyable; | |||
@@ -23,8 +23,8 @@ | |||
#include <iosfwd> | |||
#include <memory> | |||
#include "copy_ptr.h" | |||
#include "hold_ptr.h" | |||
#include <booster/copy_ptr.h> | |||
#include <booster/hold_ptr.h> | |||
#include "noncopyable.h" | |||
namespace cppcms { | |||
@@ -56,7 +56,7 @@ namespace cppcms { | |||
char const *module_; | |||
logger *log_; | |||
struct data; | |||
util::copy_ptr<data> d; | |||
booster::copy_ptr<data> d; | |||
std::auto_ptr<std::ostringstream> output_; | |||
}; | |||
@@ -85,7 +85,7 @@ namespace cppcms { | |||
private: | |||
static void init(std::auto_ptr<logger> &logger_ref); | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include <string> | |||
namespace cppcms { namespace util { | |||
@@ -64,7 +64,7 @@ namespace cppcms { namespace util { | |||
private: | |||
struct data; | |||
hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
/// | |||
@@ -85,7 +85,7 @@ namespace cppcms { namespace util { | |||
private: | |||
friend class regex; | |||
struct data; | |||
hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
}} // cppcms::util | |||
@@ -22,8 +22,9 @@ | |||
#include "application.h" | |||
#include "refcounted.h" | |||
#include "intrusive_ptr.h" | |||
#include "function.h" | |||
#include <booster/function.h> | |||
#include "json.h" | |||
#include "cppcms_error.h" | |||
namespace cppcms { | |||
namespace rpc { | |||
@@ -109,7 +110,7 @@ namespace rpc { | |||
bool notification_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
/// | |||
@@ -129,7 +130,7 @@ namespace rpc { | |||
/// | |||
/// Generic type of JSON-RPC method | |||
/// | |||
typedef function<void(json::array const &)> method_type; | |||
typedef booster::function<void(json::array const &)> method_type; | |||
/// | |||
/// Bind method JSON-RPC method with name \a name | |||
@@ -202,7 +203,7 @@ namespace rpc { | |||
std::string smd_; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -303,7 +303,7 @@ void service::shutdown() | |||
#endif | |||
} | |||
void service::after_fork(function<void()> const &cb) | |||
void service::after_fork(booster::function<void()> const &cb) | |||
{ | |||
impl_->on_fork_.push_back(cb); | |||
} | |||
@@ -596,7 +596,7 @@ cppcms::impl::service &service::impl() | |||
return *impl_; | |||
} | |||
void service::post(function<void()> const &handler) | |||
void service::post(booster::function<void()> const &handler) | |||
{ | |||
impl_->get_io_service().post(handler); | |||
} | |||
@@ -21,8 +21,8 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "hold_ptr.h" | |||
#include "function.h" | |||
#include <booster/hold_ptr.h> | |||
#include <booster/function.h> | |||
#include <locale> | |||
namespace booster { | |||
@@ -75,8 +75,8 @@ namespace cppcms { | |||
cppcms::impl::service &impl(); | |||
void post(function<void()> const &handler); | |||
void after_fork(function<void()> const &handler); | |||
void post(booster::function<void()> const &handler); | |||
void after_fork(booster::function<void()> const &handler); | |||
int threads_no(); | |||
int procs_no(); | |||
@@ -89,7 +89,7 @@ namespace cppcms { | |||
void start_acceptor(); | |||
void setup_exit_handling(); | |||
bool prefork(); | |||
util::hold_ptr<impl::service> impl_; | |||
booster::hold_ptr<impl::service> impl_; | |||
}; | |||
} // | |||
@@ -68,7 +68,7 @@ namespace impl { | |||
std::auto_ptr<session_pool> session_pool_; | |||
std::locale default_locale_; | |||
std::vector<function<void()> > on_fork_; | |||
std::vector<booster::function<void()> > on_fork_; | |||
int id_; | |||
@@ -19,7 +19,7 @@ | |||
#ifndef CPPCMS_SESSION_COOKIES_H | |||
#define CPPCMS_SESSION_COOKIES_H | |||
#include "session_api.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "noncopyable.h" | |||
#include <memory> | |||
#include <string> | |||
@@ -49,7 +49,7 @@ namespace sessions { | |||
virtual void clear(session_interface &); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
std::auto_ptr<encryptor> encryptor_; | |||
}; | |||
@@ -21,7 +21,7 @@ | |||
#include "session_api.h" | |||
#include "defs.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "intrusive_ptr.h" | |||
#include <memory> | |||
@@ -44,7 +44,7 @@ public: | |||
virtual void clear(session_interface &); | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
intrusive_ptr<session_cookies> client_; | |||
intrusive_ptr<session_sid> server_; | |||
size_t data_size_limit_; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "intrusive_ptr.h" | |||
#include "cstdint.h" | |||
#include <string> | |||
@@ -139,7 +139,7 @@ private: | |||
intrusive_ptr<session_api> storage_; | |||
struct data; | |||
util::hold_ptr<data> d; // for future use | |||
booster::hold_ptr<data> d; // for future use | |||
int cookie_age(); | |||
time_t session_age(); | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "intrusive_ptr.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "session_api.h" | |||
#include <memory> | |||
@@ -64,7 +64,7 @@ namespace cppcms { | |||
friend struct sid_factory; | |||
friend class gc_job; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
std::auto_ptr<session_api_factory> backend_; | |||
std::auto_ptr<sessions::encryptor_factory> encryptor_; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "session_storage.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include <pthread.h> | |||
#include <vector> | |||
@@ -54,7 +54,7 @@ namespace sessions { | |||
// members | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
void *memory_; | |||
std::string path_; | |||
@@ -21,7 +21,7 @@ | |||
#include "session_api.h" | |||
#include "defs.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "intrusive_ptr.h" | |||
#include "session_storage.h" | |||
@@ -43,7 +43,7 @@ namespace sessions { | |||
std::string key(std::string sid); | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
intrusive_ptr<session_storage> storage_; | |||
}; | |||
@@ -21,7 +21,7 @@ | |||
#include "defs.h" | |||
#include "session_storage.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include <vector> | |||
@@ -50,7 +50,7 @@ namespace sessions { | |||
// members | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
std::string path_; | |||
// friends | |||
@@ -23,7 +23,7 @@ | |||
#include "base_cache.h" | |||
#include "noncopyable.h" | |||
#include "intrusive_ptr.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
namespace cppcms { | |||
namespace impl { | |||
@@ -37,7 +37,7 @@ private: | |||
class session; | |||
class server; | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
} // impl | |||
@@ -1,89 +0,0 @@ | |||
/////////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Copyright (C) 2008-2010 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU Lesser General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU Lesser General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU Lesser General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#include "function.h" | |||
#include "test.h" | |||
#include <iostream> | |||
bool foov_called; | |||
void foov() { | |||
foov_called=true; | |||
} | |||
bool fooi_called; | |||
int fooi() | |||
{ | |||
fooi_called=true; | |||
return 10; | |||
} | |||
bool fooid_called; | |||
int fooid(double const &v) | |||
{ | |||
TEST(v==10.0); | |||
fooid_called = true; | |||
return 0; | |||
} | |||
int fooii(int &x) | |||
{ | |||
return x++; | |||
} | |||
void reset() | |||
{ | |||
foov_called = fooi_called = fooid_called = false; | |||
} | |||
int main() | |||
{ | |||
using cppcms::function; | |||
try { | |||
reset(); | |||
function<void()> f=foov; | |||
f(); | |||
TEST(foov_called); | |||
f=fooi; | |||
f(); | |||
TEST(fooi_called); | |||
function<int()> fi=fooi; | |||
TEST(fi()==10); | |||
TEST(!fi.empty()); | |||
function<void(int)> fvi; | |||
TEST(fvi.empty()); | |||
try { | |||
fvi(10); | |||
throw std::runtime_error("Not throws!"); | |||
} | |||
catch(cppcms::bad_function_call const &e) {} | |||
fvi=fooid; | |||
TEST(!fvi.empty()); | |||
fvi(10); | |||
TEST(fooid_called); | |||
int x=2; | |||
TEST(function<int(int&)>(fooii)(x)==2); | |||
TEST(x==3); | |||
} | |||
catch(std::exception const &e) | |||
{ | |||
std::cout << "Fail"<< e.what() << std::endl; | |||
return 1; | |||
} | |||
std::cout << "Ok" << std::endl; | |||
return 0; | |||
} |
@@ -52,7 +52,7 @@ namespace impl { | |||
} | |||
return false; | |||
} | |||
int post(function<void()> const &job) | |||
int post(booster::function<void()> const &job) | |||
{ | |||
booster::unique_lock<booster::mutex> lock(mutex_); | |||
int id=job_id_++; | |||
@@ -109,7 +109,7 @@ namespace impl { | |||
void worker() | |||
{ | |||
for(;;) { | |||
function<void()> job; | |||
booster::function<void()> job; | |||
{ | |||
booster::unique_lock<booster::mutex> lock(mutex_); | |||
@@ -135,7 +135,7 @@ namespace impl { | |||
bool shut_down_; | |||
int job_id_; | |||
typedef std::list<std::pair<int,function<void()> > > queue_type; | |||
typedef std::list<std::pair<int,booster::function<void()> > > queue_type; | |||
queue_type queue_; | |||
std::vector<boost::shared_ptr<booster::thread> > workers_; | |||
@@ -150,7 +150,7 @@ thread_pool::thread_pool(int n) : | |||
{ | |||
} | |||
int thread_pool::post(function<void()> const &job) | |||
int thread_pool::post(booster::function<void()> const &job) | |||
{ | |||
return impl_->post(job); | |||
} | |||
@@ -21,8 +21,8 @@ | |||
#include "defs.h" | |||
#include "noncopyable.h" | |||
#include "function.h" | |||
#include "hold_ptr.h" | |||
#include <booster/function.h> | |||
#include <booster/hold_ptr.h> | |||
namespace cppcms { | |||
@@ -33,7 +33,7 @@ namespace cppcms { | |||
class CPPCMS_API thread_pool : public util::noncopyable { | |||
public: | |||
int post(function<void()> const &job); | |||
int post(booster::function<void()> const &job); | |||
bool cancel(int id); | |||
thread_pool(int threads); | |||
void stop(); | |||
@@ -41,7 +41,7 @@ namespace cppcms { | |||
private: | |||
util::hold_ptr<impl::thread_pool> impl_; | |||
booster::hold_ptr<impl::thread_pool> impl_; | |||
}; | |||
@@ -20,7 +20,7 @@ | |||
#define CPPCMS_URANDOM_H | |||
#include "defs.h" | |||
#include "hold_ptr.h" | |||
#include <booster/hold_ptr.h> | |||
#include "noncopyable.h" | |||
namespace cppcms { | |||
@@ -33,7 +33,7 @@ namespace cppcms { | |||
private: | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
@@ -21,8 +21,8 @@ | |||
#include "noncopyable.h" | |||
#include "defs.h" | |||
#include "function.h" | |||
#include "hold_ptr.h" | |||
#include <booster/function.h> | |||
#include <booster/hold_ptr.h> | |||
#include "mem_bind.h" | |||
#include <string> | |||
#include <list> | |||
@@ -54,11 +54,11 @@ namespace cppcms { | |||
class CPPCMS_API url_dispatcher : public util::noncopyable { | |||
public: | |||
// Handlers | |||
typedef function<void()> handler; | |||
typedef function<void(std::string)> handler1; | |||
typedef function<void(std::string,std::string)> handler2; | |||
typedef function<void(std::string,std::string,std::string)> handler3; | |||
typedef function<void(std::string,std::string,std::string,std::string)> handler4; | |||
typedef booster::function<void()> handler; | |||
typedef booster::function<void(std::string)> handler1; | |||
typedef booster::function<void(std::string,std::string)> handler2; | |||
typedef booster::function<void(std::string,std::string,std::string)> handler3; | |||
typedef booster::function<void(std::string,std::string,std::string,std::string)> handler4; | |||
/// | |||
/// Assign \a handler to pattern \a regex thus if URL that matches | |||
@@ -160,7 +160,7 @@ namespace cppcms { | |||
void mount(std::string match,application &app,int part); | |||
struct data; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
} // cppcms | |||
@@ -65,7 +65,7 @@ namespace cppcms { | |||
struct data; | |||
struct skin; | |||
util::hold_ptr<data> d; | |||
booster::hold_ptr<data> d; | |||
}; | |||
} | |||