From: Lars Gullik Bjønnes Date: Mon, 31 Jul 2000 16:39:50 +0000 (+0000) Subject: small changes read ChangeLog X-Git-Tag: 1.6.10~22066 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7110b8eda4ab2dc3e87c53c89225caaff972f9eb;p=features.git small changes read ChangeLog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@941 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index 2dc2c23bf4..bfd2adaed4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2000-07-31 Lars Gullik Bjønnes + + * src/support/translator.h (equal_1st_in_pair::operator()): take + const ref pair_type as arg. + (equal_2nd_in_pair::operator()): ditto + (Translator::~Translator): remove empty d-tor. + + * src/graphics/GraphicsCache.C: move include config.h to top, also + put initialization of GraphicsCache::singleton here. + (~GraphicsCache): move here + (addFile): take const ref as arg + (removeFile): ditto + + * src/lyxlex_pimpl.C (setFile): comment in old behaviour + + * src/BufferView2.C (insertLyXFile): change te with/without header + check slightly. + 2000-07-31 Jean-Marc Lasgouttes * src/frontends/xforms/FormGraphics.C (apply): add some diff --git a/po/POTFILES.in b/po/POTFILES.in index 142c74d2a0..84a5cee92b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -26,7 +26,6 @@ src/ext_l10n.h src/filedlg.C src/FontLoader.C src/form1.C -src/frontends/gnome/Menubar_pimpl.C src/frontends/xforms/FormCitation.C src/frontends/xforms/form_citation.C src/frontends/xforms/FormCopyright.C @@ -37,12 +36,6 @@ src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_preferences.C src/frontends/xforms/FormPrint.C src/frontends/xforms/form_print.C -src/frontends/xforms/forms/form_citation.C -src/frontends/xforms/forms/form_copyright.C -src/frontends/xforms/forms/form_preferences.C -src/frontends/xforms/forms/form_print.C -src/frontends/xforms/forms/form_tabular.C -src/frontends/xforms/forms/form_url.C src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular.C src/frontends/xforms/FormUrl.C diff --git a/src/BufferView2.C b/src/BufferView2.C index c8675a0a1c..f241071ed2 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -73,10 +73,11 @@ bool BufferView::insertLyXFile(string const & filen) MakeDisplayPath(fname, 50)); return false; } + + char c = ifs.peek(); + LyXLex lex(0, 0); lex.setStream(ifs); - char c; ifs.get(c); - ifs.putback(c); bool res = true; diff --git a/src/graphics/GraphicsCache.C b/src/graphics/GraphicsCache.C index a52e7291f3..1721b0c6f3 100644 --- a/src/graphics/GraphicsCache.C +++ b/src/graphics/GraphicsCache.C @@ -9,13 +9,18 @@ * This file Copyright 2000 Baruch Even * ================================================= */ +#include + #ifdef __GNUG__ #pragma implementation #endif -#include #include "GraphicsCache.h" + +GraphicsCache * GraphicsCache::singleton = 0; + + GraphicsCache * GraphicsCache::getInstance() { @@ -27,8 +32,14 @@ GraphicsCache::getInstance() } +GraphicsCache::~GraphicsCache() +{ + delete singleton; +} + + GraphicsCacheItem * -GraphicsCache::addFile(string filename) +GraphicsCache::addFile(string const & filename) { CacheType::const_iterator it = cache.find(filename); @@ -39,8 +50,9 @@ GraphicsCache::addFile(string filename) return 0; } + void -GraphicsCache::removeFile(string filename) +GraphicsCache::removeFile(string const & filename) { CacheType::const_iterator it = cache.find(filename); diff --git a/src/graphics/GraphicsCache.h b/src/graphics/GraphicsCache.h index 881a90d13b..d64df5f5d3 100644 --- a/src/graphics/GraphicsCache.h +++ b/src/graphics/GraphicsCache.h @@ -33,19 +33,17 @@ public: static GraphicsCache * getInstance(); /// Add a file to the cache. - GraphicsCacheItem * addFile(string filename); + GraphicsCacheItem * addFile(string const & filename); private: /// Remove a cache item if it's count has gone to zero. - void removeFile(string filename); + void removeFile(string const & filename); /// Private c-tor so we can control how many objects are instantiated. GraphicsCache() {} /// Private d-tor so that no-one will destroy us. - ~GraphicsCache() { - delete singleton; - } + ~GraphicsCache(); /// Holder of the single instance of the class. static GraphicsCache * singleton; @@ -53,7 +51,4 @@ private: typedef std::map CacheType; CacheType cache; }; - -GraphicsCache * GraphicsCache::singleton = 0; - #endif diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index 172c2e33bb..c2704e62cb 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -9,10 +9,11 @@ * This file Copyright 2000 Baruch Even * ================================================= */ +#include + #ifdef __GNUG__ #pragma implementation #endif -#include #include "GraphicsCacheItem.h" diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index da347f3d02..e139fbffc4 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -16,13 +16,13 @@ #pragma interface #endif +/// class GraphicsCacheItem { public: - ~GraphicsCacheItem() {} - private: + /// GraphicsCacheItem() {} - + // friend class GraphicsCache; }; diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index f12f119e46..7da1fbef10 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -114,11 +114,11 @@ void LyXLex::Pimpl::popTable() bool LyXLex::Pimpl::setFile(string const & filename) { - //if (fb__.is_open()) - // lyxerr << "Error in LyXLex::setFile: " - // "file or stream already set." << endl; + if (fb__.is_open()) + lyxerr << "Error in LyXLex::setFile: " + "file or stream already set." << endl; fb__.open(filename.c_str(), ios::in); - //is.rdbuf(&fb__); + is.rdbuf(&fb__); name = filename; lineno = 0; return fb__.is_open() && is.good(); diff --git a/src/lyxlex_pimpl.h b/src/lyxlex_pimpl.h index 2991328f79..0e1b1f265c 100644 --- a/src/lyxlex_pimpl.h +++ b/src/lyxlex_pimpl.h @@ -33,34 +33,33 @@ struct LyXLex::Pimpl { /// int table_siz; }; - + /// Pimpl(keyword_item * tab, int num); - + /// string GetString() const; - + /// void printError(string const & message) const; - + /// void printTable(std::ostream & os); - + /// void pushTable(keyword_item * tab, int num); - + /// void popTable(); - + /// bool setFile(string const & filename); - + /// void setStream(std::istream & i); - + /// bool next(bool esc = false); - /// int search_kw(char const * const tag) const; - + /// int lex(); - + /// bool EatLine(); - + /// bool nextToken(); - + /// void pushToken(string const &); /// fb__ is only used to open files, the stream is accessed through is diff --git a/src/support/translator.h b/src/support/translator.h index 2170d5fa6a..7c6fcdf360 100644 --- a/src/support/translator.h +++ b/src/support/translator.h @@ -25,7 +25,7 @@ public: equal_1st_in_pair(T1 const & value) : value_(value) {} typedef std::pair pair_type; - bool operator() (pair_type p) const { + bool operator() (pair_type const & p) const { return p.first == value_; } private: @@ -38,7 +38,7 @@ public: equal_2nd_in_pair(T2 const & value) : value_(value) {} typedef std::pair pair_type; - bool operator() (pair_type p) const { + bool operator() (pair_type const & p) const { return p.second == value_; } private: @@ -62,8 +62,6 @@ public: Translator(T1 const & t1, T2 const & t2) : default_t1(t1), default_t2(t2) {} - /// d-tor. Not virtual since it's not going to be inherited. - ~Translator() {} /// Add a mapping to the translator. void addPair(T1 const & first, T2 const & second) {