commit 14fa2c71625c715ffcc42d13ee0151333079de2c
Author: Georg Baum <[email protected]>
Date:   Sun Jun 26 18:22:59 2016 +0200

    Remove using directives from headers
    
    The only exceptions are:
    
    - The purpose of the header is to drag in the used symbol, e.g. unique_ptr.h
    - The used symbol is inside a class or a namespace other than lyx
    
    The reason for this is that global 'using' statements effectively forbid to
    use the used symbols in any other namespace in the whole program, since 
simply
    adding or removing an #include of the corresponding header subtly changes 
the
    name lookup. The namespace lyx is sort of global, so it should not have 
these
    statements either.
---
 src/CutAndPaste.h                |    5 ++---
 src/Text3.cpp                    |    1 +
 src/TocBackend.h                 |   10 ++++------
 src/frontends/Clipboard.h        |    4 +---
 src/frontends/qt4/GuiClipboard.h |    4 ++--
 src/insets/InsetMarginal.cpp     |    2 +-
 src/insets/InsetTabular.h        |   14 ++++++--------
 src/mathed/InsetMathGrid.cpp     |    2 +-
 src/mathed/InsetMathNest.cpp     |    2 +-
 src/support/ForkedCalls.h        |    8 +++-----
 10 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index c332e0b..c6646f3 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -22,7 +22,6 @@
 
 #include <vector>
 
-using lyx::frontend::Clipboard;
 
 namespace lyx {
 
@@ -89,11 +88,11 @@ void pasteSelection(Cursor & cur, ErrorList &);
 /// Does handle undo. Does only work in text, not mathed.
 /// \p asParagraphs is only considered if plain text is pasted.
 bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs,
-       Clipboard::TextType preferedType = Clipboard::LyXOrPlainTextType);
+       frontend::Clipboard::TextType preferedType = 
frontend::Clipboard::LyXOrPlainTextType);
 /// Replace the current selection with the clipboard contents as graphic.
 /// Does handle undo. Does only work in text, not mathed.
 void pasteClipboardGraphics(Cursor & cur, ErrorList & errorList,
-       Clipboard::GraphicsType preferedType = Clipboard::AnyGraphicsType);
+       frontend::Clipboard::GraphicsType preferedType = 
frontend::Clipboard::AnyGraphicsType);
 /// Replace the current selection with cut buffer \c sel_index
 /// Does handle undo. Does only work in text, not mathed.
 bool pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index);
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 0467aa8..fea23b0 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -97,6 +97,7 @@ using cap::replaceSelection;
 using cap::grabAndEraseSelection;
 using cap::selClearOrDel;
 using cap::pasteSimpleText;
+using frontend::Clipboard;
 
 // globals...
 static Font freefont(ignore_font, ignore_language);
diff --git a/src/TocBackend.h b/src/TocBackend.h
index 336daf7..0671f04 100644
--- a/src/TocBackend.h
+++ b/src/TocBackend.h
@@ -26,8 +26,6 @@
 #include <stack>
 
 
-using std::shared_ptr;
-
 namespace lyx {
 
 class Buffer;
@@ -125,7 +123,7 @@ private:
 class TocBuilder
 {
 public:
-       TocBuilder(shared_ptr<Toc> const toc);
+       TocBuilder(std::shared_ptr<Toc> const toc);
        /// When entering a float
        void pushItem(DocIterator const & dit, docstring const & s,
                      bool output_active, bool is_captioned = false);
@@ -142,7 +140,7 @@ private:
                bool is_captioned;
        };
        ///
-       shared_ptr<Toc> const toc_;
+       std::shared_ptr<Toc> const toc_;
        ///
        std::stack<frame> stack_;
 };
@@ -169,9 +167,9 @@ public:
        ///
        TocList const & tocs() const { return tocs_; }
        /// never null
-       shared_ptr<Toc const> toc(std::string const & type) const;
+       std::shared_ptr<Toc const> toc(std::string const & type) const;
        /// never null
-       shared_ptr<Toc> toc(std::string const & type);
+       std::shared_ptr<Toc> toc(std::string const & type);
        /// \return the current TocBuilder for the Toc of type \param type, or
        /// creates one if it does not already exist.
        TocBuilder & builder(std::string const & type);
diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h
index faf4e0a..af617f5 100644
--- a/src/frontends/Clipboard.h
+++ b/src/frontends/Clipboard.h
@@ -18,8 +18,6 @@
 
 #include "support/strfwd.h"
 
-using lyx::support::FileName;
-
 namespace lyx {
 namespace frontend {
 
@@ -62,7 +60,7 @@ public:
        /// Get the contents of the window system clipboard in any text format 
except LyxTextType.
        virtual docstring const getAsText(TextType type) const = 0;
        /// Get the contents of the window system clipboard as graphics file.
-       virtual FileName getAsGraphics(Cursor const & cur, GraphicsType type) 
const = 0;
+       virtual support::FileName getAsGraphics(Cursor const & cur, 
GraphicsType type) const = 0;
 
        /**
         * Fill the system clipboard. The format of \p lyx is as written in
diff --git a/src/frontends/qt4/GuiClipboard.h b/src/frontends/qt4/GuiClipboard.h
index 9e9ae7b..4514eb2 100644
--- a/src/frontends/qt4/GuiClipboard.h
+++ b/src/frontends/qt4/GuiClipboard.h
@@ -68,7 +68,7 @@ public:
         */
        //@{
        std::string const getAsLyX() const;
-       FileName getAsGraphics(Cursor const & cur, GraphicsType type) const;
+       support::FileName getAsGraphics(Cursor const & cur, GraphicsType type) 
const;
        docstring const getAsText(TextType type) const;
        void put(std::string const & text) const;
        void put(std::string const & lyx, docstring const & html, docstring 
const & text);
@@ -79,7 +79,7 @@ public:
        bool empty() const;
        //@}
 
-       FileName getPastedGraphicsFileName(Cursor const & cur,
+       support::FileName getPastedGraphicsFileName(Cursor const & cur,
                Clipboard::GraphicsType & type) const;
 
 private Q_SLOTS:
diff --git a/src/insets/InsetMarginal.cpp b/src/insets/InsetMarginal.cpp
index cb85ab3..9aba39a 100644
--- a/src/insets/InsetMarginal.cpp
+++ b/src/insets/InsetMarginal.cpp
@@ -63,7 +63,7 @@ void InsetMarginal::addToToc(DocIterator const & cpit, bool 
output_active,
        docstring const str = tooltip;
        tooltip = support::wrapParas(tooltip, 0, 60, 2);
        
-       shared_ptr<Toc> toc = buffer().tocBackend().toc("marginalnote");
+       std::shared_ptr<Toc> toc = buffer().tocBackend().toc("marginalnote");
        toc->push_back(TocItem(pit, 0, str, output_active, tooltip));
 
        // Proceed with the rest of the inset.
diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h
index d26b1aa..565b973 100644
--- a/src/insets/InsetTabular.h
+++ b/src/insets/InsetTabular.h
@@ -33,8 +33,6 @@
 #include <vector>
 
 
-using std::shared_ptr;
-
 namespace lyx {
 
 class Buffer;
@@ -611,13 +609,13 @@ public:
        /// returns the VISIBLE cell at r,c, which may be the same as the
        /// cell at the previous row or column, if we're dealing with some
        /// multirow or multicell.
-       shared_ptr<InsetTableCell> cellInset(idx_type cell);
-       shared_ptr<InsetTableCell> cellInset(row_type row, col_type column);
+       std::shared_ptr<InsetTableCell> cellInset(idx_type cell);
+       std::shared_ptr<InsetTableCell> cellInset(row_type row, col_type 
column);
        InsetTableCell const * cellInset(idx_type cell) const;
        //@}
        ///
        void setCellInset(row_type row, col_type column,
-                         shared_ptr<InsetTableCell>);
+                         std::shared_ptr<InsetTableCell>);
        /// Search for \param inset in the tabular, with the
        ///
        void validate(LaTeXFeatures &) const;
@@ -674,7 +672,7 @@ public:
                ///
                Length p_width; // this is only set for multicolumn!!!
                ///
-               shared_ptr<InsetTableCell> inset;
+               std::shared_ptr<InsetTableCell> inset;
        };
        ///
        CellData const & cellInfo(idx_type cell) const;
@@ -921,9 +919,9 @@ public:
        /// number of cells
        size_t nargs() const { return tabular.numberofcells; }
        ///
-       shared_ptr<InsetTableCell const> cell(idx_type) const;
+       std::shared_ptr<InsetTableCell const> cell(idx_type) const;
        ///
-       shared_ptr<InsetTableCell> cell(idx_type);
+       std::shared_ptr<InsetTableCell> cell(idx_type);
        ///
        Text * getText(int) const;
 
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 8138876..1c830c1 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1579,7 +1579,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest 
& cmd)
                cap::replaceSelection(cur);
                docstring topaste;
                if (cmd.argument().empty() && !theClipboard().isInternal())
-                       topaste = 
theClipboard().getAsText(Clipboard::PlainTextType);
+                       topaste = 
theClipboard().getAsText(frontend::Clipboard::PlainTextType);
                else {
                        idocstringstream is(cmd.argument());
                        int n = 0;
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index d1c413b..716ad66 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -578,7 +578,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & 
cmd)
                replaceSelection(cur);
                docstring topaste;
                if (cmd.argument().empty() && !theClipboard().isInternal())
-                       topaste = 
theClipboard().getAsText(Clipboard::PlainTextType);
+                       topaste = 
theClipboard().getAsText(frontend::Clipboard::PlainTextType);
                else {
                        size_t n = 0;
                        idocstringstream is(cmd.argument());
diff --git a/src/support/ForkedCalls.h b/src/support/ForkedCalls.h
index f770ff5..1ed2f75 100644
--- a/src/support/ForkedCalls.h
+++ b/src/support/ForkedCalls.h
@@ -24,8 +24,6 @@
 #include <memory>
 
 
-using std::shared_ptr;
-
 namespace lyx {
 namespace support {
 
@@ -44,7 +42,7 @@ public:
        ///
        virtual ~ForkedProcess() {}
        ///
-       virtual shared_ptr<ForkedProcess> clone() const = 0;
+       virtual std::shared_ptr<ForkedProcess> clone() const = 0;
 
        /** A SignalType signal can be emitted once the forked process
         *  has finished. It passes:
@@ -65,7 +63,7 @@ public:
         *
         *  It doesn't matter if the slot disappears, SigC takes care of that.
         */
-       typedef shared_ptr<SignalType> SignalTypePtr;
+       typedef std::shared_ptr<SignalType> SignalTypePtr;
 
        /** Invoking the following methods makes sense only if the command
         *  is running asynchronously!
@@ -157,7 +155,7 @@ public:
        ForkedCall(std::string const & path = empty_string(),
                   std::string const & lpath = empty_string());
        ///
-       virtual shared_ptr<ForkedProcess> clone() const {
+       virtual std::shared_ptr<ForkedProcess> clone() const {
                return std::make_shared<ForkedCall>(*this);
        }
 

Reply via email to