views_pool.h   views_pool.h 
skipping to change at line 14 skipping to change at line 14
// //
// See accompanying file COPYING.TXT file for licensing details. // See accompanying file COPYING.TXT file for licensing details.
// //
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
#ifndef CPPCMS_VIEWS_POOL_H #ifndef CPPCMS_VIEWS_POOL_H
#define CPPCMS_VIEWS_POOL_H #define CPPCMS_VIEWS_POOL_H
#include <cppcms/defs.h> #include <cppcms/defs.h>
#include <booster/noncopyable.h> #include <booster/noncopyable.h>
#include <cppcms/base_view.h> #include <cppcms/base_view.h>
#include <cppcms/cppcms_error.h>
#include <memory> #include <memory>
#include <map> #include <map>
#include <vector> #include <vector>
#include <ostream> #include <ostream>
namespace cppcms { namespace cppcms {
namespace json { class value; } namespace json { class value; }
skipping to change at line 58 skipping to change at line 59
/// ///
/// Usually used by templates generator /// Usually used by templates generator
/// ///
template<typename View,typename Content> template<typename View,typename Content>
void add_view(std::string const &view_name,bool safe = true) void add_view(std::string const &view_name,bool safe = true)
{ {
view_factory_type *factory = 0; view_factory_type *factory = 0;
if(safe) if(safe)
factory = view_builder<View,Content> ; factory = view_builder<View,Content> ;
else else
factory = view_builder<View,Content> ; factory = unsafe_view_builder<View,C ontent>;
add_factory(view_name,factory); add_factory(view_name,factory);
} }
/// ///
/// Add a view that uses a callback /// Add a view that uses a callback
/// ///
void add_factory(std::string const &name,view_factor y_type *factory); void add_factory(std::string const &name,view_factor y_type *factory);
/// ///
/// Get skin name /// Get skin name
/// ///
skipping to change at line 86 skipping to change at line 87
/// a content \a content. /// a content \a content.
/// ///
std::auto_ptr<base_view> create(std::string const &v iew_name, std::auto_ptr<base_view> create(std::string const &v iew_name,
std::ostream &output , std::ostream &output ,
base_content *conten t) const; base_content *conten t) const;
private: private:
template<typename View,typename Content> template<typename View,typename Content>
static std::auto_ptr<base_view> view_builder(std::os tream &stream,base_content *c) static std::auto_ptr<base_view> view_builder(std::os tream &stream,base_content *c)
{ {
std::auto_ptr<base_view> p(new View(stream,d std::auto_ptr<base_view> p;
ynamic_cast<Content &>(*c)));
try {
p.reset(new View(stream,dynamic_cast
<Content &>(*c)));
}
catch(std::bad_cast const &) {
throw cppcms_error("cppcms::views::g
enerator: an attempt to use content if invalid type");
}
return p; return p;
} }
template<typename View,typename Content> template<typename View,typename Content>
static std::auto_ptr<base_view> unsafe_view_builder( std::ostream &stream,base_content *c) static std::auto_ptr<base_view> unsafe_view_builder( std::ostream &stream,base_content *c)
{ {
std::auto_ptr<base_view> p(new View(stream,s tatic_cast<Content &>(*c))); std::auto_ptr<base_view> p(new View(stream,s tatic_cast<Content &>(*c)));
return p; return p;
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 12 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/