]> git.lyx.org Git - features.git/commitdiff
cosmetics. mainly replace #include "dostring.h" by #include "strfwd.h"
authorAndré Pönitz <poenitz@gmx.net>
Thu, 1 Nov 2007 22:17:22 +0000 (22:17 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 1 Nov 2007 22:17:22 +0000 (22:17 +0000)
in header files when possible. Adjust .cpp files.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21358 a592a061-630c-0410-9148-cb99ea01b6c8

70 files changed:
src/Author.h
src/BiblioInfo.cpp
src/Bidi.cpp
src/Bidi.h
src/Box.h
src/Buffer.cpp
src/Buffer.h
src/BufferParams.cpp
src/Changes.cpp
src/Changes.h
src/CmdDef.h
src/Cursor.cpp
src/Cursor.h
src/CursorSlice.h
src/DocIterator.h
src/Font.h
src/FontIterator.h
src/FuncRequest.h
src/KeyMap.cpp
src/KeyMap.h
src/Lexer.h
src/LyXFunc.cpp
src/LyXRC.h
src/MenuBackend.cpp
src/MenuBackend.h
src/PDFOptions.cpp
src/PDFOptions.h
src/Paragraph.h
src/ParagraphParameters.h
src/Spacing.h
src/Text.cpp
src/TocBackend.h
src/frontends/qt4/GuiViewSource.cpp
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetBibitem.cpp
src/insets/InsetBibtex.cpp
src/insets/InsetFloat.cpp
src/insets/InsetFootlike.cpp
src/insets/InsetGraphics.cpp
src/insets/InsetHyperlink.cpp
src/insets/InsetInclude.cpp
src/insets/InsetInfo.cpp
src/insets/InsetLine.cpp
src/insets/InsetListings.cpp
src/insets/InsetNewline.cpp
src/insets/InsetNomencl.cpp
src/insets/InsetNote.cpp
src/insets/InsetOptArg.cpp
src/insets/InsetQuotes.cpp
src/insets/InsetQuotes.h
src/insets/InsetRef.cpp
src/insets/InsetRef.h
src/insets/InsetSpace.cpp
src/insets/InsetSpecialChar.cpp
src/insets/InsetTabular.cpp
src/insets/InsetVSpace.cpp
src/insets/InsetWrap.cpp
src/lfuns.h
src/mathed/InsetMathNest.cpp
src/output_docbook.h
src/output_plaintext.h
src/pch.h
src/sgml.cpp
src/sgml.h
src/support/docstring.h
src/support/environment.cpp
src/support/getcwd.cpp
src/support/strfwd.h
src/support/userinfo.cpp

index 6842cf35caa217ca9ce05cdb5511fa62f8c49f61..0f1e49e7a7ee8fd209c9c8af6e4e6371a8d88128 100644 (file)
 #include "support/docstring.h"
 
 #include <map>
-#include <iosfwd>
 
 
 namespace lyx {
 
-
 class Author {
 public:
+       ///
        Author() {}
-
+       ///
        Author(docstring const & name, docstring const & email)
                : name_(name), email_(email), used_(true) {}
-
-       docstring const name() const {
-               return name_;
-       }
-
-       docstring const email() const {
-               return email_;
-       }
-
-       void used(bool u) const {
-               used_ = u;
-       }
-
-       bool used() const {
-               return used_;
-       }
-
+       ///
+       docstring name() const { return name_; }
+       ///
+       docstring email() const { return email_; }
+       ///
+       void setUsed(bool u) const { used_ = u; }
+       ///
+       bool used() const { return used_; }
+       ///
        friend std::istream & operator>>(std::istream & os, Author & a);
 
 private:
+       /// The author's name
        docstring name_;
-
+       /// The author's email address
        docstring email_;
-
+       ///
        mutable bool used_;
 };
 
 
 class AuthorList {
 public:
+       ///
        AuthorList();
-
+       ///
        int record(Author const & a);
-
+       ///
        void record(int id, Author const & a);
-
+       ///
        Author const & get(int id) const;
-
+       ///
        typedef std::map<int, Author> Authors;
-
+       ///
        Authors::const_iterator begin() const;
-
+       ///
        Authors::const_iterator end() const;
-
+       ///
 private:
+       ///
        int last_id_;
-
+       ///
        Authors authors_;
 };
 
index 6f6f3ee68a3706b03cea50163f1b7b051104db9f..a6113cf509b1a5fec1ef594ef9e802a503c1a43c 100644 (file)
@@ -26,6 +26,7 @@
 #include "insets/InsetInclude.h"
 
 #include "support/lstrings.h"
+#include "support/docstream.h"
 
 #include "boost/regex.hpp"
 
index 00aa9fcd7c9bc368910d41e6d59dbf246cf75dbd..d00b8eb72dada03a17df1f93f148deb2d4ba2bd6 100644 (file)
@@ -13,6 +13,7 @@
 #include "Bidi.h"
 #include "Buffer.h"
 #include "BufferView.h"
+#include "Cursor.h"
 #include "Font.h"
 #include "Row.h"
 #include "LyXRC.h"
@@ -127,10 +128,11 @@ void Bidi::computeTables(Paragraph const & par,
                        new_level = rtl_par ? 1 : 0;
                        new_rtl0 = rtl_par;
                        new_rtl = rtl_par;
-               } else if (new_rtl0)
+               } else if (new_rtl0) {
                        new_level = new_rtl ? 1 : 2;
-               else
+               } else {
                        new_level = rtl_par ? 2 : 0;
+               }
 
                if (is_space && new_level >= lev) {
                        new_level = lev;
@@ -147,8 +149,9 @@ void Bidi::computeTables(Paragraph const & par,
                        log2vis_list_[lpos - start_] = rtl ? -1 : 1;
                        if (new_level > 0 && !rtl_par)
                                same_direction_ = false;
-               } else
+               } else {
                        log2vis_list_[lpos - start_] = new_rtl ? -1 : 1;
+               }
                rtl = new_rtl;
                rtl0 = new_rtl0;
                levels_[lpos - start_] = new_level;
index 2fdb3abad341c249e083b2450fd16510c94b778d..dfa779ae4947d13a4d4f24c6de9a1c0f99e15b05 100644 (file)
 #define BIDI_H
 
 #include "support/types.h"
-#include "Cursor.h"
+
 #include <vector>
 
 
 namespace lyx {
 
 class Buffer;
+class Cursor;
 class Paragraph;
 class Row;
 class Font;
index 7b9bb819bdfa3efe175817892786037f1f7555b5..c362fa6a387e3deb2f14b42025ed9a07fa131e65 100644 (file)
--- a/src/Box.h
+++ b/src/Box.h
@@ -12,7 +12,7 @@
 #ifndef BOX_H
 #define BOX_H
 
-#include <iosfwd>
+#include "support/strfwd.h"
 
 
 namespace lyx {
index 2e2dc5fc4fcb5503832df364050a7236231bfee4..fa6dc704f8173e3d01038dbaea4dd18df5e444cf 100644 (file)
@@ -401,12 +401,15 @@ string Buffer::latexName(bool const no_path) const
 }
 
 
-pair<Buffer::LogType, string> Buffer::logName() const
+string Buffer::logName(LogType * type) const
 {
        string const filename = latexName(false);
 
-       if (filename.empty())
-               return make_pair(Buffer::latexlog, string());
+       if (filename.empty()) {
+               if (type)
+                       *type = latexlog;
+               return string();
+       }
 
        string const path = temppath();
 
@@ -423,10 +426,14 @@ pair<Buffer::LogType, string> Buffer::logName() const
        if (bname.exists() &&
            (!fname.exists() || fname.lastModified() < bname.lastModified())) {
                LYXERR(Debug::FILES) << "Log name calculated as: " << bname << endl;
-               return make_pair(Buffer::buildlog, bname.absFilename());
+               if (type)
+                       *type = buildlog;
+               return bname.absFilename();
        }
        LYXERR(Debug::FILES) << "Log name calculated as: " << fname << endl;
-       return make_pair(Buffer::latexlog, fname.absFilename());
+       if (type)
+                       *type = latexlog;
+       return fname.absFilename();
 }
 
 
@@ -947,7 +954,7 @@ bool Buffer::write(ostream & ofs) const
        AuthorList::Authors::const_iterator a_it = params().authors().begin();
        AuthorList::Authors::const_iterator a_end = params().authors().end();
        for (; a_it != a_end; ++a_it)
-               a_it->second.used(false);
+               a_it->second.setUsed(false);
 
        ParIterator const end = par_iterator_end();
        ParIterator it = par_iterator_begin();
index d713c8ac0f037db54903b0c501e7f933380f47db..568a28d162818e1372a12d0afddf44e498b6c9a8 100644 (file)
 #include "insets/InsetCode.h"
 
 #include "support/FileName.h"
-#include "support/docstring.h"
-#include "support/docstream.h"
+#include "support/strfwd.h"
 #include "support/types.h"
 
-#include <iosfwd>
 #include <string>
-#include <utility>
 #include <vector>
 
 
@@ -252,7 +249,7 @@ public:
        std::string latexName(bool no_path = true) const;
 
        /// Get thee name and type of the log.
-       std::pair<LogType, std::string> logName() const;
+       std::string logName(LogType * type = 0) const;
 
        /// Change name of buffer. Updates "read-only" flag.
        void setFileName(std::string const & newfile);
index 3fff39e20ba45f22d581697a12fef0695ac80c0f..b2dd1da2573c63cf39a896a7012c00c84dcbc065 100644 (file)
@@ -42,6 +42,7 @@
 #include "insets/InsetListingsParams.h"
 
 #include "support/convert.h"
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/Translator.h"
 #include "support/lstrings.h"
index d0356b8895ead3e34c9ba641f904004d0a73d87e..ea99b7fc6d71f6b27afd2a738dd9d5a8be5a2402 100644 (file)
@@ -41,13 +41,11 @@ namespace lyx {
 
 bool Change::isSimilarTo(Change const & change)
 {
-       if (type != change.type) {
+       if (type != change.type)
                return false;
-       }
 
-       if (type == Change::UNCHANGED) {
+       if (type == Change::UNCHANGED)
                return true;
-       }
 
        return author == change.author;
 }
@@ -55,17 +53,14 @@ bool Change::isSimilarTo(Change const & change)
 
 bool operator==(Change const & l, Change const & r)
 {
-       if (l.type != r.type) {
+       if (l.type != r.type)
                return false;
-       }
 
        // two changes of type UNCHANGED are always equal
-       if (l.type == Change::UNCHANGED) {
+       if (l.type == Change::UNCHANGED)
                return true;
-       }
 
-       return l.author == r.author &&
-              l.changetime == r.changetime;
+       return l.author == r.author && l.changetime == r.changetime;
 }
 
 
@@ -154,9 +149,8 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en
                }
 
                // new change precedes existing change
-               if (it->range.start >= end) {
+               if (it->range.start >= end)
                        break;
-               }
 
                // new change intersects with existing change
                it->range.start = end;
@@ -179,13 +173,11 @@ void Changes::erase(pos_type const pos)
 
        for (; it != end; ++it) {
                // range (pos,pos+x) becomes (pos,pos+x-1)
-               if (it->range.start > pos) {
+               if (it->range.start > pos)
                        --(it->range.start);
-               }
                // range (pos-x,pos) stays (pos-x,pos)
-               if (it->range.end > pos) {
+               if (it->range.end > pos)
                        --(it->range.end);
-               }
        }
 
        merge();
@@ -204,14 +196,12 @@ void Changes::insert(Change const & change, lyx::pos_type pos)
 
        for (; it != end; ++it) {
                // range (pos,pos+x) becomes (pos+1,pos+x+1)
-               if (it->range.start >= pos) {
+               if (it->range.start >= pos)
                        ++(it->range.start);
-               }
 
                // range (pos-x,pos) stays as it is
-               if (it->range.end > pos) {
+               if (it->range.end > pos)
                        ++(it->range.end);
-               }
        }
 
        set(change, pos, pos + 1); // set will call merge
@@ -362,7 +352,7 @@ void Changes::checkAuthors(AuthorList const & authorList)
        ChangeTable::const_iterator endit = table_.end();
        for ( ; it != endit ; ++it) 
                if (it->change.type != Change::UNCHANGED)
-                       authorList.get(it->change.author).used(true);
+                       authorList.get(it->change.author).setUsed(true);
 }
 
 } // namespace lyx
index e08221e338a8be7ca9727073c835e47442af2a9b..395e6e8d654a422b5807ae23341efa99f186d891 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef CHANGES_H
 #define CHANGES_H
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 #include "support/types.h"
 #include "support/lyxtime.h"
 
index 9ef25fa5fe9168f445f708c94a47acba80c59df0..d7fe72e7d2d80036b8529233e156295453f0646a 100644 (file)
 
 #include "FuncRequest.h"
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 
 #include <boost/shared_ptr.hpp>
 
 #include <map>
+#include <string>
 
 
 namespace lyx {
index 2d8f777c6da1d692c625fd7a2c63908290ba0559..ac230a15e003cb2ca9ad18163e97f0e583bbce02 100644 (file)
@@ -675,7 +675,7 @@ bool Cursor::openable(MathAtom const & t) const
        // we can't move into anything new during selection
        if (depth() >= anchor_.depth())
                return false;
-       if (!ptr_cmp(t.nucleus(), &anchor_[depth()].inset()))
+       if (t.nucleus() != &anchor_[depth()].inset())
                return false;
 
        return true;
index 750b801fc74d21a33fad20cdd97baeb6fca585e9..1ee104cd52b8a6a9fcbcdb9d10c62c4315325b99 100644 (file)
@@ -17,7 +17,6 @@
 #include "Font.h"
 #include "Undo.h"
 
-#include <iosfwd>
 #include <vector>
 
 
index 94a2cb325110c0a3e6f7ed0c4106ecb2a085f3e1..be31f56a99cff5bf0709c28bd525ff8b82fa9f9c 100644 (file)
 #define CURSORSLICE_H
 
 #include "support/types.h"
+#include "support/strfwd.h"
 #include "insets/Inset.h"
 
-#include <cstddef>
-#include <iosfwd>
-
 
 namespace lyx {
 
index 1ffc262a4e49194a596c879751b94a1c3c25cab5..0531a23c6870bc07aca03a08621011673751c175 100644 (file)
@@ -15,7 +15,6 @@
 #include "CursorSlice.h"
 
 #include <vector>
-#include <iosfwd>
 
 
 namespace lyx {
@@ -25,14 +24,6 @@ class MathAtom;
 class Paragraph;
 
 
-// only needed for gcc 2.95, remove when support terminated
-template <typename A, typename B>
-bool ptr_cmp(A const * a, B const * b)
-{
-       return a == b;
-}
-
-
 // The public inheritance should go in favour of a suitable data member
 // (or maybe private inheritance) at some point of time.
 class DocIterator // : public std::vector<CursorSlice>
index c306daa75ca0a138763d5972d5cd8e7a199bc9c2..49c8f31b5b9ed52ffba3ce325fa43c156c0feb59 100644 (file)
@@ -22,7 +22,7 @@
 #include "ColorCode.h"
 #include "FontInfo.h"
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 
 
 namespace lyx {
index 44ecb3790813371662cc0c4de11a9cb2a7b628fb..ce5d9369cff598c20b870a38afb87f1ce164f5b6 100644 (file)
@@ -31,7 +31,7 @@ class Paragraph;
 class TextMetrics;
 
 
-class FontIterator : std::iterator<std::forward_iterator_tag, Font>
+class FontIterator
 {
 public:
        ///
index 9ea6dc43447ed733b5605165661d4a658548055a..3083f007acb176bbe808c6da95255be36fe2706e 100644 (file)
@@ -17,8 +17,6 @@
 
 #include "support/docstring.h"
 
-#include <iosfwd>
-
 
 namespace lyx {
 
index dbfbb54b7d0d02b4cefc8980443db9e283ff1b63..04a3bbcb338c4a615a81859b1565beb17a899023 100644 (file)
@@ -20,6 +20,7 @@
 #include "LyXAction.h"
 #include "Lexer.h"
 
+#include "support/docstream.h"
 #include "support/filetools.h"
 
 #include <fstream>
index 05709e69056df24072db38c5e8d84d3af9b837af..f52fabb425d9bbeeb831cea8bf172745bb3b3856 100644 (file)
@@ -19,7 +19,7 @@
 #include "frontends/KeyModifier.h"
 #include "frontends/KeySymbol.h"
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 
 #include <boost/shared_ptr.hpp>
 #include <boost/tuple/tuple.hpp>
index fbe27602c812fd49ca586a63768ec4d6cbe754c8..d4e440121c87f726c9e939ba124cd24b1c010c0e 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "support/strfwd.h"
 
-#include <iosfwd>
-
 
 namespace lyx {
 
index 1bf8931031df5d0a2fa6e4bc034953c904eec80a..0300b52b7597f5c216f8ceb985aca50f244fb15c 100644 (file)
@@ -652,7 +652,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                        }
                }
                else if (name == "latexlog")
-                       enable = FileName(buf->logName().second).isFileReadable();
+                       enable = FileName(buf->logName()).isFileReadable();
                else if (name == "spellchecker")
 #if defined (USE_ASPELL) || defined (USE_ISPELL) || defined (USE_PSPELL)
                        enable = !buf->isReadonly();
@@ -1456,9 +1456,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                if (!data.empty())
                                        lyx_view_->getDialogs().show("character", data);
                        } else if (name == "latexlog") {
-                               pair<Buffer::LogType, string> const logfile =
-                                       lyx_view_->buffer()->logName();
-                               switch (logfile.first) {
+                               Buffer::LogType type; 
+                               string const logfile = lyx_view_->buffer()->logName(&type);
+                               switch (type) {
                                case Buffer::latexlog:
                                        data = "latex ";
                                        break;
@@ -1466,7 +1466,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                        data = "literate ";
                                        break;
                                }
-                               data += Lexer::quoteString(logfile.second);
+                               data += Lexer::quoteString(logfile);
                                lyx_view_->getDialogs().show("log", data);
                        } else if (name == "vclog") {
                                string const data = "vc " +
index b9d7e5c6d489d22e447a6142ee76a9fe110638cb..20eedd914db2c9b4ab0d1546625b16a09b5a5f6e 100644 (file)
@@ -20,7 +20,8 @@
 
 #include "paper.h"
 
-#include <iosfwd>
+#include "support/strfwd.h"
+
 #include <string>
 
 
index 2dd4efb7313bc6921760af649f07bbc01f5f0d3f..25d9f74412184608d4b6a8cd2ce687036f839cc1 100644 (file)
@@ -72,8 +72,7 @@ class MenuNamesEqual : public std::unary_function<Menu, bool> {
 public:
        MenuNamesEqual(docstring const & name)
                : name_(name) {}
-       bool operator()(Menu const & menu) const
-       {
+       bool operator()(Menu const & menu) const {
                return menu.name() == name_;
        }
 private:
index c9f3e8de01e769dfb2f7e4b5414bd061eec980a1..76f4ca3722386ad04859749e0decb1421b78065c 100644 (file)
@@ -160,8 +160,7 @@ public:
        ///
        typedef ItemList::size_type size_type;
        ///
-       explicit Menu(docstring const & name = docstring())
-               : name_(name) {}
+       explicit Menu(docstring const & name = docstring()) : name_(name) {}
        /// Add the menu item unconditionally
        Menu & add(MenuItem const &);
        /// Checks the associated FuncRequest status before adding the
@@ -182,13 +181,9 @@ public:
        ///
        bool hasFunc(FuncRequest const &) const;
        ///
-       const_iterator begin() const {
-               return items_.begin();
-       }
+       const_iterator begin() const { return items_.begin(); }
        ///
-       const_iterator end() const {
-               return items_.end();
-       }
+       const_iterator end() const { return items_.end(); }
 
        // Check whether the menu shortcuts are unique
        void checkShortcuts() const;
@@ -247,21 +242,14 @@ public:
        void expand(Menu const & frommenu, Menu & tomenu,
                    Buffer const *) const;
        ///
-       const_iterator begin() const {
-               return menulist_.begin();
-       }
+       const_iterator begin() const { return menulist_.begin(); }
        ///
-       iterator begin() {
-               return menulist_.begin();
-       }
+       iterator begin() { return menulist_.begin(); }
        ///
-       const_iterator end() const {
-               return menulist_.end();
-       }
+       const_iterator end() const { return menulist_.end(); }
        ///
-       iterator end() {
-               return menulist_.end();
-       }
+       iterator end() { return menulist_.end(); }
+
 private:
        ///
        MenuList menulist_;
@@ -277,4 +265,4 @@ extern MenuBackend menubackend;
 
 } // namespace lyx
 
-#endif /* MENUBACKEND_H */
+#endif // MENUBACKEND_H
index aaf7141e7a7dcd54130cff3a24668580df9912bd..149d85b3dbbdd185f330dfe06df433e5979fabaf 100644 (file)
@@ -86,7 +86,7 @@ void PDFOptions::writeFile(ostream & os) const
                os << "\\pdf_quoted_options \"" << quoted_options << "\"\n";
 }
 
-void PDFOptions::writeLaTeX(odocstringstream & os, bool hyper_required) const
+void PDFOptions::writeLaTeX(odocstream & os, bool hyper_required) const
 {
        if (!use_hyperref && !hyper_required)
                return;
index c8fc16e131528f8d8485eff1c54912a68c31530c..13f83b9436b1555ee876bf9429e84fc264189da5 100644 (file)
@@ -12,7 +12,9 @@
 #ifndef PDFOPTIONS_H
 #define PDFOPTIONS_H
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
+
+#include <string>
 
 namespace lyx {
 
@@ -28,7 +30,7 @@ public:
        /// output to lyx header
        void writeFile(std::ostream &) const;
        /// output to tex header
-       void writeLaTeX(odocstringstream &, bool hyper_required) const;
+       void writeLaTeX(odocstream &, bool hyper_required) const;
        /// read tokens from lyx header
        std::string readToken(Lexer &lex, std::string const & token);
        /// set implicit settings for hyperref
index d59753decec9ac77799a633cad6b8e9f88165974..30c033b4875be3516646fe6dac79048e8be69c04 100644 (file)
@@ -23,9 +23,6 @@
 
 #include "support/strfwd.h"
 #include "support/types.h"
-// FIXME: would be nice to forward declare odocstream instead of
-// including this:
-#include "support/docstream.h"
 
 namespace lyx {
 
index 977049d202518be3c4731309abd50d8f713d2318..9c5a52df3e483462999179dc857b6bb58a1ad9bd 100644 (file)
@@ -21,9 +21,6 @@
 #include "support/types.h"
 #include "support/docstring.h"
 
-#include <iosfwd>
-#include <string>
-
 
 namespace lyx {
 
index 8b00a4a327d6720f4158b4d6d471d7d48086019f..7761bbf9aa7c29027473ed845e118303407ba3a0 100644 (file)
@@ -16,7 +16,7 @@
 #include "tex2lyx/Spacing.h"
 #else
 
-#include <iosfwd>
+#include "support/strfwd.h"
 #include <string>
 
 
index fe75838f49eeb66d7c5c7efa1e1b794b95754b03..d7745e420355141683309ff98ba341f25e22a9f1 100644 (file)
@@ -63,6 +63,7 @@
 #include "insets/InsetSpecialChar.h"
 #include "insets/InsetTabular.h"
 
+#include "support/docstream.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
 #include "support/convert.h"
index 60b4e511228835faae21febb6cd94ae791ad9dc6..30ed9de75fd84e8ca93224c89d40e7b49d25ce86 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "ParIterator.h"
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 
 
 namespace lyx {
@@ -74,11 +74,10 @@ protected:
 ///
 typedef std::vector<TocItem> Toc;
 typedef Toc::const_iterator TocIterator;
+
 /// The ToC list.
 /// A class and no typedef because we want to forward declare it.
-class TocList : public std::map<std::string, Toc>
-{
-};
+class TocList : public std::map<std::string, Toc> {};
 
 
 ///
index d6b141b969b6bced755bba23b96cda1ae095ff5a..85dc7477679572c89a9d19a5056122b0f82a7a9f 100644 (file)
@@ -24,6 +24,8 @@
 #include "Paragraph.h"
 #include "TexRow.h"
 
+#include "support/docstream.h"
+
 #include <QTextCursor>
 #include <QTextDocument>
 #include <boost/tuple/tuple.hpp>
index cc2f6d6e18f560b77f43a4f715b9a6211d838227..10a2e04ebc65d56ea15a4bc9dbd89734fb5ecaed 100644 (file)
@@ -119,8 +119,10 @@ static TranslatorMap const build_translator()
 }
 
 
-Inset::Inset()
-{}
+docstring Inset::name() const
+{
+       return from_ascii("unknown");
+}
 
 
 Dimension const Inset::dimension(BufferView const & bv) const
index 2486d09115bf597817ecd34f92bdd6062dd8fe2e..aae34f86954639f6d16b09f38cfe2162f5696897 100644 (file)
 #include "ColorCode.h"
 #include "InsetCode.h"
 
-#include "Dimension.h"
+#include "support/strfwd.h"
 
-#include "support/docstream.h"
-
-#include <memory>
 #include <vector>
 
 namespace lyx {
@@ -34,6 +31,7 @@ class BufferView;
 class Change;
 class Cursor;
 class CursorSlice;
+class Dimension;
 class FuncRequest;
 class FuncStatus;
 class InsetIterator;
@@ -280,7 +278,7 @@ public:
        virtual bool hasFixedWidth() const { return false; }
 
        ///
-       virtual docstring name() const { return from_ascii("unknown"); }
+       virtual docstring name() const;
        ///
        virtual InsetLayout const & getLayout(BufferParams const & bp) const;
        /// used to toggle insets
@@ -339,12 +337,12 @@ public:
        /// pit is the ParConstIterator of the paragraph containing the inset
        virtual void addToToc(TocList &, Buffer const &, ParConstIterator const &) const {}
        /// report files that can be embedded with the lyx file
-       virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {};
+       virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {}
        /// use embedded or external file after the embedding status of a file is changed
        virtual void updateEmbeddedFile(Buffer const &, EmbeddedFile const &) {}
        /// Fill keys with BibTeX information
        virtual void fillWithBibKeys(Buffer const &,
-               BiblioInfo &, InsetIterator const &) const { return; }
+               BiblioInfo &, InsetIterator const &) const {}
        /// Update the counters of this inset and of its contents
        virtual void updateLabels(Buffer const &, ParIterator const &) {}
 
@@ -393,7 +391,7 @@ public:
        enum { TEXT_TO_INSET_OFFSET = 4 };
 
 protected:
-       Inset();
+       Inset() {}
 
        /// replicate ourselves
        friend class InsetList;
index 50e1cb1c8a33e0804c3d0a2c27302fcaa2056e83..b4a88a7d058a2e80240ae099e81e9adf967bf986 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "support/lstrings.h"
 #include "support/std_ostream.h"
+#include "support/docstream.h"
 #include "support/convert.h"
 
 
index 174f81c6224fb21fa73fbcfa0132c5a30dd2f25b..d5a076671fbcfc876690bc639bd6ed61cf8de43c 100644 (file)
@@ -27,6 +27,7 @@
 #include "frontends/alert.h"
 
 #include "support/ExceptionMessage.h"
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
index bb81f519f9be2391a3b8fb3057a681c6df09593a..437a95010b6c73da5ee3e654633cfbffa1e5ddcd 100644 (file)
@@ -30,6 +30,7 @@
 #include "OutputParams.h"
 
 #include "support/lstrings.h"
+#include "support/docstream.h"
 #include "support/convert.h"
 
 
index d752c9c44b8353f27a3ba0235b60e78f5373bef2..c0647b0824f99b6bafcbabc9ef4c1f0f9d137df1 100644 (file)
@@ -17,6 +17,7 @@
 #include "BufferParams.h"
 #include "MetricsInfo.h"
 
+#include <iostream>
 
 namespace lyx {
 
@@ -58,8 +59,7 @@ void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
 
 bool InsetFootlike::insetAllowed(InsetCode code) const
 {
-       if (code == FOOT_CODE || code == MARGIN_CODE
-           || code == FLOAT_CODE)
+       if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE)
                return false;
        return InsetCollapsable::insetAllowed(code);
 }
index 62e8d80775c4ba8a83de58ed079affa75c14211e..7d1ea0bd4d81c8828234bd15136b314ed30b789c 100644 (file)
@@ -76,6 +76,7 @@ TODO
 #include "frontends/alert.h"
 
 #include "support/convert.h"
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/lyxlib.h" // sum
 #include "support/lstrings.h"
@@ -449,7 +450,8 @@ docstring const InsetGraphics::createDocBookAttributes() const
        // Calculate the options part of the command, we must do it to a string
        // stream since we copied the code from createLatexParams() ;-)
 
-       // FIXME: av: need to translate spec -> Docbook XSL spec (http://www.sagehill.net/docbookxsl/ImageSizing.html)
+       // FIXME: av: need to translate spec -> Docbook XSL spec
+       // (http://www.sagehill.net/docbookxsl/ImageSizing.html)
        // Right now it only works with my version of db2latex :-)
 
        odocstringstream options;
index dfb9e94aef50a30ee60aa54eaff01bdd3fc28b7f..6bf31aa36c0cd783c085687bbd7c66e47a199ad3 100644 (file)
@@ -20,8 +20,7 @@
 #include "OutputParams.h"
 
 #include "support/lstrings.h"
-
-#include "support/std_ostream.h"
+#include "support/docstream.h"
 
 
 namespace lyx {
@@ -88,7 +87,7 @@ int InsetHyperlink::latex(Buffer const &, odocstream & os,
        if (!url.empty()) {
                // the chars_url[] characters must be handled for both, url and href
                for (int k = 0; k < 2; k++) {
-                       for (int i = 0, pos;
+                       for (size_t i = 0, pos;
                                (pos = url.find(chars_url[k], i)) != string::npos;
                                i = pos + 2) {
                                url.replace(pos,1,backslash + chars_url[k]);
@@ -104,14 +103,14 @@ int InsetHyperlink::latex(Buffer const &, odocstream & os,
 
                // handle the "\" character, but only when the following character
                // is not also a "\", because "\\" is valid code
-               for (int i = 0, pos;
+               for (size_t i = 0, pos;
                        (pos = name.find("\\", i)) != string::npos;
                        i = pos + 2) {
                        if      (name[pos+1] != '\\')
                                name.replace(pos,1,"\\textbackslash{}");
                }
                for (int k = 0; k < 6; k++) {
-                       for (int i = 0, pos;
+                       for (size_t i = 0, pos;
                                (pos = name.find(chars_name[k], i)) != string::npos;
                                i = pos + 2) {
                                name.replace(pos,1,backslash + chars_name[k] + braces);
index 129f0b77578ece8d34c2a9be3b1e62991e6ee208..e236ad70367405cc2122adee361712b635720dfd 100644 (file)
@@ -42,6 +42,7 @@
 #include "insets/RenderPreview.h"
 #include "insets/InsetListingsParams.h"
 
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/lstrings.h" // contains
 #include "support/lyxalgo.h"
index 031d00e5c03da7f5e3cfd76330892333f83b3024..8bb9624f6759f8e840ea9e9e90f5c81fe1067151 100644 (file)
@@ -29,6 +29,8 @@
 #include "MetricsInfo.h"
 #include "ParagraphParameters.h"
 #include "TextClassList.h"
+
+#include "support/docstream.h"
 #include "support/lstrings.h"
 #include "support/ExceptionMessage.h"
 
index 22f4aa316a4aa800e804bad9bb8f3569ae474c6c..f34ae4259c09f52ec0ecf879dcb16766aab4103c 100644 (file)
 #include "InsetLine.h"
 
 #include "debug.h"
+#include "Dimension.h"
 #include "Font.h"
 #include "MetricsInfo.h"
 #include "LaTeXFeatures.h"
 #include "OutputParams.h"
 #include "Text.h"
 
+#include "support/docstream.h"
+
 #include "frontends/Painter.h"
 
 
index b52e9fb9afa9b09b51ea23e7976bc20a88d4c060..fb41bd0fe19d8fa3d52fc0580319fbe255c85d09 100644 (file)
@@ -26,6 +26,7 @@
 #include "Language.h"
 #include "MetricsInfo.h"
 
+#include "support/docstream.h"
 #include "support/lstrings.h"
 
 #include <sstream>
@@ -220,8 +221,7 @@ int InsetListings::latex(Buffer const & buf, odocstream & os,
                        os << from_utf8(param_string) << "]\n";
                }
                lines += 4;
-                os << code
-                   << "\n\\end{lstlisting}\n\\endgroup\n";
+               os << code << "\n\\end{lstlisting}\n\\endgroup\n";
                lines += 3;
        }
 
@@ -296,7 +296,7 @@ bool InsetListings::showInsetDialog(BufferView * bv) const
 
 
 docstring InsetListings::getCaption(Buffer const & buf,
-                   OutputParams const & runparams) const
+       OutputParams const & runparams) const
 {
        if (paragraphs().empty())
                return docstring();
index 77978bcf96d5787b569f600c31042f2130111b57..5a1af78d3e11d3082133a584ca9e5c805a5cdb1b 100644 (file)
@@ -13,6 +13,7 @@
 #include "InsetNewline.h"
 
 #include "debug.h"
+#include "Dimension.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 
index c3e7aefb2d57178f34641796a3f0b1b4e97b7430..c2fdade285797ad19269eea8d169c429a036dbe4 100644 (file)
@@ -22,6 +22,8 @@
 #include "MetricsInfo.h"
 #include "sgml.h"
 
+#include "support/docstream.h"
+
 
 namespace lyx {
 
index 50382349bdb20fffcdb944bbcec2e41a440a0777..de060487deab26ab4e309d7b982d21a6474e47e9 100644 (file)
@@ -31,6 +31,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 
+#include "support/docstream.h"
 #include "support/Translator.h"
 
 #include <algorithm>
index 9dbedbd55d9caa357a5e76bb2af82c7fc48f3995..89e0e33f268fd7ef3a9ae8da6ec450d0b1e621f4 100644 (file)
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "gettext.h"
 
+#include "support/docstream.h"
+
 
 namespace lyx {
 
index c51c891846fd6e5cb353dd0098d54dc2446042ee..eff96ac2646810e04516fe06b3e90194e5c6009c 100644 (file)
@@ -26,6 +26,7 @@
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
+#include "support/docstring.h"
 #include "support/lstrings.h"
 
 
@@ -59,23 +60,27 @@ char const * const quote_char = ",'`<>";
 // Index of chars used for the quote. Index is [side, language]
 int quote_index[2][6] = {
        { 2, 1, 0, 0, 3, 4 },    // "'',,<>"
-       { 1, 1, 2, 1, 4, 3 } };  // "`'`'><"
+       { 1, 1, 2, 1, 4, 3 }     // "`'`'><"
+};
 
 // Corresponding LaTeX code, for double and single quotes.
-char const * const latex_quote_t1[2][5] =
-{ { "\\quotesinglbase ",  "'", "`",
+char const * const latex_quote_t1[2][5] = {
+       { "\\quotesinglbase ",  "'", "`",
     "\\guilsinglleft{}", "\\guilsinglright{}" },
-  { ",,", "''", "``", "<<", ">>" } };
+  { ",,", "''", "``", "<<", ">>" }
+};
 
-char const * const latex_quote_ot1[2][5] =
-{ { "\\quotesinglbase ",  "'", "`",
+char const * const latex_quote_ot1[2][5] = {
+       { "\\quotesinglbase ",  "'", "`",
     "\\guilsinglleft{}", "\\guilsinglright{}" },
   { "\\quotedblbase ", "''", "``",
-    "\\guillemotleft{}", "\\guillemotright{}" } };
+    "\\guillemotleft{}", "\\guillemotright{}" }
+};
 
-char const * const latex_quote_babel[2][5] =
-{ { "\\glq ",  "'", "`", "\\flq{}", "\\frq{}" },
-  { "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" } };
+char const * const latex_quote_babel[2][5] = {
+       { "\\glq ",  "'", "`", "\\flq{}", "\\frq{}" },
+  { "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" }
+};
 
 } // namespace anon
 
@@ -106,11 +111,19 @@ InsetQuotes::InsetQuotes(char_type c, quote_language l, quote_times t)
 }
 
 
+docstring InsetQuotes::name() const
+{
+       return from_ascii("Quotes");
+}
+
+
 void InsetQuotes::getPosition(char_type c)
 {
        // Decide whether left or right
        switch (c) {
-       case ' ': case '(': case '[':
+       case ' ':
+       case '(':
+       case '[':
                side_ = LeftQ;   // left quote
                break;
        default:
@@ -201,14 +214,14 @@ docstring const InsetQuotes::dispString(Language const * loclang) const
                retdisp = docstring(1, 0x2018);
 #endif
        else
-               retdisp = lyx::from_ascii(disp);
+               retdisp = from_ascii(disp);
 
        // in french, spaces are added inside double quotes
        if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) {
                if (side_ == LeftQ)
                        retdisp += ' ';
                else
-                       retdisp.insert(docstring::size_type(0), 1, ' ');
+                       retdisp.insert(size_t(0), 1, ' ');
        }
 
        return retdisp;
@@ -355,7 +368,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
            && lyxrc.fontenc != "T1") {
                if (times_ == SingleQ)
                        switch (type) {
-                               case ',': features.require("quotesinglbase");  break;
+                       case ',': features.require("quotesinglbase"); break;
                        case '<': features.require("guilsinglleft");  break;
                        case '>': features.require("guilsinglright"); break;
                        default: break;
index 94f2d65c6ac800479e90c30612f62cdbdd4b5c42..118768bdcd35b21fa7567ae92fc675843b251bed 100644 (file)
@@ -67,14 +67,13 @@ public:
            \item etc.
          \end{itemize}
          */
-       explicit
-       InsetQuotes(std::string const & str = "eld");
+       explicit InsetQuotes(std::string const & str = "eld");
        /// Create the right quote inset after character c
        InsetQuotes(char_type c, BufferParams const & params);
        /// Direct access to inner/outer quotation marks
        InsetQuotes(char_type c, quote_language l, quote_times t);
        ///
-       docstring name() const { return from_ascii("Quotes"); }
+       docstring name() const;
        ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///
index 2cccc2931f42492ad96216b3e6d91e08cc5adbdd..5fb240a95dab94312580d9aa168f5c89a15879fe 100644 (file)
@@ -21,6 +21,7 @@
 #include "OutputParams.h"
 #include "sgml.h"
 
+#include "support/docstream.h"
 #include "support/lstrings.h"
 
 
index f4ec7b493d21ed023b07cfce47da4769425dcb9e..23789a97baebe6095186d45ba34577cba5303ca0 100644 (file)
@@ -64,14 +64,14 @@ public:
        ///
        static bool isCompatibleCommand(std::string const & s);
 protected:
+       ///
        InsetRef(InsetRef const &);
 
        ///
        virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
 private:
-       virtual Inset * clone() const {
-               return new InsetRef(*this);
-       }
+       ///
+       Inset * clone() const { return new InsetRef(*this); }
        ///
        bool isLatex;
 };
index 55aa3fd3faf71669df7effa24a07d12e815b5535..50b620333f8d4933089190ef9699dcc9abfd3ef8 100644 (file)
@@ -16,6 +16,7 @@
 #include "InsetSpace.h"
 
 #include "debug.h"
+#include "Dimension.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
@@ -48,8 +49,7 @@ InsetSpace::Kind InsetSpace::kind() const
 
 void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       frontend::FontMetrics const & fm =
-               theFontMetrics(mi.base.font);
+       frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
 
index d7bf5d52c1537ad8e0bf33cfd88c4952dabc281d..ad5a8f33ee0eb4f64346a68f5831910989b5b17a 100644 (file)
@@ -15,6 +15,7 @@
 #include "InsetSpecialChar.h"
 
 #include "debug.h"
+#include "Dimension.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
index 6eb171d4b62cfd25bdede2f5db4c0d37a2753c6a..a0c03179273ef4581a83b76fc3ff34872fee19a2 100644 (file)
@@ -46,6 +46,7 @@
 #include "TextMetrics.h"
 
 #include "support/convert.h"
+#include "support/docstream.h"
 #include "support/lstrings.h"
 
 #include "frontends/alert.h"
@@ -3068,7 +3069,7 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
 
        if (!cur.selection())
                return;
-       if (!ptr_cmp(&cur.inset(), this))
+       if (&cur.inset() != this)
                return;
 
        //resetPos(cur);
index 371c7266827edca7093feff6d28898f42127c9cd..08ff46c3e1344413a0fd11861f32e0762f21f7fc 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "Buffer.h"
 #include "Cursor.h"
+#include "Dimension.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "gettext.h"
index e35bd702fb3b7f8ebcb7a48c22d1285e74f8c3c8..008c3250b9d3979765587e816446e2461adc259b 100644 (file)
@@ -31,6 +31,7 @@
 #include "TocBackend.h"
 
 #include "support/convert.h"
+#include "support/docstream.h"
 
 
 namespace lyx {
index 2ca33d7338d0a67255bf0fad278bd0d92d9a6b84..7d4563d3e43575c323965b2bb407893075f252f7 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef LFUNS_H
 #define LFUNS_H
 
-#include <iosfwd>
+#include "support/strfwd.h"
 
 
 namespace lyx {
index d8c83652798ff1ed45ea172773c38dafaf8b70cb..d26813843cf28bcb4754a524800fb64be3e7dc23 100644 (file)
@@ -20,7 +20,6 @@
 #include "InsetMathComment.h"
 #include "InsetMathDelim.h"
 #include "InsetMathHull.h"
-//#include "InsetMathMBox.h"
 #include "InsetMathRef.h"
 #include "InsetMathScript.h"
 #include "InsetMathSpace.h"
@@ -111,7 +110,7 @@ void InsetMathNest::cursorPos(BufferView const & bv,
 // to touch all (math)inset's draw() methods. Right now, we'll store
 // absolute value, and make them here relative, only to make them
 // absolute again when actually drawing the cursor. What a mess.
-       BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
+       BOOST_ASSERT(&sl.inset() == this);
        MathData const & ar = sl.cell();
        CoordCache const & coord_cache = bv.coordCache();
        if (!coord_cache.getArrays().has(&ar)) {
@@ -156,7 +155,7 @@ void InsetMathNest::metrics(MetricsInfo const & mi) const
 
 bool InsetMathNest::idxNext(Cursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(&cur.inset() == this);
        if (cur.idx() == cur.lastidx())
                return false;
        ++cur.idx();
@@ -173,7 +172,7 @@ bool InsetMathNest::idxRight(Cursor & cur) const
 
 bool InsetMathNest::idxPrev(Cursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(&cur.inset() == this);
        if (cur.idx() == 0)
                return false;
        --cur.idx();
@@ -190,7 +189,7 @@ bool InsetMathNest::idxLeft(Cursor & cur) const
 
 bool InsetMathNest::idxFirst(Cursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(&cur.inset() == this);
        if (nargs() == 0)
                return false;
        cur.idx() = 0;
@@ -201,7 +200,7 @@ bool InsetMathNest::idxFirst(Cursor & cur) const
 
 bool InsetMathNest::idxLast(Cursor & cur) const
 {
-       BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
+       BOOST_ASSERT(&cur.inset() == this);
        if (nargs() == 0)
                return false;
        cur.idx() = cur.lastidx();
@@ -242,7 +241,7 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
        Cursor & cur = bv.cursor();
        if (!cur.selection())
                return;
-       if (!ptr_cmp(&cur.inset(), this))
+       if (&cur.inset() != this)
                return;
 
        // FIXME: hack to get position cache warm
index b0f63268839865f5648b6b1ab66d9e7c47039628..c1bc5f9ebf8fe743b9d7329d0bbfc673aeb11505 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef OUTPUT_DOCBOOK_H
 #define OUTPUT_DOCBOOK_H
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 
 namespace lyx {
 
index 5e88d0e765fd95dcb459b02866f4ad093d840920..c32a4a2c1988ce794e5e86490035a0d1b0a4cad1 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef OUTPUT_PLAINTEXT_H
 #define OUTPUT_PLAINTEXT_H
 
-#include "support/docstream.h"
+#include "support/strfwd.h"
 
 
 namespace lyx {
index fbfa76b594e27e696e70f35c83c77ec4da98636d..41bb9e794fa8739ac70bb1fd94d1c393bbcba4c5 100644 (file)
--- a/src/pch.h
+++ b/src/pch.h
@@ -1,31 +1,6 @@
 #include <config.h>
 
-#include <boost/any.hpp>
-#include <boost/array.hpp>
-#include <boost/assert.hpp>
-#include <boost/crc.hpp>
-#include <boost/cregex.hpp>
-#include <boost/current_function.hpp>
-#include <boost/function.hpp>
-#include <boost/iterator/indirect_iterator.hpp>
-#include <boost/optional.hpp>
-#include <boost/regex.hpp>
-#include <boost/scoped_array.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/tokenizer.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/version.hpp>
-
 #include <algorithm>
-#include <cerrno>
-#include <clocale>
-#include <cmath>
-#include <csignal>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
 #include <deque>
 #include <exception>
 #include <fstream>
index e1709a9a8da4337e013c2024e8651780b75f74ac..b7871e195b5c07ae88592bb9c25ff3f8df649921 100644 (file)
@@ -21,7 +21,7 @@
 #include "OutputParams.h"
 #include "Paragraph.h"
 
-#include "support/docstring.h"
+#include "support/docstream.h"
 #include "support/lstrings.h"
 #include "support/std_ostream.h"
 #include "support/convert.h"
index d32b799b4997211b1b8d9f41fce60ffb3eeb3fa3..ed8cbf314de7dc8bf2719aa473da0be0ee451519 100644 (file)
 #define SGML_H
 
 #include "support/types.h"
-#include "support/docstream.h"
-
-#include <iosfwd>
-#include <string>
-#include <utility>
-
+#include "support/docstring.h"
 
 namespace lyx {
 
index 165772cdf28d4ad5b84fe82c56d763d81dbacfa3..e84ba6f2d0c84a5e4443e249efd8375b67d6f248 100644 (file)
@@ -22,6 +22,70 @@ namespace lyx {
 /// String type for storing the main text in UCS4 encoding
 typedef std::basic_string<char_type> docstring;
 
+/// Creates a docstring from a C string of ASCII characters
+docstring const from_ascii(char const *);
+
+/// Creates a docstring from a std::string of ASCII characters
+docstring const from_ascii(std::string const &);
+
+/// Creates a std::string of ASCII characters from a docstring
+std::string const to_ascii(docstring const &);
+
+/// Creates a docstring from a UTF8 string. This should go eventually.
+docstring const from_utf8(std::string const &);
+
+/// Creates a UTF8 string from a docstring. This should go eventually.
+std::string const to_utf8(docstring const &);
+
+/// convert \p s from the encoding of the locale to ucs4.
+docstring const from_local8bit(std::string const & s);
+
+/**
+ * Convert \p s from ucs4 to the encoding of the locale.
+ * This may fail and throw an exception, the caller is expected to act
+ * appropriately.
+ */
+std::string const to_local8bit(docstring const & s);
+
+/// convert \p s from the encoding of the file system to ucs4.
+docstring const from_filesystem8bit(std::string const & s);
+
+/// convert \p s from ucs4 to the encoding of the file system.
+std::string const to_filesystem8bit(docstring const & s);
+
+/// normalize \p s to precomposed form c
+docstring const normalize_c(docstring const & s);
+
+/// Compare a docstring with a C string of ASCII characters
+bool operator==(docstring const &, char const *);
+
+/// Compare a C string of ASCII characters with a docstring
+inline bool operator==(char const * l, docstring const & r) { return r == l; }
+
+/// Compare a docstring with a C string of ASCII characters
+inline bool operator!=(docstring const & l, char const * r) { return !(l == r); }
+
+/// Compare a C string of ASCII characters with a docstring
+inline bool operator!=(char const * l, docstring const & r) { return !(r == l); }
+
+/// Concatenate a docstring and a C string of ASCII characters
+docstring operator+(docstring const &, char const *);
+
+/// Concatenate a C string of ASCII characters and a docstring
+docstring operator+(char const *, docstring const &);
+
+/// Concatenate a docstring and a single ASCII character
+docstring operator+(docstring const & l, char r);
+
+/// Concatenate a single ASCII character and a docstring
+docstring operator+(char l, docstring const & r);
+
+/// Append a C string of ASCII characters to a docstring
+docstring & operator+=(docstring &, char const *);
+
+/// Append a single ASCII character to a docstring
+docstring & operator+=(docstring & l, char r);
+
 } // namespace lyx
 
 
index 3e1494e016a232424ed393208e2530c6839d959d..552f1b0f1f99ddf5d7d6056ceeb1ba8169851419 100644 (file)
@@ -13,6 +13,8 @@
 #include <config.h>
 
 #include "support/environment.h"
+
+#include "support/docstring.h"
 #include "support/os.h"
 
 #include <boost/tokenizer.hpp>
index 6d42222e860b639607ff71ee339d56a997da1091..c3ab5f3229ef8f82a50e605254564e352bc79dad 100644 (file)
@@ -11,6 +11,7 @@
 #include <config.h>
 
 #include "support/lyxlib.h"
+#include "support/docstring.h"
 #include "support/os.h"
 
 #include <boost/scoped_array.hpp>
index b85ea242e028d6fe7b89f9586544f1ab3fb0e74b..ed22874c7dc14b7e8fe309fabe5f8c1a45e79a31 100644 (file)
 #ifndef STRFWD_H
 #define STRFWD_H
 
-namespace std {
-
-template<typename Char> struct char_traits;
-template<> struct char_traits<char>;
-template<> struct char_traits<wchar_t>;
-
-template<typename Alloc> class allocator;
-
-template<typename Char, typename Traits, typename Alloc> class basic_string;
-
-typedef basic_string<char, char_traits<char>, allocator<char> > string;
-
-}
-
-
 #ifdef USE_WCHAR_T
 
 // Prefer this if possible because GNU libstdc++ has usable
@@ -44,74 +29,40 @@ namespace lyx { typedef boost::uint32_t char_type; }
 #endif
 
 
-namespace lyx {
-
-typedef std::basic_string<char_type, std::char_traits<char_type>,
-       std::allocator<char_type> > docstring;
-
-/// Creates a docstring from a C string of ASCII characters
-docstring const from_ascii(char const *);
-
-/// Creates a docstring from a std::string of ASCII characters
-docstring const from_ascii(std::string const &);
-
-/// Creates a std::string of ASCII characters from a docstring
-std::string const to_ascii(docstring const &);
-
-/// Creates a docstring from a UTF8 string. This should go eventually.
-docstring const from_utf8(std::string const &);
-
-/// Creates a UTF8 string from a docstring. This should go eventually.
-std::string const to_utf8(docstring const &);
-
-/// convert \p s from the encoding of the locale to ucs4.
-docstring const from_local8bit(std::string const & s);
-
-/**
- * Convert \p s from ucs4 to the encoding of the locale.
- * This may fail and throw an exception, the caller is expected to act
- * appropriately.
- */
-std::string const to_local8bit(docstring const & s);
+namespace std {
 
-/// convert \p s from the encoding of the file system to ucs4.
-docstring const from_filesystem8bit(std::string const & s);
+template<typename Char> struct char_traits;
+template<> struct char_traits<char>;
+template<> struct char_traits<wchar_t>;
 
-/// convert \p s from ucs4 to the encoding of the file system.
-std::string const to_filesystem8bit(docstring const & s);
+template<typename Alloc> class allocator;
 
-/// normalize \p s to precomposed form c
-docstring const normalize_c(docstring const & s);
+template<typename Char, typename Traits, typename Alloc> class basic_string;
 
-/// Compare a docstring with a C string of ASCII characters
-bool operator==(docstring const &, char const *);
+typedef basic_string<char, char_traits<char>, allocator<char> > string;
 
-/// Compare a C string of ASCII characters with a docstring
-inline bool operator==(char const * l, docstring const & r) { return r == l; }
+template<class Char, class Traits> class basic_istream;
+template<class Char, class Traits> class basic_ostream;
 
-/// Compare a docstring with a C string of ASCII characters
-inline bool operator!=(docstring const & l, char const * r) { return !(l == r); }
+typedef basic_istream<char, char_traits<char> > istream;
+typedef basic_ostream<char, char_traits<char> > ostream;
 
-/// Compare a C string of ASCII characters with a docstring
-inline bool operator!=(char const * l, docstring const & r) { return !(r == l); }
+}
 
-/// Concatenate a docstring and a C string of ASCII characters
-docstring operator+(docstring const &, char const *);
 
-/// Concatenate a C string of ASCII characters and a docstring
-docstring operator+(char const *, docstring const &);
+namespace lyx {
 
-/// Concatenate a docstring and a single ASCII character
-docstring operator+(docstring const & l, char r);
+typedef std::basic_string<char_type, std::char_traits<char_type>,
+       std::allocator<char_type> > docstring;
 
-/// Concatenate a single ASCII character and a docstring
-docstring operator+(char l, docstring const & r);
+/// Base class for UCS4 input streams
+typedef std::basic_istream<char_type, std::char_traits<char_type> >
+       idocstream;
 
-/// Append a C string of ASCII characters to a docstring
-docstring & operator+=(docstring &, char const *);
+/// Base class for UCS4 output streams
+typedef std::basic_ostream<char_type, std::char_traits<char_type> >
+       odocstream;
 
-/// Append a single ASCII character to a docstring
-docstring & operator+=(docstring & l, char r);
 
 } // namespace lyx
 
index c68d55ac3e02b27d001b1496259142bba74ff605..da86eb3355b96861dadaf0649ac8ef42197f983d 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "support/userinfo.h"
 #include "support/environment.h"
+#include "support/docstring.h"
 
 #include <boost/assert.hpp>
 
@@ -44,7 +45,7 @@ docstring const user_name()
                return _("Unknown user");
        return from_local8bit(name);
 #else
-       struct passwd * pw(getpwuid(geteuid()));
+       struct passwd * pw = getpwuid(geteuid());
        BOOST_ASSERT(pw);
 
        string name = pw->pw_gecos;