application.h | application.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
namespace booster { | namespace booster { | |||
void CPPCMS_API intrusive_ptr_add_ref(cppcms::application *p); | void CPPCMS_API intrusive_ptr_add_ref(cppcms::application *p); | |||
void CPPCMS_API intrusive_ptr_release(cppcms::application *p); | void CPPCMS_API intrusive_ptr_release(cppcms::application *p); | |||
} | } | |||
namespace cppcms { | namespace cppcms { | |||
class service; | class service; | |||
class url_dispatcher; | class url_dispatcher; | |||
class url_mapper; | ||||
class applications_pool; | class applications_pool; | |||
class application; | class application; | |||
class base_content; | class base_content; | |||
class cache_interface; | class cache_interface; | |||
class session_interface; | class session_interface; | |||
namespace http { | namespace http { | |||
class request; | class request; | |||
class response; | class response; | |||
class context; | class context; | |||
} | } | |||
namespace json { | namespace json { | |||
class value; | class value; | |||
} | } | |||
namespace filters { | ||||
class streamable; | ||||
} | ||||
/// | /// | |||
/// \brief application class is the base class for all user created applications. | /// \brief application class is the base class for all user created applications. | |||
/// | /// | |||
/// This class is the base for all user actions required for web pag e generation. | /// This class is the base for all user actions required for web pag e generation. | |||
/// User application classes are created upon web page request and t hen cached in \a application_pool. | /// User application classes are created upon web page request and t hen cached in \a application_pool. | |||
/// | /// | |||
/// Applications can be bundled to hierarchies. You may add a sub ap plication to hierarchy, | /// Applications can be bundled to hierarchies. You may add a sub ap plication to hierarchy, | |||
/// and they will always be connected with topmost application and t heir lifetime would be binded to them. | /// and they will always be connected with topmost application and t heir lifetime would be binded to them. | |||
/// | /// | |||
skipping to change at line 125 | skipping to change at line 129 | |||
/// | /// | |||
http::request &request(); | http::request &request(); | |||
/// | /// | |||
/// Get a HTTP response information class, same as context() .response(); | /// Get a HTTP response information class, same as context() .response(); | |||
/// | /// | |||
http::response &response(); | http::response &response(); | |||
/// | /// | |||
/// Get a dispatched class -- class that responsible on mapp ing between URLs and a member | /// Get a dispatched class -- class that responsible on mapp ing between URLs and a member | |||
/// functions of application class. This member function is | /// functions of application class. | |||
application specific and not | /// | |||
/// This member function is application specific and not | ||||
/// Connection specific. | /// Connection specific. | |||
/// | /// | |||
url_dispatcher &dispatcher(); | url_dispatcher &dispatcher(); | |||
/// | /// | |||
/// Get a url_mapper class -- class that responsible on mapp | ||||
ing between real objects and | ||||
/// urls displayer on the page. | ||||
/// | ||||
/// This member function is application specific and not | ||||
/// Connection specific. | ||||
/// | ||||
url_mapper &mapper(); | ||||
/// | ||||
/// Get a cache_interface instance. Same as context().cache( ); | /// Get a cache_interface instance. Same as context().cache( ); | |||
/// | /// | |||
cache_interface &cache(); | cache_interface &cache(); | |||
/// | /// | |||
/// Get current session_interface instance. Same as context( ).session(); | /// Get current session_interface instance. Same as context( ).session(); | |||
/// | /// | |||
session_interface &session(); | session_interface &session(); | |||
/// | /// | |||
skipping to change at line 178 | skipping to change at line 193 | |||
/// | /// | |||
void render(std::string skin,std::string template_name,std:: ostream &out,base_content &content); | void render(std::string skin,std::string template_name,std:: ostream &out,base_content &content); | |||
/// | /// | |||
/// Register an application \a app as child. Ownership of ap p is not transfered to parent, however | /// Register an application \a app as child. Ownership of ap p is not transfered to parent, however | |||
/// it would shared it's parent reference count. | /// it would shared it's parent reference count. | |||
/// | /// | |||
void add(application &app); | void add(application &app); | |||
/// | /// | |||
/// Register an application \a app as child. Ownership of ap | /// Register an application \a app as child and mount it int | |||
p is not transfered to parent, however | o url dispatched calling | |||
/// dispatcher().mount(regex,app,part); | ||||
/// | ||||
/// Ownership of app is not transfered to parent, however | ||||
/// it would shared it's parent reference count. | /// it would shared it's parent reference count. | |||
/// | /// | |||
/// All URL that match regular expression \a regex would be | ||||
passed to the child for match. Matched part | ||||
/// \a part would be used by child for matching. | ||||
/// | /// | |||
/// For example: | void add(application &app,std::string const ®ex,int part) | |||
; | ||||
/// | /// | |||
/// \code | /// Register an application \a app as child and mount it int | |||
/// add(users,"^/users(.*)$",1") | o: | |||
/// \endcode | ||||
/// | /// | |||
/// For URL /users/moshe would pass only "/moshe" to URL dis | /// - url_dispatcher calling dispatcher().mount(regex,app,pa | |||
patched of \a users object | rt); | |||
/// - url_mapper calling mapper().mount(name,url,app); | ||||
/// | /// | |||
void add(application &app,std::string regex,int part); | /// Ownership of app is not transfered to parent, however | |||
/// it would shared it's parent reference count. | ||||
/// | ||||
/// | ||||
void add(application &app,std::string const &name,std::strin | ||||
g const &url,std::string const ®ex,int part); | ||||
/// | ||||
/// Register an application \a app as child and mount it int | ||||
o | ||||
/// url_mapper calling mapper().mount(name,url,app); | ||||
/// | ||||
/// Ownership of app is not transfered to parent, however | ||||
/// it would shared it's parent reference count. | ||||
/// | ||||
/// | ||||
void add(application &app,std::string const &name,std::strin | ||||
g const &url); | ||||
/// | /// | |||
/// Register an application \a app as child. Ownership of ap p is transfered to parent | /// Register an application \a app as child. Ownership of ap p is transfered to parent | |||
/// | /// | |||
void attach(application *app); | void attach(application *app); | |||
/// | /// | |||
/// Register an application \a app as child. Ownership of ap | /// Register an application \a app as child and mount it int | |||
p is transfered to parent | o | |||
/// url_dispatcher calling dispatcher().mount(regex,*app,par | ||||
t); | ||||
/// | /// | |||
/// All URL that match regular expression \a regex would be | /// Ownership of app is transfered to parent. | |||
passed to the child for match. Matched part | ||||
/// \a part would be used by child for matching. | ||||
/// | /// | |||
/// For example: | void attach(application *app,std::string const ®ex,int pa rt); | |||
/// | /// | |||
/// \code | /// Register an application \a app as child and mount it int | |||
/// add(users,"^/users(.*)$",1") | o | |||
/// \endcode | /// url_mapper calling mapper().mount(name,url,*app); | |||
/// | /// | |||
/// For URL /users/moshe would pass only "/moshe" to URL dis patched of \a users object | /// Ownership of app is transfered to parent. | |||
/// | /// | |||
void attach(application *app,std::string regex,int part); | void attach(application *app,std::string const &name,std::st | |||
ring const &url); | ||||
/// | ||||
/// Register an application \a app as child and mount it int | ||||
o: | ||||
/// | ||||
/// - url_dispatcher calling dispatcher().mount(regex,*app,p | ||||
art); | ||||
/// - url_mapper calling mapper().mount(name,url,*app); | ||||
/// | ||||
/// Ownership of app is transfered to parent. | ||||
/// | ||||
void attach(application *app,std::string const &name,std::st | ||||
ring const &url,std::string const ®ex,int part); | ||||
/// | /// | |||
/// Get the parent of the application, if the application is the topmost class in hierarchy, | /// Get the parent of the application, if the application is the topmost class in hierarchy, | |||
/// it would return \a this, So, if you want to check if the application has any parent test | /// it would return \a this, So, if you want to check if the application has any parent test | |||
/// app->parent()!=app; | /// app->parent()!=app; | |||
/// | /// | |||
application *parent(); | application *parent(); | |||
/// | /// | |||
/// Get the root application of the hierarchy. Note, if the application is the topmost one, | /// Get the root application of the hierarchy. Note, if the application is the topmost one, | |||
skipping to change at line 263 | skipping to change at line 300 | |||
/// This is main function of the application that is called when it is matched | /// This is main function of the application that is called when it is matched | |||
/// according to the regular expression in the applications_ pool class. | /// according to the regular expression in the applications_ pool class. | |||
/// | /// | |||
/// By default, main calls dispatcher().dispatch(url). And i f the last fails, it | /// By default, main calls dispatcher().dispatch(url). And i f the last fails, it | |||
/// creates 404 Error page. This allows developers to create its own hooks for | /// creates 404 Error page. This allows developers to create its own hooks for | |||
/// reaction on incoming URL as, initialization and cleanup of general resources, | /// reaction on incoming URL as, initialization and cleanup of general resources, | |||
/// Custom 404 and error handlers etc. | /// Custom 404 and error handlers etc. | |||
/// | /// | |||
virtual void main(std::string url); | virtual void main(std::string url); | |||
/// | ||||
/// This member function called when URL is dispatched to th | ||||
is application, it is | ||||
/// useful when member functions of applications are called, | ||||
by default does nothing | ||||
/// | ||||
virtual void init(); | ||||
/// | ||||
/// This function is used for cleanup unused stuff, it shoul | ||||
d not throw | ||||
/// | ||||
virtual void clear(); | ||||
/// | ||||
/// Translate a message in current locale for given \a messa | ||||
ge in \a context | ||||
/// | ||||
std::string translate(char const *context,char const *messag | ||||
e); | ||||
/// | ||||
/// Translate a message in current locale for given \a messa | ||||
ge | ||||
/// | ||||
std::string translate(char const *message); | ||||
/// | ||||
/// Translate a message in current locale for given \a singl | ||||
e and \a plural form for number \a n in \a context. | ||||
/// | ||||
std::string translate(char const *context,char const *single | ||||
,char const *plural,int n); | ||||
/// | ||||
/// Translate a message in current locale for given \a singl | ||||
e and \a plural form for number \a n | ||||
/// | ||||
std::string translate(char const *single,char const *plural, | ||||
int n); | ||||
/// | ||||
/// Map url-key \a key to actual URL, without parameters | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key); | ||||
/// | ||||
/// Map url-key \a key to actual URL, with parameter p1 | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key, | ||||
filters::streamable const &p1); | ||||
/// | ||||
/// Map url-key \a key to actual URL, with parameters p1, p2 | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key, | ||||
filters::streamable const &p1, | ||||
filters::streamable const &p2); | ||||
/// | ||||
/// Map url-key \a key to actual URL, with parameters p1, p2 | ||||
, p3 | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key, | ||||
filters::streamable const &p1, | ||||
filters::streamable const &p2, | ||||
filters::streamable const &p3); | ||||
/// | ||||
/// Map url-key \a key to actual URL, with parameters p1, p2 | ||||
, p3, p4 | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key, | ||||
filters::streamable const &p1, | ||||
filters::streamable const &p2, | ||||
filters::streamable const &p3, | ||||
filters::streamable const &p4); | ||||
/// | ||||
/// Map url-key \a key to actual URL, with parameters p1, p2 | ||||
, p3, p4, p5 | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key, | ||||
filters::streamable const &p1, | ||||
filters::streamable const &p2, | ||||
filters::streamable const &p3, | ||||
filters::streamable const &p4, | ||||
filters::streamable const &p5); | ||||
/// | ||||
/// Map url-key \a key to actual URL, with parameters p1, p2 | ||||
, p3, p4, p5, p6 | ||||
/// | ||||
/// Effectively it calls mapper().map(...) | ||||
/// | ||||
std::string url(std::string const &key, | ||||
filters::streamable const &p1, | ||||
filters::streamable const &p2, | ||||
filters::streamable const &p3, | ||||
filters::streamable const &p4, | ||||
filters::streamable const &p5, | ||||
filters::streamable const &p6); | ||||
private: | private: | |||
void recycle(); | void recycle(); | |||
void parent(application *parent); | void parent(application *parent); | |||
void pool_id(int id); | void pool_id(int id); | |||
int pool_id(); | int pool_id(); | |||
struct _data; // future use | struct _data; // future use | |||
booster::hold_ptr<_data> d; | booster::hold_ptr<_data> d; | |||
End of changes. 17 change blocks. | ||||
25 lines changed or deleted | 181 lines changed or added | |||
base_content.h | base_content.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
// GNU Lesser General Public License for more details. | // GNU Lesser General Public License for more details. | |||
// | // | |||
// You should have received a copy of the GNU Lesser General Public Licens e | // You should have received a copy of the GNU Lesser General Public Licens e | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | // along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | // | |||
/////////////////////////////////////////////////////////////////////////// //// | /////////////////////////////////////////////////////////////////////////// //// | |||
#ifndef CPPCMS_BASE_CONTENT_H | #ifndef CPPCMS_BASE_CONTENT_H | |||
#define CPPCMS_BASE_CONTENT_H | #define CPPCMS_BASE_CONTENT_H | |||
#include <cppcms/defs.h> | #include <cppcms/defs.h> | |||
#include <booster/copy_ptr.h> | ||||
namespace cppcms { | namespace cppcms { | |||
class application; | ||||
/// | /// | |||
/// \brief This is a simple polymorphic class that every content for templates rendering should be derided from it. | /// \brief This is a simple polymorphic class that every content for templates rendering should be derided from it. | |||
/// It does not carry much information with exception of RTTI that a llows type-safe casting of user provided | /// It does not carry much information with exception of RTTI that a llows type-safe casting of user provided | |||
/// content instances to target content class that is used by specif ic template. | /// content instances to target content class that is used by specif ic template. | |||
/// | /// | |||
class CPPCMS_API base_content { | class CPPCMS_API base_content { | |||
public: | public: | |||
virtual ~base_content() {}; | ||||
base_content(); | ||||
base_content(base_content const &); | ||||
base_content const &operator=(base_content const &); | ||||
virtual ~base_content(); | ||||
/// | ||||
/// Get the application that renders current | ||||
/// content, throw cppcms_error if the application was not s | ||||
et | ||||
/// | ||||
application &app(); | ||||
/// | ||||
/// Set the application that renders current | ||||
/// | ||||
/// Called automatically by application::render | ||||
/// | ||||
void app(application &app); | ||||
/// | ||||
/// Resets the application | ||||
/// | ||||
void reset_app(); | ||||
private: | ||||
struct _data; | ||||
booster::copy_ptr<_data> d; | ||||
application *app_; | ||||
}; | }; | |||
} | } | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 32 lines changed or added | |||
boundary.h | boundary.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_BOUNDARY_H_INCLUDED | #ifndef BOOSTER_LOCALE_BOUNDARY_H_INCLUDED | |||
#define BOOSTER_LOCALE_BOUNDARY_H_INCLUDED | #define BOOSTER_LOCALE_BOUNDARY_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#include <booster/cstdint.h> | #include <booster/cstdint.h> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
cache_interface.h | cache_interface.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
namespace cppcms { | namespace cppcms { | |||
namespace impl { | namespace impl { | |||
class base_cache; | class base_cache; | |||
} | } | |||
namespace http { | namespace http { | |||
class context; | class context; | |||
}; | }; | |||
class cache_interface; | ||||
/// | ||||
/// \brief triggers_recorder is a class that allows you to record al | ||||
l triggers added in certain scope. | ||||
/// | ||||
/// It is useful to have have "sub-dependencies" for smaller parts. | ||||
/// | ||||
/// For example: | ||||
/// | ||||
/// \code | ||||
/// | ||||
/// if(cache().fetch_page("news")) | ||||
/// return; | ||||
/// // something there | ||||
/// if(cache().fetch_frame("politics",text)) | ||||
/// response().out() << text; | ||||
/// else { | ||||
/// copy_filter politics(respone().out()); | ||||
/// triggers_recorder politics_triggers(cache()); | ||||
/// // some thing else there | ||||
/// for(int i=0;i<articles.size();i++) { | ||||
/// if(cache().fetch_frame(article_tag,text); | ||||
/// response().out() << text; | ||||
/// else { | ||||
/// copy_filter article(respone().out()); | ||||
/// // generate article | ||||
/// cache().store_frame(article_tag,article.detach()); | ||||
/// } | ||||
/// } | ||||
/// cache().store_frame("polotics", | ||||
/// politics.detach(), // the recorded content of | ||||
politics | ||||
/// politics_triggers.detach()); | ||||
/// } | ||||
/// ... | ||||
/// \endcode | ||||
/// | ||||
/// So tag "politics" records all added triggers like "article_234" | ||||
and | ||||
/// now rise of "article_234" would invalidate "politics" section as | ||||
well | ||||
/// as we automatically record all triggers inserted in triggers_rec | ||||
order scope. | ||||
/// | ||||
/// | ||||
class CPPCMS_API triggers_recorder : public booster::noncopyable { | ||||
public: | ||||
/// | ||||
/// Start recording all triggers | ||||
/// | ||||
triggers_recorder(cache_interface &); | ||||
/// | ||||
/// Stop recording triggers | ||||
/// | ||||
~triggers_recorder(); | ||||
/// | ||||
/// Stop recording triggers and get the set of all triggers | ||||
/// being added in its scope | ||||
/// | ||||
std::set<std::string> detach(); | ||||
private: | ||||
friend class cache_interface; | ||||
void add(std::string const &t); | ||||
struct data; | ||||
booster::hold_ptr<data> d; | ||||
std::set<std::string> triggers_; | ||||
cache_interface *cache_; | ||||
}; | ||||
/// | /// | |||
/// \brief This class is the major gateway of the application to Cpp CMS caching abilities. Any access too cache | /// \brief This class is the major gateway of the application to Cpp CMS caching abilities. Any access too cache | |||
/// would be done via this class. | /// would be done via this class. | |||
/// | /// | |||
/// CppCMS cache model supports following concepts: | /// CppCMS cache model supports following concepts: | |||
/// | /// | |||
/// - \a key the unique identification of the object in cache | /// - \a key the unique identification of the object in cache | |||
/// - \a timeout -- the maximal time the cached object remains valid | /// - \a timeout -- the maximal time the cached object remains valid | |||
/// - \a trigger -- special key that allows fast invalidation of mul tiple cache objects. | /// - \a trigger -- special key that allows fast invalidation of mul tiple cache objects. | |||
/// | /// | |||
skipping to change at line 256 | skipping to change at line 321 | |||
/// | /// | |||
template<typename Serializable> | template<typename Serializable> | |||
void store_data(std::string const &key,Serializable const &d ata,int timeout,bool notriggers=false) | void store_data(std::string const &key,Serializable const &d ata,int timeout,bool notriggers=false) | |||
{ | { | |||
store_data<Serializable>(key,data,std::set<std::stri ng>(),timeout,notriggers); | store_data<Serializable>(key,data,std::set<std::stri ng>(),timeout,notriggers); | |||
} | } | |||
private: | private: | |||
friend class triggers_recorder; | ||||
void add_triggers_recorder(triggers_recorder *rec); | ||||
void remove_triggers_recorder(triggers_recorder *rec); | ||||
void store( std::string const &key, | void store( std::string const &key, | |||
std::string const &data, | std::string const &data, | |||
std::set<std::string> const &triggers, | std::set<std::string> const &triggers, | |||
int timeout, | int timeout, | |||
bool notriggers); | bool notriggers); | |||
bool fetch( std::string const &key, | bool fetch( std::string const &key, | |||
std::string &buffer, | std::string &buffer, | |||
bool notriggers); | bool notriggers); | |||
struct _data; | struct _data; | |||
booster::hold_ptr<_data> d; | booster::hold_ptr<_data> d; | |||
http::context *context_; | http::context *context_; | |||
std::set<std::string> triggers_; | std::set<std::string> triggers_; | |||
std::set<triggers_recorder *> recorders_; | ||||
booster::intrusive_ptr<impl::base_cache> cache_module_; | booster::intrusive_ptr<impl::base_cache> cache_module_; | |||
uint32_t page_compression_used_ : 1; | uint32_t page_compression_used_ : 1; | |||
uint32_t reserved : 31; | uint32_t reserved : 31; | |||
}; | }; | |||
} | } | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 76 lines changed or added | |||
collator.h | collator.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_COLLATOR_H_INCLUDED | #ifndef BOOSTER_LOCALE_COLLATOR_H_INCLUDED | |||
#define BOOSTER_LOCALE_COLLATOR_H_INCLUDED | #define BOOSTER_LOCALE_COLLATOR_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
conversion.h | conversion.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_CONVERTER_H_INCLUDED | #ifndef BOOSTER_LOCALE_CONVERTER_H_INCLUDED | |||
#define BOOSTER_LOCALE_CONVERTER_H_INCLUDED | #define BOOSTER_LOCALE_CONVERTER_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
cstdio.h | cstdio.h | |||
---|---|---|---|---|
#ifndef CPPCMS_NOWIDE_CSTDIO_H | #ifndef CPPCMS_NOWIDE_CSTDIO_H | |||
#define CPPCMS_NOWIDE_CSTDIO_H | #define CPPCMS_NOWIDE_CSTDIO_H | |||
#include <cstdio> | #include <cstdio> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#include <booster/nowide/convert.h> | #include <booster/nowide/convert.h> | |||
#include <booster/config.h> | ||||
#ifdef BOOSTER_MSVC | ||||
# pragma warning(push) | ||||
# pragma warning(disable : 4996) | ||||
#endif | ||||
namespace booster { | namespace booster { | |||
namespace nowide { | namespace nowide { | |||
#ifndef BOOSTER_WIN_NATIVE | #ifndef BOOSTER_WIN_NATIVE | |||
using std::fopen; | using std::fopen; | |||
using std::freopen; | using std::freopen; | |||
using std::remove; | using std::remove; | |||
using std::rename; | using std::rename; | |||
#endif | #endif | |||
#if defined(BOOSTER_WIN_NATIVE) || defined(BOOSTER_DOXYGEN_DOCS) | #if defined(BOOSTER_WIN_NATIVE) || defined(BOOSTER_DOXYGEN_DOCS) | |||
/// | /// | |||
/// Same as C fopen, but accepts UTF-8 string as file name u nder Windows | /// Same as C fopen, but accepts UTF-8 string as file name u nder Windows | |||
/// | /// | |||
inline FILE *fopen(char const *file_name,char const *mode) | inline FILE *fopen(char const *file_name,char const *mode) | |||
{ | { | |||
try { | try { | |||
return _wfopen(convert(file_name).c_str(),co nvert(mode).c_str()); | return _wfopen(convert(file_name).c_str(),co nvert(mode).c_str()); | |||
} | } | |||
catch(bad_utf const &e) { | catch(bad_utf const &) { | |||
return 0; | return 0; | |||
} | } | |||
} | } | |||
/// | /// | |||
/// Same as C freopen, but accepts UTF-8 string as file name under Windows | /// Same as C freopen, but accepts UTF-8 string as file name under Windows | |||
/// | /// | |||
inline FILE *freopen(char const *file_name,char const *mode, FILE *stream) | inline FILE *freopen(char const *file_name,char const *mode, FILE *stream) | |||
{ | { | |||
try { | try { | |||
return _wfreopen(convert(file_name).c_str(), convert(mode).c_str(),stream); | return _wfreopen(convert(file_name).c_str(), convert(mode).c_str(),stream); | |||
} | } | |||
catch(bad_utf const &e) { | catch(bad_utf const &) { | |||
return 0; | return 0; | |||
} | } | |||
} | } | |||
/// | /// | |||
/// Same as C rename, but accepts UTF-8 strings as file name s under Windows | /// Same as C rename, but accepts UTF-8 strings as file name s under Windows | |||
/// | /// | |||
inline int rename(char const *old_name,char const *new_name) | inline int rename(char const *old_name,char const *new_name) | |||
{ | { | |||
try { | try { | |||
return _wrename(convert(old_name).c_str(),co nvert(new_name).c_str()); | return _wrename(convert(old_name).c_str(),co nvert(new_name).c_str()); | |||
} | } | |||
catch(bad_utf const &e) { | catch(bad_utf const &) { | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
/// | /// | |||
/// Same as C remove, but accepts UTF-8 string as file name under Windows | /// Same as C remove, but accepts UTF-8 string as file name under Windows | |||
/// | /// | |||
inline int remove(char const *name) | inline int remove(char const *name) | |||
{ | { | |||
try { | try { | |||
return _wremove(convert(name).c_str()); | return _wremove(convert(name).c_str()); | |||
} | } | |||
catch(bad_utf const &e) { | catch(bad_utf const &) { | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
#endif | #endif | |||
} // nowide | } // nowide | |||
} // booster | } // booster | |||
#ifdef BOOSTER_MSVC | ||||
#pragma warning(pop) | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 14 lines changed or added | |||
date_time.h | date_time.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_DATE_TIME_H_INCLUDED | #ifndef BOOSTER_LOCALE_DATE_TIME_H_INCLUDED | |||
#define BOOSTER_LOCALE_DATE_TIME_H_INCLUDED | #define BOOSTER_LOCALE_DATE_TIME_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
skipping to change at line 155 | skipping to change at line 155 | |||
static const date_time_period saturday(day_of_week,7); | static const date_time_period saturday(day_of_week,7); | |||
/// | /// | |||
/// Predefined constant for AM (Ante Meridiem) | /// Predefined constant for AM (Ante Meridiem) | |||
/// | /// | |||
static const date_time_period am(am_pm,0); | static const date_time_period am(am_pm,0); | |||
/// | /// | |||
/// Predefined constant for PM (Post Meridiem) | /// Predefined constant for PM (Post Meridiem) | |||
/// | /// | |||
static const date_time_period pm(am_pm,1); | static const date_time_period pm(am_pm,1); | |||
} // period | /// | |||
/// convers period_type to date_time_period(f,1) | ||||
/// | ||||
inline date_time_period operator+(period::period_type f) | ||||
{ | ||||
return date_time_period(f); | ||||
} | ||||
/// | ||||
/// convers period_type to date_time_period(f,-1) | ||||
/// | ||||
inline date_time_period operator-(period::period_type f) | ||||
{ | ||||
return date_time_period(f,-1); | ||||
} | ||||
/// | /// | |||
/// convers period_type to date_time_period(f,1) | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator+(period::period_type f) | inline date_time_period operator*(period::period_type f,char v) | |||
{ | { | |||
return date_time_period(f); | return date_time_period(f,v); | |||
} | } | |||
/// | ||||
/// convers period_type to date_time_period(f,-1) | ||||
/// | ||||
inline date_time_period operator-(period::period_type f) | ||||
{ | ||||
return date_time_period(f,-1); | ||||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,char v) | inline date_time_period operator*(char v,period::period_type f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(char v,period::period_type f) | inline date_time_period operator*(char v,date_time_period f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(char v,date_time_period f) | inline date_time_period operator*(date_time_period f,char v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,char v) | inline date_time_period operator*(period::period_type f,short i | |||
{ | nt v) | |||
return date_time_period(f.type,f.value*v); | { | |||
} | return date_time_period(f,v); | |||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,short int v | inline date_time_period operator*(short int v,period::period_ty | |||
) | pe f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(short int v,period::period_type f | inline date_time_period operator*(short int v,date_time_period | |||
) | f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(short int v,date_time_period f) | inline date_time_period operator*(date_time_period f,short int | |||
{ | v) | |||
return date_time_period(f.type,f.value*v); | { | |||
} | return date_time_period(f.type,f.value*v); | |||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,short int v) | inline date_time_period operator*(period::period_type f,int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,int v) | inline date_time_period operator*(int v,period::period_type f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(int v,period::period_type f) | inline date_time_period operator*(int v,date_time_period f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(int v,date_time_period f) | inline date_time_period operator*(date_time_period f,int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,int v) | inline date_time_period operator*(period::period_type f,long in | |||
{ | t v) | |||
return date_time_period(f.type,f.value*v); | { | |||
} | return date_time_period(f,v); | |||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,long int v) | inline date_time_period operator*(long int v,period::period_typ | |||
{ | e f) | |||
return date_time_period(f,v); | { | |||
} | return date_time_period(f,v); | |||
} | ||||
/// | ||||
/// Create date_time_period of type \a f with value \a v. | ||||
/// | ||||
inline date_time_period operator*(long int v,date_time_period f | ||||
) | ||||
{ | ||||
return date_time_period(f.type,f.value*v); | ||||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(long int v,period::period_type f) | inline date_time_period operator*(date_time_period f,long int v | |||
{ | ) | |||
return date_time_period(f,v); | { | |||
} | return date_time_period(f.type,f.value*v); | |||
/// | } | |||
/// Create date_time_period of type \a f with value \a v. | ||||
/// | ||||
inline date_time_period operator*(long int v,date_time_period f) | ||||
{ | ||||
return date_time_period(f.type,f.value*v); | ||||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,long int v) | inline date_time_period operator*(period::period_type f,unsigne | |||
{ | d char v) | |||
return date_time_period(f.type,f.value*v); | { | |||
} | return date_time_period(f,v); | |||
} | ||||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,unsigned ch | inline date_time_period operator*(unsigned char v,period::perio | |||
ar v) | d_type f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned char v,period::period_ty | inline date_time_period operator*(unsigned char v,date_time_per | |||
pe f) | iod f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned char v,date_time_period | inline date_time_period operator*(date_time_period f,unsigned c | |||
f) | har v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,unsigned char | inline date_time_period operator*(period::period_type f,unsigne | |||
v) | d short int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,unsigned sh | inline date_time_period operator*(unsigned short int v,period:: | |||
ort int v) | period_type f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned short int v,period::peri | inline date_time_period operator*(unsigned short int v,date_tim | |||
od_type f) | e_period f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned short int v,date_time_pe | inline date_time_period operator*(date_time_period f,unsigned s | |||
riod f) | hort int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,unsigned short | inline date_time_period operator*(period::period_type f,unsigne | |||
int v) | d int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,unsigned in | inline date_time_period operator*(unsigned int v,period::period | |||
t v) | _type f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned int v,period::period_typ | inline date_time_period operator*(unsigned int v,date_time_peri | |||
e f) | od f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned int v,date_time_period f | inline date_time_period operator*(date_time_period f,unsigned i | |||
) | nt v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(date_time_period f,unsigned int v | inline date_time_period operator*(period::period_type f,unsigne | |||
) | d long int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(period::period_type f,unsigned lo | inline date_time_period operator*(unsigned long int v,period::p | |||
ng int v) | eriod_type f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f,v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned long int v,period::perio | inline date_time_period operator*(unsigned long int v,date_time | |||
d_type f) | _period f) | |||
{ | { | |||
return date_time_period(f,v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | /// | |||
/// Create date_time_period of type \a f with value \a v. | /// Create date_time_period of type \a f with value \a v. | |||
/// | /// | |||
inline date_time_period operator*(unsigned long int v,date_time_per | inline date_time_period operator*(date_time_period f,unsigned l | |||
iod f) | ong int v) | |||
{ | { | |||
return date_time_period(f.type,f.value*v); | return date_time_period(f.type,f.value*v); | |||
} | } | |||
/// | } // period | |||
/// Create date_time_period of type \a f with value \a v. | ||||
/// | ||||
inline date_time_period operator*(date_time_period f,unsigned long | ||||
int v) | ||||
{ | ||||
return date_time_period(f.type,f.value*v); | ||||
} | ||||
/// | /// | |||
/// \brief this class that represents a set of periods, | /// \brief this class that represents a set of periods, | |||
/// | /// | |||
/// It is generally created by operations on periods: | /// It is generally created by operations on periods: | |||
/// 1995*year + 3*month + 1*day. Note: operations are not commutati ve. | /// 1995*year + 3*month + 1*day. Note: operations are not commutati ve. | |||
/// | /// | |||
class date_time_period_set { | class date_time_period_set { | |||
public: | public: | |||
skipping to change at line 888 | skipping to change at line 888 | |||
/// | /// | |||
/// Get minimal possible value for current time point for a per iod \a f. | /// Get minimal possible value for current time point for a per iod \a f. | |||
/// | /// | |||
int minimum(period::period_type f) const; | int minimum(period::period_type f) const; | |||
/// | /// | |||
/// Get minimal possible value for current time point for a per iod \a f. For example | /// Get minimal possible value for current time point for a per iod \a f. For example | |||
/// in February maximum(day) may be 28 or 29, in January maximu m(day)==31 | /// in February maximum(day) may be 28 or 29, in January maximu m(day)==31 | |||
/// | /// | |||
int maximum(period::period_type f) const; | int maximum(period::period_type f) const; | |||
/// | ||||
/// Check if the current time is in daylight saving time | ||||
/// | ||||
bool is_in_daylight_saving_time() const; | ||||
private: | private: | |||
hold_ptr<abstract_calendar> impl_; | hold_ptr<abstract_calendar> impl_; | |||
}; | }; | |||
/// | /// | |||
/// Writes date_time \a t to output stream \a out. | /// Writes date_time \a t to output stream \a out. | |||
/// | /// | |||
/// This function uses locale, calendar and time zone of the target stream \a in. | /// This function uses locale, calendar and time zone of the target stream \a in. | |||
/// | /// | |||
/// For example: | /// For example: | |||
End of changes. 35 change blocks. | ||||
258 lines changed or deleted | 269 lines changed or added | |||
date_time_facet.h | date_time_facet.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_DATE_TIME_FACET_H_INCLUDED | #ifndef BOOSTER_LOCALE_DATE_TIME_FACET_H_INCLUDED | |||
#define BOOSTER_LOCALE_DATE_TIME_FACET_H_INCLUDED | #define BOOSTER_LOCALE_DATE_TIME_FACET_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | ||||
# pragma warning(push) | ||||
# pragma warning(disable : 4275 4251 4231 4660) | ||||
#endif | ||||
#include <booster/cstdint.h> | #include <booster/cstdint.h> | |||
#include <locale> | #include <locale> | |||
namespace booster { | namespace booster { | |||
namespace locale { | namespace locale { | |||
/// | /// | |||
/// \brief Namespace that contains a enum that defines various peri ods like years, days | /// \brief Namespace that contains a enum that defines various peri ods like years, days | |||
/// | /// | |||
namespace period { | namespace period { | |||
/// | /// | |||
/// | /// | |||
/// This enum provides the list of various time periods that ca n be used for manipulation over date and time | /// This enum provides the list of various time periods that ca n be used for manipulation over date and time | |||
/// Operators like +, - * defined for these period allowing to perform easy calculations over them | /// Operators like +, - * defined for these period allowing to perform easy calculations over them | |||
/// | /// | |||
typedef enum { | typedef enum { | |||
invalid, ///< Special invalid value, sho uld not be used directs | invalid, ///< Special invalid value, sho uld not be used directly | |||
era, ///< Era i.e. AC, BC in Gregori an and Julian calendar, range [0,1] | era, ///< Era i.e. AC, BC in Gregori an and Julian calendar, range [0,1] | |||
year, ///< Year, it is calendar speci fic | year, ///< Year, it is calendar speci fic, for example 2011 in Gregorian calendar. | |||
extended_year, ///< Extended year for Gregoria n/Julian calendars, where 1 BC == 0, 2 BC == -1. | extended_year, ///< Extended year for Gregoria n/Julian calendars, where 1 BC == 0, 2 BC == -1. | |||
month, ///< The month of year, calenda r specific, in Gregorian [0..11] | month, ///< The month of year, calenda r specific, in Gregorian [0..11] | |||
day, ///< The day of month, calendar specific, in Gregorian [1..31] | day, ///< The day of month, calendar specific, in Gregorian [1..31] | |||
day_of_year, ///< The number of day in year, | day_of_year, ///< The number of day in year, | |||
starting from 1 | starting from 1, in Gregorian [1..366] | |||
day_of_week, ///< Day of week, starting from | day_of_week, ///< Day of week, Sunday=1, Mon | |||
Sunday, [1..7] | day=2,..., Saturday=7. | |||
day_of_week_in_month, ///< Original number of the day | ///< Note that that updating th | |||
of the week in month. | is value respects local day of week, so for example, | |||
///< If first day of week is Mo | ||||
nday and the current day is Tuesday then setting | ||||
///< the value to Sunday (1) wo | ||||
uld forward the date by 5 days forward and not backward | ||||
///< by two days as it could be | ||||
expected if the numbers were taken as is. | ||||
day_of_week_in_month, ///< Original number of the day | ||||
of the week in month. For example 1st Sunday, | ||||
///< 2nd Sunday, etc. in Gregor | ||||
ian [1..5] | ||||
day_of_week_local, ///< Local day of week, for exa mple in France Monday is 1, in US Sunday is 1, [1..7] | day_of_week_local, ///< Local day of week, for exa mple in France Monday is 1, in US Sunday is 1, [1..7] | |||
hour, ///< 24 clock hour [0..23] | hour, ///< 24 clock hour [0..23] | |||
hour_12, ///< 12 clock hour [0..11] | hour_12, ///< 12 clock hour [0..11] | |||
am_pm, ///< am or pm marker, [0..1] | am_pm, ///< am or pm marker [0..1] | |||
minute, ///< minute [0..59] | minute, ///< minute [0..59] | |||
second, ///< second [0..59] | second, ///< second [0..59] | |||
week_of_year, ///< The week number in the yea r | week_of_year, ///< The week number in the yea r | |||
week_of_month, ///< The week number withing cu rrent month | week_of_month, ///< The week number withing cu rrent month | |||
first_day_of_week, ///< For example Sunday in US, Monday in France | first_day_of_week, ///< First day if week, constan t, for example Sunday in US = 1, Monday in France = 2 | |||
} period_type; | } period_type; | |||
} // namespace period | } // namespace period | |||
/// | /// | |||
/// Structure that define POSIX time, seconds and milliseconds | /// Structure that define POSIX time, seconds and milliseconds | |||
/// since Jan 1, 1970, 00:00 not including leap seconds. | /// since Jan 1, 1970, 00:00 not including leap seconds. | |||
/// | /// | |||
struct posix_time { | struct posix_time { | |||
int64_t seconds; ///< Seconds since epoch | int64_t seconds; ///< Seconds since epoch | |||
skipping to change at line 93 | skipping to change at line 103 | |||
/// | /// | |||
typedef enum { | typedef enum { | |||
move, ///< Change the value up or down effecting others f or example 1990-12-31 + 1 day = 1991-01-01 | move, ///< Change the value up or down effecting others f or example 1990-12-31 + 1 day = 1991-01-01 | |||
roll, ///< Change the value up or down not effecting othe rs for example 1990-12-31 + 1 day = 1990-12-01 | roll, ///< Change the value up or down not effecting othe rs for example 1990-12-31 + 1 day = 1990-12-01 | |||
} update_type; | } update_type; | |||
/// | /// | |||
/// Information about calendar | /// Information about calendar | |||
/// | /// | |||
typedef enum { | typedef enum { | |||
is_gregorian, ///< Check if the calendar is Gregorian | is_gregorian, ///< Check if the calendar is Gregorian | |||
is_dst ///< Check if the current time is in daylig | ||||
ht time savings | ||||
} calendar_option_type; | } calendar_option_type; | |||
/// | /// | |||
/// Make a polymorphic copy of the calendar | /// Make a polymorphic copy of the calendar | |||
/// | /// | |||
virtual abstract_calendar *clone() const = 0; | virtual abstract_calendar *clone() const = 0; | |||
/// | /// | |||
/// Set specific \a value for period \a p, note not all values are settable. | /// Set specific \a value for period \a p, note not all values are settable. | |||
/// | /// | |||
skipping to change at line 185 | skipping to change at line 196 | |||
/// | /// | |||
/// Locale id (for work with std::locale | /// Locale id (for work with std::locale | |||
/// | /// | |||
static std::locale::id id; | static std::locale::id id; | |||
}; | }; | |||
} // locale | } // locale | |||
} // boost | } // boost | |||
#ifdef BOOSTER_MSVC | ||||
#pragma warning(pop) | ||||
#endif | ||||
#endif | #endif | |||
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 | // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 | |||
End of changes. 9 change blocks. | ||||
12 lines changed or deleted | 33 lines changed or added | |||
encoding.h | encoding.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_ENCODING_H_INCLUDED | #ifndef BOOSTER_LOCALE_ENCODING_H_INCLUDED | |||
#define BOOSTER_LOCALE_ENCODING_H_INCLUDED | #define BOOSTER_LOCALE_ENCODING_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
form.h | form.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
namespace http { | namespace http { | |||
class file; | class file; | |||
} | } | |||
namespace widgets { | namespace widgets { | |||
class base_widget; | class base_widget; | |||
} | } | |||
/// | /// | |||
/// \brief this struct holds various flags for HTML generation contr ol | /// \brief This struct holds various flags to control the HTML gener ation. | |||
/// | /// | |||
struct form_flags { | struct form_flags { | |||
/// | /// | |||
/// This enum represents HTML/XHTML switch | /// This enum represents the HTML/XHTML switch. | |||
/// | /// | |||
typedef enum { | typedef enum { | |||
as_html = 0, ///< render form/widget as ordinary HTML | as_html = 0, ///< render form/widget as ordinary HTML | |||
as_xhtml= 1, ///< render form/widget as XHTML | as_xhtml= 1, ///< render form/widget as XHTML | |||
} html_type; | } html_type; | |||
/// | /// | |||
/// This enum represents the style of widgets generation | /// This enum represents the style for the widgets generatio n. | |||
/// | /// | |||
typedef enum { | typedef enum { | |||
as_p = 0 , ///< Render each widget using paragrap hs | as_p = 0 , ///< Render each widget using paragrap hs | |||
as_table= 1 , ///< Render each widget using table | as_table= 1 , ///< Render each widget using table | |||
as_ul = 2 , ///< Render each widget using unordere d list | as_ul = 2 , ///< Render each widget using unordere d list | |||
as_dl = 3 , ///< Render each widget using definiti ons list | as_dl = 3 , ///< Render each widget using definiti ons list | |||
as_space= 4 ///< Render each widget using simple b lank space separators | as_space= 4 ///< Render each widget using simple b lank space separators | |||
} html_list_type; | } html_list_type; | |||
/// | /// | |||
/// This is special flag for partial generation of widget's HTML | /// This special flag is used to partially generate a widget 's HTML. | |||
/// | /// | |||
typedef enum { | typedef enum { | |||
first_part = 0, ///< Render part 1; HTML attributes | first_part = 0, ///< Render part 1: HTML attributes | |||
can be inserted after it | can be inserted after it. | |||
second_part = 1 ///< Render part 2 -- compete part | second_part = 1 ///< Render part 2: complete part 1 | |||
1. | . | |||
} widget_part_type; | } widget_part_type; | |||
}; | }; | |||
/// | /// | |||
/// \brief This class represent the context required for generation of HTML for the widgets | /// \brief This class represents the context required to generate th e widgets' HTML. | |||
/// | /// | |||
class CPPCMS_API form_context : public form_flags | class CPPCMS_API form_context : public form_flags | |||
{ | { | |||
public: | public: | |||
/// | /// | |||
/// Default constructor | /// Default constructor. | |||
/// | /// | |||
form_context(); | form_context(); | |||
/// | /// | |||
/// Copy-constructor | /// Copy-constructor. | |||
/// | /// | |||
form_context(form_context const &other); | form_context(form_context const &other); | |||
/// | /// | |||
/// Assignment | /// Assignment. | |||
/// | /// | |||
form_context const &operator = (form_context const &other); | form_context const &operator = (form_context const &other); | |||
/// | /// | |||
/// Create a rendering context | /// Create a rendering context. | |||
/// | /// | |||
/// \param output the output std::ostream to write HTML to | /// \param output the std::ostream output to write HTML to. | |||
/// \param ht flags representing the type of HTML that shoul | /// \param ht flags represents the type of HTML that should | |||
d be generated | be generated. | |||
/// \param hlt flag that defines the style of widgets genera | /// \param hlt flag defines the style of widgets generation. | |||
tion | ||||
/// | /// | |||
form_context( std::ostream &output, | form_context( std::ostream &output, | |||
html_type ht = form_flags::as_html, | html_type ht = form_flags::as_html, | |||
html_list_type hlt=form_flags::as_p); | html_list_type hlt=form_flags::as_p); | |||
/// | /// | |||
/// Destructor | /// Destructor. | |||
/// | /// | |||
~form_context(); | ~form_context(); | |||
/// | /// | |||
/// Set an HTML/XHTML flag | /// Set the HTML/XHTML flag. | |||
/// | /// | |||
void html(html_type t); | void html(html_type t); | |||
/// | /// | |||
/// Set widgets rendering style | /// Set the widgets rendering style. | |||
/// | /// | |||
void html_list(html_list_type t); | void html_list(html_list_type t); | |||
/// | /// | |||
/// Set flag for rendering of partial widget | /// Set the flag for the partial rendering of the widget. | |||
/// | /// | |||
void widget_part(widget_part_type t); | void widget_part(widget_part_type t); | |||
/// | /// | |||
/// Set the output stream | /// Set the output stream. | |||
/// | /// | |||
void out(std::ostream &out); | void out(std::ostream &out); | |||
/// | /// | |||
/// Set an HTML/XHTML flag - default as_html | /// Set the HTML/XHTML flag. The default is \a as_html. | |||
/// | /// | |||
html_type html() const; | html_type html() const; | |||
/// | /// | |||
/// Get widgets rendering style - default as_p | /// Get the widget rendering style. The default is \a as_p. | |||
/// | /// | |||
html_list_type html_list() const; | html_list_type html_list() const; | |||
/// | /// | |||
/// Get the part of widget that should be generated, see wid get_part_type, default first_part | /// Get the part of the widget that should be generated. See \a widget_part_type. The default is \a first_part. | |||
/// | /// | |||
widget_part_type widget_part() const; | widget_part_type widget_part() const; | |||
/// | /// | |||
/// Get the output stream | /// Get the output stream. | |||
/// | /// | |||
std::ostream &out() const; | std::ostream &out() const; | |||
private: | private: | |||
uint32_t html_type_; | uint32_t html_type_; | |||
uint32_t html_list_type_; | uint32_t html_list_type_; | |||
uint32_t widget_part_type_; | uint32_t widget_part_type_; | |||
std::ostream *output_; | std::ostream *output_; | |||
uint32_t reserved_1; | uint32_t reserved_1; | |||
uint32_t reserved_2; | uint32_t reserved_2; | |||
struct _data; | struct _data; | |||
booster::hold_ptr<_data> d; | booster::hold_ptr<_data> d; | |||
}; | }; | |||
/// | /// | |||
/// \brief This class is base class of any form or form-widget used in CppCMS. | /// \brief This class is the base class for any form or form widget used in CppCMS. | |||
/// | /// | |||
/// It provides abstract basic operations that every widget or form should implement | /// It provides basic, abstract operations that every widget or form should implement. | |||
/// | /// | |||
class CPPCMS_API base_form : public form_flags { | class CPPCMS_API base_form : public form_flags { | |||
public: | public: | |||
/// | /// | |||
/// Render the widget to std::ostream \a output with control | /// Render the widget to std::ostream \a output with the con | |||
flags \a flags. | trol flags \a flags. | |||
/// Usually this function is called directly by template ren | /// Usually this function is called directly by the template | |||
dering functions | rendering functions. | |||
/// | /// | |||
virtual void render(form_context &context) = 0; | virtual void render(form_context &context) = 0; | |||
/// | /// | |||
/// Load the information of form from the provided http::con | /// Load the form information from the provided http::contex | |||
text \a context. | t \a context. | |||
/// User calls this function for loading all information fro | /// A user can call this function to load all information fr | |||
m the raw POST/GET | om the raw POST/GET | |||
/// form to internal widget representation. | /// data into the internal widget representation. | |||
/// | /// | |||
virtual void load(http::context &context) = 0; | virtual void load(http::context &context) = 0; | |||
/// | /// | |||
/// Validate the form according to defined rules. If all che cks are OK | /// Validate the form according to defined rules. If all che cks are OK, | |||
/// true is returned. If some widget or form fails, false is returned. | /// true is returned. If some widget or form fails, false is returned. | |||
/// | /// | |||
virtual bool validate() = 0; | virtual bool validate() = 0; | |||
/// | /// | |||
/// Clear the form from all user provided data. | /// Clear the form from all user provided data. | |||
/// | /// | |||
virtual void clear() = 0; | virtual void clear() = 0; | |||
/// | /// | |||
/// Set parent of this form. Used internaly, should not be u sed | /// Set a parent of this form. Used internally. You should n ot use it. | |||
/// | /// | |||
virtual void parent(base_form *subform) = 0; | virtual void parent(base_form *subform) = 0; | |||
/// | /// | |||
/// Get parent of this form. If this is topmost form, NULL i s returned | /// Get the parent of this form. If this is the topmost form , NULL is returned. | |||
/// | /// | |||
virtual base_form *parent() = 0; | virtual base_form *parent() = 0; | |||
base_form(); | base_form(); | |||
virtual ~base_form(); | virtual ~base_form(); | |||
}; | }; | |||
/// | /// | |||
/// \brief The \a form is a container that used to collect other wid gets and forms to single unit | /// \brief The \a form is a container used to collect other widgets and forms into a single unit. | |||
/// | /// | |||
/// Generally various widgets and forms are combined into single for | /// Generally various widgets and forms are combined into a single f | |||
m in order to simplify rendering | orm in order to simplify the rendering | |||
/// and validation of forms that include more then one widget | /// and validation of forms that include more than one widget. | |||
/// | /// | |||
class CPPCMS_API form : public booster::noncopyable, | class CPPCMS_API form : public booster::noncopyable, | |||
public base_form | public base_form | |||
{ | { | |||
public: | public: | |||
form(); | form(); | |||
virtual ~form(); | virtual ~form(); | |||
/// | /// | |||
/// Render all widgets and sub-forms to \a output, using | /// Render all the widgets and sub-forms to the \a output, u | |||
/// base_form \a flags | sing | |||
/// the base_form \a flags. | ||||
/// | /// | |||
virtual void render(form_context &context); | virtual void render(form_context &context); | |||
/// | /// | |||
/// Load all information from widgets from http::context \a cont | /// Load all the widget information from http::context \a co nt. | |||
/// | /// | |||
virtual void load(http::context &cont); | virtual void load(http::context &cont); | |||
/// | /// | |||
/// validate all subforms and widgets. If at least one of th em fails, | /// Validate all subforms and widgets. If at least one of th em fails, | |||
/// false is returned. Otherwise, true is returned. | /// false is returned. Otherwise, true is returned. | |||
/// | /// | |||
virtual bool validate(); | virtual bool validate(); | |||
/// | /// | |||
/// Clear all subforms and widgets for all loaded data. | /// Clear all subforms and widgets from all loaded data. | |||
/// | /// | |||
virtual void clear(); | virtual void clear(); | |||
/// | /// | |||
/// adds \a subform to form, the ownership is not transferre | /// Add \a subform to form. The ownership is not transferred | |||
d to | to | |||
/// to the parent | /// the parent. | |||
/// | /// | |||
void add(form &subform); | void add(form &subform); | |||
/// | /// | |||
/// add \a subform to form, the ownership is transferred to | /// Add \a subform to form. The ownership is transferred to | |||
/// the parent and subform will be destroyed together with | /// the parent and the subform will be destroyed together wi | |||
/// the parent | th | |||
/// the parent. | ||||
/// | /// | |||
void attach(form *subform); | void attach(form *subform); | |||
/// | /// | |||
/// adds \a widget to form, the ownership is not transferred | /// Add \a widget to form. The ownership is not transferred | |||
to | to | |||
/// to the parent | /// to the parent. | |||
/// | /// | |||
void add(widgets::base_widget &widget); | void add(widgets::base_widget &widget); | |||
/// | /// | |||
/// add \a widget to form, the ownership is transferred to | /// Add \a widget to form. The ownership is transferred to | |||
/// the parent the widget will be destroyed together with | /// the parent and the widget will be destroyed together wit | |||
/// the parent form | h | |||
/// the parent. | ||||
/// | /// | |||
void attach(widgets::base_widget *widget); | void attach(widgets::base_widget *widget); | |||
/// | /// | |||
/// Shortcut to \a add | /// Shortcut to \a add. | |||
/// | /// | |||
inline form &operator + (form &f) | inline form &operator + (form &f) | |||
{ | { | |||
add(f); | add(f); | |||
return *this; | return *this; | |||
} | } | |||
/// | /// | |||
/// Shortcut to \a add | /// Shortcut to \a add. | |||
/// | /// | |||
inline form &operator + (widgets::base_widget &f) | inline form &operator + (widgets::base_widget &f) | |||
{ | { | |||
add(f); | add(f); | |||
return *this; | return *this; | |||
} | } | |||
/// | /// | |||
/// Set parent of this form. Used internaly, should not be u | /// Set the parent of this form. It is used internally; you | |||
sed. It is called | should not use it. It is called | |||
/// when the form is added or attached to other form. | /// when the form is added or attached to another form. | |||
/// | /// | |||
virtual void parent(base_form *subform); | virtual void parent(base_form *subform); | |||
/// | /// | |||
/// Get parent of this form. If this is topmost form, NULL i | /// Get parent of this form. If this is the topmost form, NU | |||
s returned | LL is returned. | |||
/// It is assumed that the parent is always form. | /// It is assumed that the parent is always a form. | |||
/// | /// | |||
virtual form *parent(); | virtual form *parent(); | |||
/// | /// | |||
/// \brief Input iterator that is used to iterate over all w idgets of the form | /// \brief Input iterator used to iterate over all the widge ts in a form. | |||
/// | /// | |||
/// This class is mainly used by templates framework for wid | /// This class is mainly used by templates to render widgets | |||
gets rendering. It | . It | |||
/// walks on all widgets and subforms recursively. | /// walks over all widgets and subforms recursively. | |||
/// | /// | |||
/// Note: it walks over widgets only: | /// Note: it walks over widgets only: | |||
/// | /// | |||
/// \code | /// \code | |||
/// iterator p=f.begin(); | /// iterator p=f.begin(); | |||
/// if(p!=f.end()) | /// if(p!=f.end()) | |||
/// if p!=f.end() --> *p is derived from widgets::base_wid get. | /// if p!=f.end() --> *p is derived from widgets::base_wid get. | |||
/// \endcode | /// \endcode | |||
/// | /// | |||
class CPPCMS_API iterator : public std::iterator<std::input_ iterator_tag,widgets::base_widget> | class CPPCMS_API iterator : public std::iterator<std::input_ iterator_tag,widgets::base_widget> | |||
{ | { | |||
public: | public: | |||
/// | /// | |||
/// End iterator | /// End iterator. | |||
/// | /// | |||
iterator(); | iterator(); | |||
/// | /// | |||
/// Create widgets iterator | /// Create a widget iterator. | |||
/// | /// | |||
iterator(form &); | iterator(form &); | |||
/// | /// | |||
/// Destructor | /// Destructor. | |||
/// | /// | |||
~iterator(); | ~iterator(); | |||
/// | /// | |||
/// Copy the iterator, this is not cheap operation. | /// Copy the iterator. This operation is not cheap. | |||
/// | /// | |||
iterator(iterator const &other); | iterator(iterator const &other); | |||
/// | /// | |||
/// Assign the iterator, this is not cheap operation . | /// Assign the iterator. This operation is not cheap . | |||
/// | /// | |||
iterator const &operator = (iterator const &other); | iterator const &operator = (iterator const &other); | |||
/// | /// | |||
/// Returns the underlying widget. Condition: *this! =iterator() | /// Return the underlying widget. Condition: *this!= iterator(). | |||
/// | /// | |||
widgets::base_widget *operator->() const | widgets::base_widget *operator->() const | |||
{ | { | |||
return get(); | return get(); | |||
} | } | |||
/// | /// | |||
/// Returns the underlying widget. Condition: *this! =iterator() | /// Return the underlying widget. Condition: *this!= iterator(). | |||
/// | /// | |||
widgets::base_widget &operator*() const | widgets::base_widget &operator*() const | |||
{ | { | |||
return *get(); | return *get(); | |||
} | } | |||
/// | /// | |||
/// Check if two iterators pointing to same element | /// Check if two iterators point to the same element . | |||
/// | /// | |||
bool operator==(iterator const &other) const | bool operator==(iterator const &other) const | |||
{ | { | |||
return equal(other); | return equal(other); | |||
} | } | |||
/// | /// | |||
/// Check if two iterators pointing to different ele ment | /// Check if two iterators point to different elemen ts. | |||
/// | /// | |||
bool operator!=(iterator const &other) const | bool operator!=(iterator const &other) const | |||
{ | { | |||
return !equal(other); | return !equal(other); | |||
} | } | |||
/// | /// | |||
/// Post Increment operator, it forward the iterator no text widget. | /// Post Increment operator, it forward the iterator no text widget. | |||
/// Note it does not point to higher level form cont ainer. | /// Note it does not point to higher level form cont ainer. | |||
/// | /// | |||
/// Note: prefer using ++i then i++ as copying itera tor is not cheap. | /// Note: it is preferable to use ++i rather than i+ + as copying iterators is not cheap. | |||
/// | /// | |||
iterator operator++(int unused) | iterator operator++(int /*unused*/) | |||
{ | { | |||
iterator tmp(*this); | iterator tmp(*this); | |||
next(); | next(); | |||
return tmp; | return tmp; | |||
} | } | |||
/// | /// | |||
/// Increment operator. It forward the iterator no t ext widget. | /// Increment operator. It forward the iterator no t ext widget. | |||
/// Note it does not point to higher level form cont ainer | /// Note it does not point to higher level form cont ainer | |||
/// | /// | |||
iterator &operator++() | iterator &operator++() | |||
{ | { | |||
next(); | next(); | |||
return *this; | return *this; | |||
} | } | |||
skipping to change at line 480 | skipping to change at line 475 | |||
/// Default constructor | /// Default constructor | |||
/// | /// | |||
base_widget(); | base_widget(); | |||
virtual ~base_widget(); | virtual ~base_widget(); | |||
/// | /// | |||
/// Check if a value was assigned to widget. Usually becomes true | /// Check if a value was assigned to widget. Usually becomes true | |||
/// when user assignees value to widget or the widge t is loaded. | /// when user assignees value to widget or the widge t is loaded. | |||
/// | /// | |||
/// If there is exist a reasonable default value for | ||||
a widget | ||||
/// then set() should be true. For widgets like file | ||||
or numeric | ||||
/// where explicit parsing is required the set() val | ||||
ue would indecate | ||||
/// that user provided some value (uploaded a file, | ||||
had gave a number) | ||||
/// | ||||
bool set(); | bool set(); | |||
/// | /// | |||
/// After executing validation, each widget can be t ested for validity | /// After executing validation, each widget can be t ested for validity | |||
/// | /// | |||
bool valid(); | bool valid(); | |||
/// | /// | |||
/// Get html id attribute | /// Get html id attribute | |||
/// | /// | |||
skipping to change at line 937 | skipping to change at line 937 | |||
private: | private: | |||
int rows_,cols_; | int rows_,cols_; | |||
struct _data; | struct _data; | |||
booster::hold_ptr<_data> d; | booster::hold_ptr<_data> d; | |||
}; | }; | |||
/// | /// | |||
/// \brief Widget for number input. It is template class tha t assumes that T is number | /// \brief Widget for number input. It is template class tha t assumes that T is number | |||
/// | /// | |||
/// This class parses the input and checks if it is value va | ||||
lue. If it is set() would | ||||
/// be true. | ||||
/// | ||||
/// If the value was not defined access to value() would thr | ||||
ow an exception | ||||
/// | ||||
template<typename T> | template<typename T> | |||
class numeric: public base_html_input { | class numeric: public base_html_input { | |||
public: | public: | |||
numeric() : | numeric() : | |||
base_html_input("text"), | base_html_input("text"), | |||
check_low_(false), | check_low_(false), | |||
check_high_(false), | check_high_(false), | |||
non_empty_(false) | non_empty_(false) | |||
{ | { | |||
skipping to change at line 1441 | skipping to change at line 1446 | |||
private: | private: | |||
uint32_t vertical_ : 1; | uint32_t vertical_ : 1; | |||
uint32_t reserved_ : 31; | uint32_t reserved_ : 31; | |||
struct _data; | struct _data; | |||
booster::hold_ptr<_data> d; | booster::hold_ptr<_data> d; | |||
}; | }; | |||
/// | /// | |||
/// Class that represents file upload form entry | /// \brief Class that represents file upload form entry | |||
/// | ||||
/// If the file was not uploaded set() would be false and | ||||
/// on attempt to access value() member function it would th | ||||
row | ||||
/// | /// | |||
class CPPCMS_API file : public base_html_input { | class CPPCMS_API file : public base_html_input { | |||
public: | public: | |||
/// | /// | |||
/// Ensure that file is uploaded. | /// Ensure that file is uploaded. | |||
/// | /// | |||
void non_empty(); | void non_empty(); | |||
/// | /// | |||
/// Set minimum and maximum limits for file size. No te max == -1 indicates that there | /// Set minimum and maximum limits for file size. No te max == -1 indicates that there | |||
/// is no maximal limit, min==0 indicates that there is no minimal limit. | /// is no maximal limit, min==0 indicates that there is no minimal limit. | |||
skipping to change at line 1484 | skipping to change at line 1492 | |||
/// | /// | |||
/// Validate the filename's charset (default is on) | /// Validate the filename's charset (default is on) | |||
/// | /// | |||
void validate_filename_charset(bool); | void validate_filename_charset(bool); | |||
/// | /// | |||
/// Get validation option for filename's charset | /// Get validation option for filename's charset | |||
/// | /// | |||
bool validate_filename_charset(); | bool validate_filename_charset(); | |||
/// | /// | |||
/// Get uploaded file | /// Get uploaded file, throws cppcms_error if set() | |||
== false, i.e. if the file | ||||
/// was not uploaded | ||||
/// | /// | |||
booster::shared_ptr<http::file> value(); | booster::shared_ptr<http::file> value(); | |||
/// | /// | |||
/// Set required file mime type | /// Set required file mime type | |||
/// | /// | |||
void mime(std::string const &); | void mime(std::string const &); | |||
/// | /// | |||
/// Set regular expression that checks for valid mim e type | /// Set regular expression that checks for valid mim e type | |||
End of changes. 89 change blocks. | ||||
105 lines changed or deleted | 124 lines changed or added | |||
format.h | format.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_FORMAT_H_INCLUDED | #ifndef BOOSTER_LOCALE_FORMAT_H_INCLUDED | |||
#define BOOSTER_LOCALE_FORMAT_H_INCLUDED | #define BOOSTER_LOCALE_FORMAT_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
skipping to change at line 82 | skipping to change at line 82 | |||
return *this; | return *this; | |||
} | } | |||
friend stream_type &operator<<(stream_type &out,formattible const &fmt) | friend stream_type &operator<<(stream_type &out,formattible const &fmt) | |||
{ | { | |||
fmt.writer_(out,fmt.pointer_); | fmt.writer_(out,fmt.pointer_); | |||
return out; | return out; | |||
} | } | |||
private: | private: | |||
static void void_write(stream_type &output,void const *ptr) | static void void_write(stream_type &output,void const * /*p tr*/) | |||
{ | { | |||
CharType empty_string[1]={0}; | CharType empty_string[1]={0}; | |||
output<<empty_string; | output<<empty_string; | |||
} | } | |||
template<typename Type> | template<typename Type> | |||
static void write(stream_type &output,void const *ptr) | static void write(stream_type &output,void const *ptr) | |||
{ | { | |||
output << *reinterpret_cast<Type const *>(ptr); | output << *reinterpret_cast<Type const *>(ptr); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
formatting.h | formatting.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_FORMATTING_H_INCLUDED | #ifndef BOOSTER_LOCALE_FORMATTING_H_INCLUDED | |||
#define BOOSTER_LOCALE_FORMATTING_H_INCLUDED | #define BOOSTER_LOCALE_FORMATTING_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
generator.h | generator.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_GENERATOR_HPP | #ifndef BOOSTER_LOCALE_GENERATOR_HPP | |||
#define BOOSTER_LOCALE_GENERATOR_HPP | #define BOOSTER_LOCALE_GENERATOR_HPP | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
# pragma warning(push) | # pragma warning(push) | |||
skipping to change at line 123 | skipping to change at line 123 | |||
void set_default_messages_domain(std::string const &domain); | void set_default_messages_domain(std::string const &domain); | |||
/// | /// | |||
/// Remove all added domains from the list | /// Remove all added domains from the list | |||
/// | /// | |||
void clear_domains(); | void clear_domains(); | |||
/// | /// | |||
/// Add a search path where dictionaries are looked in. | /// Add a search path where dictionaries are looked in. | |||
/// | /// | |||
void add_messages_path(std::string const &path); | /// \note | |||
#if defined(BOOSTER_WIN_NATIVE) | ||||
/// | /// | |||
/// Add a "wide" search path where dictionaries are looked in. | /// - Under Windows platform the path is treated as path in loc | |||
/// This function is Win32 specific only as windows "ANSI" API | ale's encoding so when | |||
does not support full | /// if you create locale "en_US.windows-1251" then path would | |||
/// range of paths as on any other operating systems | be treated as cp1255, | |||
/// and if it is en_US.UTF-8 it is treated as UTF-8. File nam | ||||
e is always opened as | ||||
/// wide file name as Wide file names are the native file nam | ||||
e on Windows. | ||||
/// | /// | |||
void add_messages_path(std::wstring const &path); | /// - Under POSIX platforms all paths passed as-is regardless o | |||
#endif | f encoding as the narrow | |||
/// encodings are the native encodings for POSIX platform. | ||||
/// | ||||
/// | ||||
void add_messages_path(std::string const &path); | ||||
/// | /// | |||
/// Remove all added paths | /// Remove all added paths | |||
/// | /// | |||
void clear_paths(); | void clear_paths(); | |||
/// | /// | |||
/// Remove all cached locales | /// Remove all cached locales | |||
/// | /// | |||
void clear_cache(); | void clear_cache(); | |||
skipping to change at line 155 | skipping to change at line 157 | |||
/// Turn locale caching ON | /// Turn locale caching ON | |||
/// | /// | |||
void locale_cache_enabled(bool on); | void locale_cache_enabled(bool on); | |||
/// | /// | |||
/// Get locale cache option | /// Get locale cache option | |||
/// | /// | |||
bool locale_cache_enabled() const; | bool locale_cache_enabled() const; | |||
/// | /// | |||
/// Check if by default ANSI encoding is selected or UTF-8 once | ||||
s. The default is false. | ||||
/// | ||||
bool use_ansi_encoding() const; | ||||
/// | ||||
/// Select ANSI encodings as default system encoding rather the | ||||
n UTF-8 by default | ||||
/// under Windows. | ||||
/// | ||||
/// The default is the most protable and most powerful encoding | ||||
UTF-8, but yet user | ||||
/// may select "system" one if it deals with legacy application | ||||
s | ||||
/// | ||||
void use_ansi_encoding(bool enc); | ||||
/// | ||||
/// Generate a locale with id \a id | /// Generate a locale with id \a id | |||
/// | /// | |||
std::locale generate(std::string const &id) const; | std::locale generate(std::string const &id) const; | |||
/// | /// | |||
/// Generate a locale with id \a id, use \a base as a locale fo r which all facets are added, | /// Generate a locale with id \a id, use \a base as a locale fo r which all facets are added, | |||
/// instead of std::locale::classic() one | /// instead of std::locale::classic() one | |||
/// | /// | |||
std::locale generate(std::locale const &base,std::string const &id) const; | std::locale generate(std::locale const &base,std::string const &id) const; | |||
/// | /// | |||
/// Shortcut to generate(id) | /// Shortcut to generate(id) | |||
End of changes. 5 change blocks. | ||||
10 lines changed or deleted | 34 lines changed or added | |||
gnu_gettext.h | gnu_gettext.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCLAE_GNU_GETTEXT_HPP | #ifndef BOOSTER_LOCLAE_GNU_GETTEXT_HPP | |||
#define BOOSTER_LOCLAE_GNU_GETTEXT_HPP | #define BOOSTER_LOCLAE_GNU_GETTEXT_HPP | |||
#include <booster/locale/message.h> | #include <booster/locale/message.h> | |||
#include <booster/backtrace.h> | #include <booster/backtrace.h> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
http_cookie.h | http_cookie.h | |||
---|---|---|---|---|
skipping to change at line 106 | skipping to change at line 106 | |||
/// | /// | |||
/// Set age according to browser's session (i.e. no Max-Age) | /// Set age according to browser's session (i.e. no Max-Age) | |||
/// | /// | |||
void browser_age(); | void browser_age(); | |||
/// | /// | |||
/// Set secure property on the cookies | /// Set secure property on the cookies | |||
/// | /// | |||
void secure(bool v); | void secure(bool v); | |||
/// | ||||
/// Check if cookie is not assigned - empty | ||||
/// | ||||
bool empty() const; | ||||
cookie(); | cookie(); | |||
~cookie(); | ~cookie(); | |||
cookie(cookie const &); | cookie(cookie const &); | |||
cookie const &operator=(cookie const &); | cookie const &operator=(cookie const &); | |||
/// | /// | |||
/// Create cookie with name and value, age - browser, rest propertie s undefined. | /// Create cookie with name and value, age - browser, rest propertie s undefined. | |||
/// | /// | |||
cookie(std::string name,std::string value); | cookie(std::string name,std::string value); | |||
/// | /// | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 5 lines changed or added | |||
http_request.h | http_request.h | |||
---|---|---|---|---|
skipping to change at line 254 | skipping to change at line 254 | |||
/// | /// | |||
/// Type that represents all files uploaded in this request | /// Type that represents all files uploaded in this request | |||
/// | /// | |||
typedef std::vector<booster::shared_ptr<file> > files_type; | typedef std::vector<booster::shared_ptr<file> > files_type; | |||
/// | /// | |||
/// Get all cookies sent with this request | /// Get all cookies sent with this request | |||
/// | /// | |||
cookies_type const &cookies(); | cookies_type const &cookies(); | |||
/// | /// | |||
/// Get cookie by its name, if not assigned returns empty co | ||||
okie | ||||
/// | ||||
cookie const &cookie_by_name(std::string const &name); | ||||
/// | ||||
/// form-data GET part of request | /// form-data GET part of request | |||
/// | /// | |||
form_type const &get(); | form_type const &get(); | |||
/// | /// | |||
/// form-data POST part of request | /// form-data POST part of request | |||
/// | /// | |||
form_type const &post(); | form_type const &post(); | |||
/// | /// | |||
/// form-data POST or GET according to reuqest_method() | /// form-data POST or GET according to reuqest_method() | |||
/// | /// | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 5 lines changed or added | |||
info.h | info.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_INFO_H_INCLUDED | #ifndef BOOSTER_LOCALE_INFO_H_INCLUDED | |||
#define BOOSTER_LOCALE_INFO_H_INCLUDED | #define BOOSTER_LOCALE_INFO_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
# pragma warning(push) | # pragma warning(push) | |||
skipping to change at line 99 | skipping to change at line 99 | |||
std::string name() const | std::string name() const | |||
{ | { | |||
return get_string_property(name_property); | return get_string_property(name_property); | |||
} | } | |||
/// | /// | |||
/// Is underlying encoding is UTF-8 (for char streams and strin gs) | /// Is underlying encoding is UTF-8 (for char streams and strin gs) | |||
/// | /// | |||
bool utf8() const | bool utf8() const | |||
{ | { | |||
return get_ineger_property(utf8_property) != 0; | return get_integer_property(utf8_property) != 0; | |||
} | } | |||
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER) | #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) | |||
std::locale::id& __get_id (void) const { return id; } | std::locale::id& __get_id (void) const { return id; } | |||
#endif | #endif | |||
protected: | protected: | |||
/// | /// | |||
/// Get string property by its id \a v | /// Get string property by its id \a v | |||
/// | /// | |||
virtual std::string get_string_property(string_propery v) const = 0; | virtual std::string get_string_property(string_propery v) const = 0; | |||
/// | /// | |||
/// Get integer property by its id \a v | /// Get integer property by its id \a v | |||
/// | /// | |||
virtual int get_ineger_property(integer_property v) const = 0; | virtual int get_integer_property(integer_property v) const = 0; | |||
}; | }; | |||
} | } | |||
} | } | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
#pragma warning(pop) | #pragma warning(pop) | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
json.h | json.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
/// | /// | |||
/// Special object that is convertible to null json value | /// Special object that is convertible to null json value | |||
/// | /// | |||
struct null {}; | struct null {}; | |||
/// | /// | |||
/// Special object that is convertible to undefined json value | /// Special object that is convertible to undefined json value | |||
/// | /// | |||
struct undefined {}; | struct undefined {}; | |||
inline bool operator==(undefined const &l,undefined const &r) {retur | inline bool operator==(undefined const &/*l*/,undefined const &/*r*/ | |||
n true;} | ) {return true;} | |||
inline bool operator!=(undefined const &l,undefined const &r) {retur | inline bool operator!=(undefined const &/*l*/,undefined const &/*r*/ | |||
n false;} | ) {return false;} | |||
inline bool operator==(null const &l,null const &r) {return true;} | inline bool operator==(null const &/*l*/,null const &/*r*/) {return | |||
inline bool operator!=(null const &l,null const &r) {return false;} | true;} | |||
inline bool operator!=(null const &/*l*/,null const &/*r*/) {return | ||||
false;} | ||||
/// | /// | |||
/// The json::array - std::vector of json::value's | /// The json::array - std::vector of json::value's | |||
/// | /// | |||
typedef std::vector<value> array; | typedef std::vector<value> array; | |||
/// | /// | |||
/// The json::object - std::map of json::value's | /// The json::object - std::map of json::value's | |||
/// | /// | |||
typedef std::map<std::string,value> object; | typedef std::map<std::string,value> object; | |||
skipping to change at line 615 | skipping to change at line 615 | |||
|| std::numeric_limits<double>::max() < in ) | || std::numeric_limits<double>::max() < in ) | |||
{ | { | |||
throw bad_value_cast(); | throw bad_value_cast(); | |||
} | } | |||
v.number(static_cast<double>(in)); | v.number(static_cast<double>(in)); | |||
} | } | |||
}; | }; | |||
template<> | template<> | |||
struct traits<json::null> { | struct traits<json::null> { | |||
static void set(value &v,json::null const &in) | static void set(value &v,json::null const &/*in*/) | |||
{ | { | |||
v.null(); | v.null(); | |||
} | } | |||
}; | }; | |||
template<int n> | template<int n> | |||
struct traits<char[n]> { | struct traits<char[n]> { | |||
typedef char vtype[n]; | typedef char vtype[n]; | |||
static void set(value &v,vtype const &in) | static void set(value &v,vtype const &in) | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 9 lines changed or added | |||
locale.h | locale.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_H_INCLUDED | #ifndef BOOSTER_LOCALE_H_INCLUDED | |||
#define BOOSTER_LOCALE_H_INCLUDED | #define BOOSTER_LOCALE_H_INCLUDED | |||
#include <booster/locale/boundary.h> | #include <booster/locale/boundary.h> | |||
#include <booster/locale/collator.h> | #include <booster/locale/collator.h> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
localization_backend.h | localization_backend.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_LOCALIZATION_BACKEND_HPP | #ifndef BOOSTER_LOCALE_LOCALIZATION_BACKEND_HPP | |||
#define BOOSTER_LOCALE_LOCALIZATION_BACKEND_HPP | #define BOOSTER_LOCALE_LOCALIZATION_BACKEND_HPP | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#include <booster/locale/generator.h> | #include <booster/locale/generator.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
skipping to change at line 32 | skipping to change at line 32 | |||
/// | /// | |||
/// \brief this class represents localization backend that can be u sed for localizing your application. | /// \brief this class represents localization backend that can be u sed for localizing your application. | |||
/// | /// | |||
/// Backends are usually registered inside localization backends ma nager and allow transparent support | /// Backends are usually registered inside localization backends ma nager and allow transparent support | |||
/// of different backends, so user can swithc backend by simply lin king the application to correct one. | /// of different backends, so user can swithc backend by simply lin king the application to correct one. | |||
/// | /// | |||
/// Backends may support different tuning options, but these are th e default options avalible for user | /// Backends may support different tuning options, but these are th e default options avalible for user | |||
/// for all of them | /// for all of them | |||
/// | /// | |||
/// -# locale - the name of the locale in POSIX format like en_US.U | /// -# \c locale - the name of the locale in POSIX format like en_U | |||
TF-8 | S.UTF-8 | |||
/// -# message_path - path to location of message catalogs vector o | /// -# \c use_ansi_encoding - select system locale using ANSI codep | |||
f strings | ages rather then UTF-8 under Windows | |||
/// -# message_application - the name of applications that use mess | /// by default | |||
age catalogs (vector of strings) | /// -# \c message_path - path to location of message catalogs vecto | |||
r of strings | ||||
/// -# \c message_application - the name of applications that use m | ||||
essage catalogs (vector of strings) | ||||
/// | /// | |||
/// Each backend may be installed with different default priority s o when you work with two differnt backends, you | /// Each backend may be installed with different default priority s o when you work with two differnt backends, you | |||
/// can specify priotiry so this backend will be chosen according t o their priority. | /// can specify priotiry so this backend will be chosen according t o their priority. | |||
/// | /// | |||
class localization_backend { | class localization_backend { | |||
localization_backend(localization_backend const &); | localization_backend(localization_backend const &); | |||
void operator=(localization_backend const &); | void operator=(localization_backend const &); | |||
public: | public: | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 10 lines changed or added | |||
message.h | message.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_MESSAGE_H_INCLUDED | #ifndef BOOSTER_LOCALE_MESSAGE_H_INCLUDED | |||
#define BOOSTER_LOCALE_MESSAGE_H_INCLUDED | #define BOOSTER_LOCALE_MESSAGE_H_INCLUDED | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#ifdef BOOSTER_MSVC | #ifdef BOOSTER_MSVC | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
posix_time.h | posix_time.h | |||
---|---|---|---|---|
skipping to change at line 237 | skipping to change at line 237 | |||
bool operator <= (ptime const &other) const | bool operator <= (ptime const &other) const | |||
{ | { | |||
return !(*this > other); | return !(*this > other); | |||
} | } | |||
bool operator >=(ptime const &other) const | bool operator >=(ptime const &other) const | |||
{ | { | |||
return !(*this < other); | return !(*this < other); | |||
} | } | |||
/// | /// | |||
/// Convert local time to POSIX time similar to mktime | ||||
/// | ||||
static ptime local_time(std::tm const &v); | ||||
/// | ||||
/// Convert universal time to POSIX time similar to timegm o | ||||
r mktime in GMT timezone | ||||
/// | ||||
static ptime universal_time(std::tm const &v); | ||||
/// | ||||
/// Convert POSIX time \a v to a local time similar to local time_r | /// Convert POSIX time \a v to a local time similar to local time_r | |||
/// | /// | |||
static std::tm local_time(ptime const &v); | static std::tm local_time(ptime const &v); | |||
/// | /// | |||
/// Convert POSIX time \a v to a GMT time similar to gmtime_ r | /// Convert POSIX time \a v to a GMT time similar to gmtime_ r | |||
/// | /// | |||
static std::tm universal_time(ptime const &v); | static std::tm universal_time(ptime const &v); | |||
/// | /// | |||
/// Get current time | /// Get current time | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 9 lines changed or added | |||
session_interface.h | session_interface.h | |||
---|---|---|---|---|
skipping to change at line 119 | skipping to change at line 119 | |||
/// | /// | |||
void set(std::string const &key,std::string const &v); | void set(std::string const &key,std::string const &v); | |||
/// | /// | |||
/// Get a value for a session \a key. If it is not set, throws cppcm s_error. It is good idea to call is_set before | /// Get a value for a session \a key. If it is not set, throws cppcm s_error. It is good idea to call is_set before | |||
/// you call this function. | /// you call this function. | |||
/// | /// | |||
std::string get(std::string const &key); | std::string get(std::string const &key); | |||
/// | /// | |||
/// Get a value for a session \a key. If it is not set, returns defa | ||||
ult_value | ||||
/// | ||||
std::string get(std::string const &key,std::string const &default_va | ||||
lue); | ||||
/// | ||||
/// Get convert the value that is set for a key \a key to type T usi ng std::iostream. For example you can | /// Get convert the value that is set for a key \a key to type T usi ng std::iostream. For example you can | |||
/// read a number using int n=session().get<int>("number"). | /// read a number using int n=session().get<int>("number"). | |||
/// | /// | |||
/// - it throws cppcms_error if a key \a key not set/ | /// - it throws cppcms_error if a key \a key not set/ | |||
/// - it throws std::bad_cast of the conversion using std::iostream fails | /// - it throws std::bad_cast of the conversion using std::iostream fails | |||
/// | /// | |||
/// Note: the conversion is locale independent (uses C locale) | /// Note: the conversion is locale independent (uses C locale) | |||
/// | /// | |||
template<typename T> | template<typename T> | |||
T get(std::string const &key) | T get(std::string const &key) | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added | |||
socket.h | socket.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2010 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_AIO_SOCKET_H | #ifndef BOOSTER_AIO_SOCKET_H | |||
#define BOOSTER_AIO_SOCKET_H | #define BOOSTER_AIO_SOCKET_H | |||
#include <booster/aio/types.h> | #include <booster/aio/basic_socket.h> | |||
#include <booster/callback.h> | #include <booster/aio/stream_socket.h> | |||
#include <booster/hold_ptr.h> | #include <booster/aio/acceptor.h> | |||
#include <booster/noncopyable.h> | ||||
#include <booster/aio/endpoint.h> | ||||
namespace booster { | ||||
namespace aio { | ||||
class mutable_buffer; | ||||
class const_buffer; | ||||
class io_service; | ||||
class endpoint; | ||||
class BOOSTER_API socket : public noncopyable { | ||||
public: | ||||
typedef enum { | ||||
shut_rd,shut_wr,shut_rdwr | ||||
} how_type; | ||||
socket(); | ||||
socket(io_service &srv); | ||||
~socket(); | ||||
bool has_io_service(); | ||||
io_service &get_io_service(); | ||||
void set_io_service(io_service &srv); | ||||
void reset_io_service(); | ||||
void open(family_type d,socket_type t); | ||||
void open(family_type d,socket_type t,system::error_code &e) | ||||
; | ||||
void close(); | ||||
void close(system::error_code &e); | ||||
void shutdown(how_type h); | ||||
void shutdown(how_type h,system::error_code &e); | ||||
native_type native(); | ||||
void attach(native_type fd); | ||||
void assign(native_type fd); | ||||
native_type release(); | ||||
void accept(socket &); | ||||
void accept(socket &,system::error_code &e); | ||||
void connect(endpoint const &); | ||||
void connect(endpoint const &,system::error_code &e); | ||||
void bind(endpoint const &); | ||||
void bind(endpoint const &,system::error_code &e); | ||||
void listen(int backlog); | ||||
void listen(int backlog,system::error_code &e); | ||||
size_t read_some(mutable_buffer const &buffer); | ||||
size_t read_some(mutable_buffer const &buffer,system::error_ | ||||
code &e); | ||||
size_t write_some(const_buffer const &buffer); | ||||
size_t write_some(const_buffer const &buffer,system::error_c | ||||
ode &e); | ||||
size_t read(mutable_buffer const &buffer); | ||||
size_t write(const_buffer const &buffer); | ||||
size_t read(mutable_buffer const &buffer,system::error_code | ||||
&e); | ||||
size_t write(const_buffer const &buffer,system::error_code & | ||||
e); | ||||
void on_readable(event_handler const &r); | ||||
void on_writeable(event_handler const &r); | ||||
void cancel(); | ||||
void async_read_some(mutable_buffer const &buffer,io_handler | ||||
const &h); | ||||
void async_write_some(const_buffer const &buffer,io_handler | ||||
const &h); | ||||
void async_accept(socket &,event_handler const &h); | ||||
void async_connect(endpoint const &,event_handler const &h); | ||||
void async_read(mutable_buffer const &buffer,io_handler cons | ||||
t &h); | ||||
void async_write(const_buffer const &buffer,io_handler const | ||||
&h); | ||||
endpoint local_endpoint(system::error_code &e); | ||||
endpoint local_endpoint(); | ||||
endpoint remote_endpoint(system::error_code &e); | ||||
endpoint remote_endpoint(); | ||||
typedef enum { | ||||
tcp_no_delay, | ||||
keep_alive, | ||||
reuse_address | ||||
} boolean_option_type; | ||||
bool get_option(boolean_option_type opt,system::error_code & | ||||
e); | ||||
bool get_option(boolean_option_type opt); | ||||
void set_option(boolean_option_type opt,bool v,system::error | ||||
_code &e); | ||||
void set_option(boolean_option_type opt,bool v); | ||||
void set_non_blocking(bool nonblocking); | ||||
void set_non_blocking(bool nonblocking,system::error_code &e | ||||
); | ||||
static bool would_block(system::error_code const &e); | ||||
private: | ||||
bool dont_block(event_handler const &); | ||||
bool dont_block(io_handler const &); | ||||
int writev(const_buffer const &b); | ||||
int readv(mutable_buffer const &b); | ||||
struct data; | ||||
hold_ptr<data> d; | ||||
native_type fd_; | ||||
bool owner_; | ||||
bool nonblocking_was_set_; | ||||
io_service *srv_; | ||||
}; | ||||
/// | ||||
/// Create a connected pair of sockets, under UNIX creates unix-doma | ||||
in-sockets | ||||
/// under windows AF_INET sockets | ||||
/// | ||||
BOOSTER_API void socket_pair(socket_type t,socket &s1,socket &s2,sys | ||||
tem::error_code &e); | ||||
BOOSTER_API void socket_pair(socket_type t,socket &s1,socket &s2); | ||||
} // aio | ||||
} // booster | ||||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
136 lines changed or deleted | 3 lines changed or added | |||
streambuf.h | streambuf.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
cur, //!< Set relatively to current position (i.e. S EEK_CUR) | cur, //!< Set relatively to current position (i.e. S EEK_CUR) | |||
end //!< Set relatively to end of file (i.e. SEEK_E ND) | end //!< Set relatively to end of file (i.e. SEEK_E ND) | |||
} pos_type; | } pos_type; | |||
/// | /// | |||
/// Read \a length bytes from the stream to buffer \a pos, r eturn number of bytes | /// Read \a length bytes from the stream to buffer \a pos, r eturn number of bytes | |||
/// actually read. If return value is less then length, it i s considered end of file | /// actually read. If return value is less then length, it i s considered end of file | |||
/// | /// | |||
/// If the stream is write only, do not implement (returns E OF by default) | /// If the stream is write only, do not implement (returns E OF by default) | |||
/// | /// | |||
virtual size_t read(char *pos,size_t length) | virtual size_t read(char * /*pos*/,size_t /*length*/) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
/// | /// | |||
/// Write \a length bytes to the devise from buffer \a pos, return number of bytes | /// Write \a length bytes to the devise from buffer \a pos, return number of bytes | |||
/// actually written, if the result is less then \a length, considered as EOF. | /// actually written, if the result is less then \a length, considered as EOF. | |||
/// | /// | |||
/// If the stream is read only, do not implement (returns EO F by default) | /// If the stream is read only, do not implement (returns EO F by default) | |||
/// | /// | |||
virtual size_t write(char const *pos,size_t length) | virtual size_t write(char const * /*pos*/,size_t /*length*/) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
/// | /// | |||
/// Seek the device to \a position relatively to \a pos. Ret urn current position | /// Seek the device to \a position relatively to \a pos. Ret urn current position | |||
/// in file. | /// in file. | |||
/// | /// | |||
/// If error occurs return -1. | /// If error occurs return -1. | |||
/// | /// | |||
/// If the stream is not seekable do not reimplement, return s -1 by default. | /// If the stream is not seekable do not reimplement, return s -1 by default. | |||
/// | /// | |||
virtual long long seek(long long position,pos_type pos = set ) | virtual long long seek(long long /*position*/,pos_type /*pos */ = set) | |||
{ | { | |||
return -1; | return -1; | |||
} | } | |||
virtual ~io_device() | virtual ~io_device() | |||
{ | { | |||
} | } | |||
}; | }; | |||
/// | /// | |||
/// \brief this is an implementation of generic streambuffer | /// \brief this is an implementation of generic streambuffer | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
thread.h | thread.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
/// | /// | |||
thread(function<void()> const &cb); | thread(function<void()> const &cb); | |||
~thread(); | ~thread(); | |||
/// | /// | |||
/// Join existing thread | /// Join existing thread | |||
/// | /// | |||
void join(); | void join(); | |||
/// | /// | |||
/// Detach from the thread | ||||
/// | ||||
void detach(); | ||||
/// | ||||
/// Get number of CPUS, returns 0 if the number is unknown | /// Get number of CPUS, returns 0 if the number is unknown | |||
/// | /// | |||
static unsigned hardware_concurrency(); | static unsigned hardware_concurrency(); | |||
private: | private: | |||
friend void *booster_thread_func(void *); | friend void *booster_thread_func(void *); | |||
struct data; | struct data; | |||
hold_ptr<data> d; | hold_ptr<data> d; | |||
}; | }; | |||
class condition_variable; | class condition_variable; | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 5 lines changed or added | |||
types.h | types.h | |||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
// Copyright (c) 2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2010 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_AIO_TYPES_H | #ifndef BOOSTER_AIO_TYPES_H | |||
#define BOOSTER_AIO_TYPES_H | #define BOOSTER_AIO_TYPES_H | |||
#include <booster/config.h> | #include <booster/config.h> | |||
#include <string.h> | #include <stddef.h> | |||
namespace booster { | namespace booster { | |||
template<typename F> | template<typename F> | |||
class callback; | class callback; | |||
namespace system { | namespace system { | |||
class error_code; | class error_code; | |||
} | } | |||
/// | /// | |||
/// \brief This namespace povides and API to asynchronous sockets AP I | /// \brief This namespace povides and API to asynchronous sockets AP I | |||
/// | /// | |||
namespace aio { | namespace aio { | |||
class endpoint; | class endpoint; | |||
class socket; | ||||
class io_service; | class io_service; | |||
#ifdef BOOSTER_WIN32 | #ifdef BOOSTER_WIN32 | |||
typedef unsigned native_type; | typedef unsigned native_type; | |||
static const unsigned invalid_socket = (unsigned)(-1); | static const unsigned invalid_socket = (unsigned)(-1); | |||
#else | #else | |||
typedef int native_type; | typedef int native_type; | |||
static const int invalid_socket = -1; | static const int invalid_socket = -1; | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
url_dispatcher.h | url_dispatcher.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | // along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | // | |||
/////////////////////////////////////////////////////////////////////////// //// | /////////////////////////////////////////////////////////////////////////// //// | |||
#ifndef CPPCMS_URL_DISPATCHER_H | #ifndef CPPCMS_URL_DISPATCHER_H | |||
#define CPPCMS_URL_DISPATCHER_H | #define CPPCMS_URL_DISPATCHER_H | |||
#include <booster/noncopyable.h> | #include <booster/noncopyable.h> | |||
#include <cppcms/defs.h> | #include <cppcms/defs.h> | |||
#include <booster/function.h> | #include <booster/function.h> | |||
#include <booster/hold_ptr.h> | #include <booster/hold_ptr.h> | |||
#include <cppcms/mem_bind.h> | #include <booster/traits/enable_if.h> | |||
#include <booster/traits/is_base_of.h> | ||||
#include <cppcms/application.h> | ||||
#include <string> | #include <string> | |||
#include <list> | #include <list> | |||
namespace cppcms { | namespace cppcms { | |||
class application; | class application; | |||
/// | /// | |||
/// \brief This class is used to glue between member function of app lication class and urls | /// \brief This class is used to glue between member function of app lication class and urls | |||
/// | /// | |||
skipping to change at line 67 | skipping to change at line 69 | |||
typedef booster::function<void()> handler; | typedef booster::function<void()> handler; | |||
typedef booster::function<void(std::string)> handler1; | typedef booster::function<void(std::string)> handler1; | |||
typedef booster::function<void(std::string,std::string)> han dler2; | typedef booster::function<void(std::string,std::string)> han dler2; | |||
typedef booster::function<void(std::string,std::string,std:: string)> handler3; | typedef booster::function<void(std::string,std::string,std:: string)> handler3; | |||
typedef booster::function<void(std::string,std::string,std:: string,std::string)> handler4; | typedef booster::function<void(std::string,std::string,std:: string,std::string)> handler4; | |||
/// | /// | |||
/// Assign \a handler to pattern \a regex thus if URL that m atches | /// Assign \a handler to pattern \a regex thus if URL that m atches | |||
/// this pattern requested, \a handler is called | /// this pattern requested, \a handler is called | |||
/// | /// | |||
void assign(std::string regex,handler handler); | void assign(std::string const ®ex,handler handler); | |||
/// | /// | |||
/// Assign \a handler to pattern \a regex thus if URL that m atches | /// Assign \a handler to pattern \a regex thus if URL that m atches | |||
/// this pattern requested, \a handler is called with first parameters | /// this pattern requested, \a handler is called with first parameters | |||
/// the string that was matched at position \a exp1. | /// the string that was matched at position \a exp1. | |||
/// | /// | |||
/// For example: if | /// For example: if | |||
/// regular expression is "^/page/(\\d+)/(\\w+)$" , exp1=2, and the url is | /// regular expression is "^/page/(\\d+)/(\\w+)$" , exp1=2, and the url is | |||
/// "/page/13/to_be_or_not", then handler would be called wi th "to_be_or_not" | /// "/page/13/to_be_or_not", then handler would be called wi th "to_be_or_not" | |||
/// as its first parameter | /// as its first parameter | |||
/// | /// | |||
void assign(std::string regex,handler1 handler,int exp1); | void assign(std::string const ®ex,handler1 handler,int ex p1); | |||
/// | /// | |||
/// Assign \a handler to pattern \a regex thus if URL that m atches | /// Assign \a handler to pattern \a regex thus if URL that m atches | |||
/// this pattern requested, \a handler is called with 1st an d 2nd parameters | /// this pattern requested, \a handler is called with 1st an d 2nd parameters | |||
/// the string that was matched at position \a exp1 and \a e xp2 | /// the string that was matched at position \a exp1 and \a e xp2 | |||
/// | /// | |||
void assign(std::string regex,handler2 handler,int exp1,int exp2); | void assign(std::string const ®ex,handler2 handler,int ex p1,int exp2); | |||
/// | /// | |||
/// Assign \a handler to pattern \a regex thus if URL that m atches | /// Assign \a handler to pattern \a regex thus if URL that m atches | |||
/// this pattern requested, \a handler is called with 1st, 2 nd and 3rd parameters | /// this pattern requested, \a handler is called with 1st, 2 nd and 3rd parameters | |||
/// the string that was matched at position \a exp1, \a exp2 and \a exp2 | /// the string that was matched at position \a exp1, \a exp2 and \a exp2 | |||
/// | /// | |||
void assign(std::string regex,handler3 handler,int exp1,int exp2,int exp3); | void assign(std::string const ®ex,handler3 handler,int ex p1,int exp2,int exp3); | |||
/// | /// | |||
/// Assign \a handler to pattern \a regex thus if URL that m atches | /// Assign \a handler to pattern \a regex thus if URL that m atches | |||
/// this pattern requested, \a handler is called with 1st, 2 nd, 3rd and 4th parameters | /// this pattern requested, \a handler is called with 1st, 2 nd, 3rd and 4th parameters | |||
/// the string that was matched at position \a exp1, \a exp2 , \a exp3 and \a exp4 | /// the string that was matched at position \a exp1, \a exp2 , \a exp3 and \a exp4 | |||
/// | /// | |||
void assign(std::string regex,handler4 handler,int exp1,int exp2,int exp3,int exp4); | void assign(std::string const ®ex,handler4 handler,int ex p1,int exp2,int exp3,int exp4); | |||
/// | /// | |||
/// Try to find match between \a url and registered handlers and applications. | /// Try to find match between \a url and registered handlers and applications. | |||
/// If the match was found, it returns the method, how handl er should bd dispatched | /// If the match was found, it returns the method, how handl er should bd dispatched | |||
/// synchronous or asynchronous, meaning the handler would b e executed in thread pool | /// synchronous or asynchronous, meaning the handler would b e executed in thread pool | |||
/// or in the main non-blocking loop | /// or in the main non-blocking loop | |||
/// | /// | |||
bool dispatch(std::string url); | bool dispatch(std::string url); | |||
url_dispatcher(); | url_dispatcher(); | |||
~url_dispatcher(); | ~url_dispatcher(); | |||
/// | /// | |||
/// This template function is a shortcut to assign(regex,cal lback). It allows | /// This template function is a shortcut to assign(regex,cal lback). It allows | |||
/// assignment of \a member function of an \a object with si gnature void handler() | /// assignment of \a member function of an \a object with si gnature void handler() | |||
/// as simple as assign(expr,&bar::foo,this); | /// as simple as assign(expr,&bar::foo,this); | |||
/// | /// | |||
/// In addition to calling \a member function it calls objec | ||||
t->init() before call | ||||
/// and object->clean() after the call of the C is derived f | ||||
rom cppcms::application | ||||
/// | ||||
template<typename C> | template<typename C> | |||
void assign(std::string regex,void (C::*member)(),C *object) | void assign(std::string const ®ex,void (C::*member)(),C * object) | |||
{ | { | |||
assign(regex,util::mem_bind(member,object)); | assign(regex,binder0<C>(member,object)); | |||
} | } | |||
/// | /// | |||
/// This template function is a shortcut to assign(regex,cal lback,int). It allows | /// This template function is a shortcut to assign(regex,cal lback,int). It allows | |||
/// assignment of \a member function of an \a object with si gnature void handler(string) | /// assignment of \a member function of an \a object with si gnature void handler(string) | |||
/// | /// | |||
/// In addition to calling \a member function it calls objec | ||||
t->init() before call | ||||
/// and object->clean() after the call of the C is derived f | ||||
rom cppcms::application | ||||
/// | ||||
template<typename C> | template<typename C> | |||
void assign(std::string regex,void (C::*member)(std::string) ,C *object,int e1) | void assign(std::string const ®ex,void (C::*member)(std:: string),C *object,int e1) | |||
{ | { | |||
assign(regex,util::mem_bind(member,object),e1); | assign(regex,binder1<C>(member,object),e1); | |||
} | } | |||
/// | /// | |||
/// This template function is a shortcut to assign(regex,cal lback,int,int). It allows | /// This template function is a shortcut to assign(regex,cal lback,int,int). It allows | |||
/// assignment of \a member function of an \a object with si gnature void handler(string,string) | /// assignment of \a member function of an \a object with si gnature void handler(string,string) | |||
/// | /// | |||
/// In addition to calling \a member function it calls objec | ||||
t->init() before call | ||||
/// and object->clean() after the call of the C is derived f | ||||
rom cppcms::application | ||||
/// | ||||
template<typename C> | template<typename C> | |||
void assign(std::string regex,void (C::*member)(std::string, std::string),C *object,int e1,int e2) | void assign(std::string const ®ex,void (C::*member)(std:: string,std::string),C *object,int e1,int e2) | |||
{ | { | |||
assign(regex,util::mem_bind(member,object),e1,e2); | assign(regex,binder2<C>(member,object),e1,e2); | |||
} | } | |||
template<typename C> | template<typename C> | |||
/// | /// | |||
/// This template function is a shortcut to assign(regex,cal lback,int,int,int). It allows | /// This template function is a shortcut to assign(regex,cal lback,int,int,int). It allows | |||
/// assignment of \a member function of an \a object with si gnature void handler(string,string,string) | /// assignment of \a member function of an \a object with si gnature void handler(string,string,string) | |||
/// | /// | |||
void assign(std::string regex,void (C::*member)(std::string, | /// In addition to calling \a member function it calls objec | |||
std::string,std::string),C *object,int e1,int e2,int e3) | t->init() before call | |||
/// and object->clean() after the call of the C is derived f | ||||
rom cppcms::application | ||||
/// | ||||
void assign(std::string const ®ex,void (C::*member)(std:: | ||||
string,std::string,std::string),C *object,int e1,int e2,int e3) | ||||
{ | { | |||
assign(regex,util::mem_bind(member,object),e1,e2,e3) ; | assign(regex,binder3<C>(member,object),e1,e2,e3); | |||
} | } | |||
/// | /// | |||
/// This template function is a shortcut to assign(regex,cal lback,int,int,int,int). It allows | /// This template function is a shortcut to assign(regex,cal lback,int,int,int,int). It allows | |||
/// assignment of \a member function of an \a object with si gnature void handler(string,string,string,string) | /// assignment of \a member function of an \a object with si gnature void handler(string,string,string,string) | |||
/// | /// | |||
/// In addition to calling \a member function it calls objec | ||||
t->init() before call | ||||
/// and object->clean() after the call of the C is derived f | ||||
rom cppcms::application | ||||
/// | ||||
template<typename C> | template<typename C> | |||
void assign(std::string regex,void (C::*member)(std::string, std::string,std::string,std::string),C *object,int e1,int e2,int e3,int e4) | void assign(std::string const ®ex,void (C::*member)(std:: string,std::string,std::string,std::string),C *object,int e1,int e2,int e3, int e4) | |||
{ | { | |||
assign(regex,util::mem_bind(member,object),e1,e2,e3, e4); | assign(regex,binder4<C>(member,object),e1,e2,e3,e4); | |||
} | } | |||
/// | ||||
/// Mount a sub application \a app to the URL dispatcher, us | ||||
ing regular expression match. | ||||
/// | ||||
/// When mounted the URL is checked against match expression | ||||
and then calls app.main(substr) where | ||||
/// substr is the matched subexpression part. For example: | ||||
/// | ||||
/// \code | ||||
/// dispatcher().mount("/formums((/.*)?)",forums,1); | ||||
/// \endcode | ||||
/// | ||||
/// For example: for url /forums/page/3 it would call \c for | ||||
ums::main with value "/page/3" | ||||
/// | ||||
void mount(std::string const &match,application &app,int par | ||||
t); | ||||
private: | private: | |||
friend class application; | template<typename C,typename Enable = void> | |||
void mount(std::string match,application &app,int part); | class page_guard { | |||
public: | ||||
page_guard(C * /*o*/) {} | ||||
}; | ||||
template<typename C> | ||||
class page_guard<C,typename booster::enable_if<booster::is_b | ||||
ase_of< cppcms::application,C> >::type > { | ||||
public: | ||||
page_guard(C *o) : | ||||
object_(o) | ||||
{ | ||||
object_->init(); | ||||
} | ||||
~page_guard() | ||||
{ | ||||
object_->clear(); | ||||
} | ||||
private: | ||||
application *object_; | ||||
}; | ||||
template<typename C> | ||||
struct binder0{ | ||||
typedef void (C::*member_type)(); | ||||
member_type member; | ||||
C *object; | ||||
binder0(member_type m,C *o) : | ||||
member(m), | ||||
object(o) | ||||
{ | ||||
} | ||||
void operator()() const | ||||
{ | ||||
page_guard<C> guard(object); | ||||
(object->*member)(); | ||||
} | ||||
}; | ||||
template<typename C> | ||||
struct binder1{ | ||||
typedef void (C::*member_type)(std::string); | ||||
member_type member; | ||||
C *object; | ||||
binder1(member_type m,C *o) : | ||||
member(m), | ||||
object(o) | ||||
{ | ||||
} | ||||
void operator()(std::string p1) const | ||||
{ | ||||
page_guard<C> guard(object); | ||||
(object->*member)(p1); | ||||
} | ||||
}; | ||||
template<typename C> | ||||
struct binder2{ | ||||
typedef void (C::*member_type)(std::string,std::stri | ||||
ng); | ||||
member_type member; | ||||
C *object; | ||||
binder2(member_type m,C *o) : | ||||
member(m), | ||||
object(o) | ||||
{ | ||||
} | ||||
void operator()(std::string p1,std::string p2) const | ||||
{ | ||||
page_guard<C> guard(object); | ||||
(object->*member)(p1,p2); | ||||
} | ||||
}; | ||||
template<typename C> | ||||
struct binder3{ | ||||
typedef void (C::*member_type)(std::string,std::stri | ||||
ng,std::string); | ||||
member_type member; | ||||
C *object; | ||||
binder3(member_type m,C *o) : | ||||
member(m), | ||||
object(o) | ||||
{ | ||||
} | ||||
void operator()(std::string p1,std::string p2,std::s | ||||
tring p3) const | ||||
{ | ||||
page_guard<C> guard(object); | ||||
(object->*member)(p1,p2,p3); | ||||
} | ||||
}; | ||||
template<typename C> | ||||
struct binder4{ | ||||
typedef void (C::*member_type)(std::string,std::stri | ||||
ng,std::string,std::string); | ||||
member_type member; | ||||
C *object; | ||||
binder4(member_type m,C *o) : | ||||
member(m), | ||||
object(o) | ||||
{ | ||||
} | ||||
void operator()(std::string p1,std::string p2,std::s | ||||
tring p3,std::string p4) const | ||||
{ | ||||
page_guard<C> guard(object); | ||||
(object->*member)(p1,p2,p3,p4); | ||||
} | ||||
}; | ||||
struct _data; | struct _data; | |||
booster::hold_ptr<_data> d; | booster::hold_ptr<_data> d; | |||
}; | }; | |||
} // cppcms | } // cppcms | |||
#endif | #endif | |||
End of changes. 22 change blocks. | ||||
19 lines changed or deleted | 177 lines changed or added | |||
util.h | util.h | |||
---|---|---|---|---|
// | // | |||
// Copyright (c) 2009-2010 Artyom Beilis (Tonkikh) | // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) | |||
// | // | |||
// Distributed under the Boost Software License, Version 1.0. (See | // Distributed under the Boost Software License, Version 1.0. (See | |||
// accompanying file LICENSE_1_0.txt or copy at | // accompanying file LICENSE_1_0.txt or copy at | |||
// http://www.boost.org/LICENSE_1_0.txt) | // http://www.boost.org/LICENSE_1_0.txt) | |||
// | // | |||
#ifndef BOOSTER_LOCALE_UTIL_HPP | #ifndef BOOSTER_LOCALE_UTIL_HPP | |||
#define BOOSTER_LOCALE_UTIL_HPP | #define BOOSTER_LOCALE_UTIL_HPP | |||
#include <locale> | #include <locale> | |||
#include <booster/cstdint.h> | #include <booster/cstdint.h> | |||
#include <booster/locale/generator.h> | #include <booster/locale/generator.h> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
view.h | view.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
// You should have received a copy of the GNU Lesser General Public Licens e | // You should have received a copy of the GNU Lesser General Public Licens e | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | // along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// | // | |||
/////////////////////////////////////////////////////////////////////////// //// | /////////////////////////////////////////////////////////////////////////// //// | |||
#ifndef CPPCMS_VIEW_H | #ifndef CPPCMS_VIEW_H | |||
#define CPPCMS_VIEW_H | #define CPPCMS_VIEW_H | |||
#include <cppcms/form.h> | #include <cppcms/form.h> | |||
#include <cppcms/filters.h> | #include <cppcms/filters.h> | |||
#include <cppcms/base_view.h> | #include <cppcms/base_view.h> | |||
#include <cppcms/views_pool.h> | #include <cppcms/views_pool.h> | |||
#include <cppcms/application.h> | ||||
#include <cppcms/url_mapper.h> | ||||
#include <cppcms/copy_filter.h> | ||||
#include <cppcms/cache_interface.h> | ||||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added | |||
views_pool.h | views_pool.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
typedef std::auto_ptr<base_view> (*view_factory_type)(std::o stream &,base_content *c); | typedef std::auto_ptr<base_view> (*view_factory_type)(std::o stream &,base_content *c); | |||
typedef std::map<std::string,view_factory_type> mapping_type ; | typedef std::map<std::string,view_factory_type> mapping_type ; | |||
template<typename View,typename Content> | template<typename View,typename Content> | |||
static std::auto_ptr<base_view> view_builder(std::ostream &s tream,base_content *c) | static std::auto_ptr<base_view> view_builder(std::ostream &s tream,base_content *c) | |||
{ | { | |||
std::auto_ptr<base_view> p(new View(stream,dynamic_c ast<Content &>(*c))); | std::auto_ptr<base_view> p(new View(stream,dynamic_c ast<Content &>(*c))); | |||
return p; | return p; | |||
}; | }; | |||
template<typename View,typename Content> | ||||
static std::auto_ptr<base_view> unsafe_view_builder(std::ost | ||||
ream &stream,base_content *c) | ||||
{ | ||||
std::auto_ptr<base_view> p(new View(stream,static_ca | ||||
st<Content &>(*c))); | ||||
return p; | ||||
}; | ||||
views_pool(); | views_pool(); | |||
views_pool(json::value const &settings); | views_pool(json::value const &settings); | |||
~views_pool(); | ~views_pool(); | |||
void add_view(std::string skin,mapping_type const &mapping); | void add_view(std::string skin,mapping_type const &mapping); | |||
void remove_view(std::string skin); | void remove_view(std::string skin); | |||
static views_pool &static_instance(); | static views_pool &static_instance(); | |||
/// \endcond | /// \endcond | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 9 lines changed or added | |||