]> git.lyx.org Git - features.git/commitdiff
Get rid of unused SessionInfoSection.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 22 Sep 2008 07:30:48 +0000 (07:30 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 22 Sep 2008 07:30:48 +0000 (07:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26492 a592a061-630c-0410-9148-cb99ea01b6c8

src/Session.cpp
src/Session.h

index 8bd1bc92de9f4e043c8d4eeffd8068d398c0defd..f09d2f6b73b87de539420c485d2052b792ddac90 100644 (file)
@@ -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);
index 772027ec80c4c340de12093e267641870c2ee677..2b1e216570481b3258708fafcf349c4d818bb2cd 100644 (file)
@@ -263,38 +263,6 @@ private:
 };
 
 
-class SessionInfoSection : SessionSection
-{
-public:
-       ///
-       typedef std::map<std::string, std::string> 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.