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.
This commit is contained in:
Georg Baum 2016-06-26 18:22:59 +02:00
parent 458d2015dc
commit 14fa2c7162
10 changed files with 22 additions and 30 deletions

View File

@ -22,7 +22,6 @@
#include <vector> #include <vector>
using lyx::frontend::Clipboard;
namespace lyx { namespace lyx {
@ -89,11 +88,11 @@ void pasteSelection(Cursor & cur, ErrorList &);
/// Does handle undo. Does only work in text, not mathed. /// Does handle undo. Does only work in text, not mathed.
/// \p asParagraphs is only considered if plain text is pasted. /// \p asParagraphs is only considered if plain text is pasted.
bool pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs, 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. /// Replace the current selection with the clipboard contents as graphic.
/// Does handle undo. Does only work in text, not mathed. /// Does handle undo. Does only work in text, not mathed.
void pasteClipboardGraphics(Cursor & cur, ErrorList & errorList, 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 /// Replace the current selection with cut buffer \c sel_index
/// Does handle undo. Does only work in text, not mathed. /// Does handle undo. Does only work in text, not mathed.
bool pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index); bool pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index);

View File

@ -97,6 +97,7 @@ using cap::replaceSelection;
using cap::grabAndEraseSelection; using cap::grabAndEraseSelection;
using cap::selClearOrDel; using cap::selClearOrDel;
using cap::pasteSimpleText; using cap::pasteSimpleText;
using frontend::Clipboard;
// globals... // globals...
static Font freefont(ignore_font, ignore_language); static Font freefont(ignore_font, ignore_language);

View File

@ -26,8 +26,6 @@
#include <stack> #include <stack>
using std::shared_ptr;
namespace lyx { namespace lyx {
class Buffer; class Buffer;
@ -125,7 +123,7 @@ private:
class TocBuilder class TocBuilder
{ {
public: public:
TocBuilder(shared_ptr<Toc> const toc); TocBuilder(std::shared_ptr<Toc> const toc);
/// When entering a float /// When entering a float
void pushItem(DocIterator const & dit, docstring const & s, void pushItem(DocIterator const & dit, docstring const & s,
bool output_active, bool is_captioned = false); bool output_active, bool is_captioned = false);
@ -142,7 +140,7 @@ private:
bool is_captioned; bool is_captioned;
}; };
/// ///
shared_ptr<Toc> const toc_; std::shared_ptr<Toc> const toc_;
/// ///
std::stack<frame> stack_; std::stack<frame> stack_;
}; };
@ -169,9 +167,9 @@ public:
/// ///
TocList const & tocs() const { return tocs_; } TocList const & tocs() const { return tocs_; }
/// never null /// 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 /// 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 /// \return the current TocBuilder for the Toc of type \param type, or
/// creates one if it does not already exist. /// creates one if it does not already exist.
TocBuilder & builder(std::string const & type); TocBuilder & builder(std::string const & type);

View File

@ -18,8 +18,6 @@
#include "support/strfwd.h" #include "support/strfwd.h"
using lyx::support::FileName;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
@ -62,7 +60,7 @@ public:
/// Get the contents of the window system clipboard in any text format except LyxTextType. /// Get the contents of the window system clipboard in any text format except LyxTextType.
virtual docstring const getAsText(TextType type) const = 0; virtual docstring const getAsText(TextType type) const = 0;
/// Get the contents of the window system clipboard as graphics file. /// 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 * Fill the system clipboard. The format of \p lyx is as written in

View File

@ -68,7 +68,7 @@ public:
*/ */
//@{ //@{
std::string const getAsLyX() const; 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; docstring const getAsText(TextType type) const;
void put(std::string const & text) const; void put(std::string const & text) const;
void put(std::string const & lyx, docstring const & html, docstring const & text); void put(std::string const & lyx, docstring const & html, docstring const & text);
@ -79,7 +79,7 @@ public:
bool empty() const; bool empty() const;
//@} //@}
FileName getPastedGraphicsFileName(Cursor const & cur, support::FileName getPastedGraphicsFileName(Cursor const & cur,
Clipboard::GraphicsType & type) const; Clipboard::GraphicsType & type) const;
private Q_SLOTS: private Q_SLOTS:

View File

@ -63,7 +63,7 @@ void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active,
docstring const str = tooltip; docstring const str = tooltip;
tooltip = support::wrapParas(tooltip, 0, 60, 2); 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)); toc->push_back(TocItem(pit, 0, str, output_active, tooltip));
// Proceed with the rest of the inset. // Proceed with the rest of the inset.

View File

@ -33,8 +33,6 @@
#include <vector> #include <vector>
using std::shared_ptr;
namespace lyx { namespace lyx {
class Buffer; class Buffer;
@ -611,13 +609,13 @@ public:
/// returns the VISIBLE cell at r,c, which may be the same as the /// 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 /// cell at the previous row or column, if we're dealing with some
/// multirow or multicell. /// multirow or multicell.
shared_ptr<InsetTableCell> cellInset(idx_type cell); std::shared_ptr<InsetTableCell> cellInset(idx_type cell);
shared_ptr<InsetTableCell> cellInset(row_type row, col_type column); std::shared_ptr<InsetTableCell> cellInset(row_type row, col_type column);
InsetTableCell const * cellInset(idx_type cell) const; InsetTableCell const * cellInset(idx_type cell) const;
//@} //@}
/// ///
void setCellInset(row_type row, col_type column, void setCellInset(row_type row, col_type column,
shared_ptr<InsetTableCell>); std::shared_ptr<InsetTableCell>);
/// Search for \param inset in the tabular, with the /// Search for \param inset in the tabular, with the
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
@ -674,7 +672,7 @@ public:
/// ///
Length p_width; // this is only set for multicolumn!!! 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; CellData const & cellInfo(idx_type cell) const;
@ -921,9 +919,9 @@ public:
/// number of cells /// number of cells
size_t nargs() const { return tabular.numberofcells; } 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; Text * getText(int) const;

View File

@ -1579,7 +1579,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
cap::replaceSelection(cur); cap::replaceSelection(cur);
docstring topaste; docstring topaste;
if (cmd.argument().empty() && !theClipboard().isInternal()) if (cmd.argument().empty() && !theClipboard().isInternal())
topaste = theClipboard().getAsText(Clipboard::PlainTextType); topaste = theClipboard().getAsText(frontend::Clipboard::PlainTextType);
else { else {
idocstringstream is(cmd.argument()); idocstringstream is(cmd.argument());
int n = 0; int n = 0;

View File

@ -578,7 +578,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
replaceSelection(cur); replaceSelection(cur);
docstring topaste; docstring topaste;
if (cmd.argument().empty() && !theClipboard().isInternal()) if (cmd.argument().empty() && !theClipboard().isInternal())
topaste = theClipboard().getAsText(Clipboard::PlainTextType); topaste = theClipboard().getAsText(frontend::Clipboard::PlainTextType);
else { else {
size_t n = 0; size_t n = 0;
idocstringstream is(cmd.argument()); idocstringstream is(cmd.argument());

View File

@ -24,8 +24,6 @@
#include <memory> #include <memory>
using std::shared_ptr;
namespace lyx { namespace lyx {
namespace support { namespace support {
@ -44,7 +42,7 @@ public:
/// ///
virtual ~ForkedProcess() {} 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 /** A SignalType signal can be emitted once the forked process
* has finished. It passes: * has finished. It passes:
@ -65,7 +63,7 @@ public:
* *
* It doesn't matter if the slot disappears, SigC takes care of that. * 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 /** Invoking the following methods makes sense only if the command
* is running asynchronously! * is running asynchronously!
@ -157,7 +155,7 @@ public:
ForkedCall(std::string const & path = empty_string(), ForkedCall(std::string const & path = empty_string(),
std::string const & lpath = 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); return std::make_shared<ForkedCall>(*this);
} }