Esempio n. 1
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("");
   }
 }
Esempio n. 2
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
  }
Esempio n. 3
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);
     }
   }  
 }
Esempio n. 4
0
 void save(basic_session<T>& sesh)
 {
   std::ofstream ofs(
       (save_dir + "/" + sesh.id() + ".arc").c_str());
   if (ofs) {
     boost::archive::text_oarchive archive(ofs);
     archive<< static_cast<typename basic_session<T>::value_type&>(sesh);
   }
 }
Esempio n. 5
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);
   }
 }