From da1de0055e2c0e77acf7c5e3e2c6f19c7ee28baf Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 22 Sep 2008 07:30:48 +0000 Subject: [PATCH] Get rid of unused SessionInfoSection. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26492 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Session.cpp | 60 ------------------------------------------------- src/Session.h | 38 ------------------------------- 2 files changed, 98 deletions(-) diff --git a/src/Session.cpp b/src/Session.cpp index 8bd1bc92de..f09d2f6b73 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -291,63 +291,6 @@ BookmarksSection::Bookmark const & BookmarksSection::bookmark(unsigned int i) co } -void SessionInfoSection::read(istream & is) -{ - string tmp; - do { - char c = is.peek(); - if (c == '[') - break; - getline(is, tmp); - if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ') - continue; - - try { - // Read session info, saved as key/value pairs - // would better yell if pos returns npos - string::size_type pos = tmp.find_first_of(" = "); - // silently ignore lines without " = " - if (pos != string::npos) { - string key = tmp.substr(0, pos); - string value = tmp.substr(pos + 3); - sessioninfo[key] = value; - } else - LYXERR(Debug::INIT, "LyX: Warning: Ignore session info: " << tmp); - } catch (...) { - LYXERR(Debug::INIT, "LyX: Warning: unknown Session info: " << tmp); - } - } while (is.good()); -} - - -void SessionInfoSection::write(ostream & os) const -{ - os << '\n' << sec_session << '\n'; - for (MiscInfo::const_iterator val = sessioninfo.begin(); - val != sessioninfo.end(); ++val) { - os << val->first << " = " << val->second << '\n'; - } -} - - -void SessionInfoSection::save(string const & key, string const & value) -{ - sessioninfo[key] = value; -} - - -string const SessionInfoSection::load(string const & key, bool release) -{ - MiscInfo::const_iterator pos = sessioninfo.find(key); - string value; - if (pos != sessioninfo.end()) - value = pos->second; - if (release) - sessioninfo.erase(key); - return value; -} - - Session::Session(unsigned int num) : last_files(num) { @@ -380,8 +323,6 @@ void Session::readFile() lastFilePos().read(is); else if (tmp == sec_bookmarks) bookmarks().read(is); - else if (tmp == sec_session) - sessionInfo().read(is); else LYXERR(Debug::INIT, "LyX: Warning: unknown Session section: " << tmp); } @@ -399,7 +340,6 @@ void Session::writeFile() const lastOpened().write(os); lastFilePos().write(os); bookmarks().write(os); - sessionInfo().write(os); } else LYXERR(Debug::INIT, "LyX: Warning: unable to save Session: " << session_file); diff --git a/src/Session.h b/src/Session.h index 772027ec80..2b1e216570 100644 --- a/src/Session.h +++ b/src/Session.h @@ -263,38 +263,6 @@ private: }; -class SessionInfoSection : SessionSection -{ -public: - /// - typedef std::map MiscInfo; - -public: - /// - void read(std::istream & is); - - /// - void write(std::ostream & os) const; - - /** set session info - @param key key of the value to store - @param value value, a string without newline ('\n') - */ - void save(std::string const & key, std::string const & value); - - /** load session info - @param key a key to extract value from the session file - @param release whether or not clear the value. Default to true - since most of such values are supposed to be used only once. - */ - std::string const load(std::string const & key, bool release = true); - -private: - /// a map to save session info - MiscInfo sessioninfo; -}; - - class Session { public: @@ -318,10 +286,6 @@ public: BookmarksSection & bookmarks() { return bookmarks_; } /// BookmarksSection const & bookmarks() const { return bookmarks_; } - /// - SessionInfoSection & sessionInfo() { return session_info; } - /// - SessionInfoSection const & sessionInfo() const { return session_info; } private: friend class LyX; @@ -347,8 +311,6 @@ private: LastFilePosSection last_file_pos; /// BookmarksSection bookmarks_; - /// - SessionInfoSection session_info; }; /// This is a singleton class. Get the instance. -- 2.39.5