Пример #1
0
 void start(basic_session<T>& sesh, string_type const& ssid = "")
 {
   if (!sesh.loaded() && sesh.id().empty())
   {
     if (!ssid.empty()) {
       sesh.id(ssid);
       load(sesh);
     } else {
       sesh.id(make_session_id());
       sesh.loaded(true);
     }
   }  
 }
Пример #2
0
 void load(basic_session<T>& sesh)
 {
   std::ifstream ifs(
       (save_dir + "/" + sesh.id() + ".arc").c_str());
   if (ifs) {
     boost::archive::text_iarchive archive(ifs);
     archive>> static_cast<typename basic_session<T>::value_type&>(sesh);
     sesh.loaded(true);
   }
 }
Пример #3
0
 void stop(basic_session<T>& sesh)
 {
   namespace fs = boost::filesystem;
   if (sesh.loaded()) {
     fs::path file (save_dir + sesh.id() + ".arc");
     if (fs::exists(file))
       fs::remove(file);
     sesh.id("");
   }
 }
Пример #4
0
  void stop(basic_session<T>& sesh)
  {
#ifndef BOOST_CGI_NO_BOOST_FILESYSTEM
    namespace fs = boost::filesystem;
    if (sesh.loaded()) {
      fs::path file (save_dir + sesh.id() + ".arc");
      if (fs::exists(file))
        fs::remove(file);
      sesh.id("");
    }
#endif // BOOST_CGI_NO_BOOST_FILESYSTEM
  }