Got rid of using namespace std

It's really convenient, but can lead to unpredicted behavior.
presentation
MarPiRK 11 years ago
parent a75be24d5e
commit 1aa410a6e7
  1. 10
      src/control/Control.cpp
  2. 2
      src/control/LoadHandler.h
  3. 3
      src/control/RecentManager.cpp
  4. 3
      src/control/SaveHandler.cpp
  5. 7
      src/control/XournalMain.cpp
  6. 3
      src/control/jobs/Scheduler.cpp
  7. 16
      src/control/settings/MetadataManager.cpp
  8. 3
      src/control/shaperecognizer/ShapeRecognizerConfig.h
  9. 3
      src/control/tools/EditSelection.cpp
  10. 5
      src/gui/MainWindow.cpp
  11. 3
      src/gui/dialog/LatexGlade.cpp
  12. 3
      src/gui/dialog/toolbarCustomize/ToolbarAdapter.h
  13. 3
      src/gui/toolbarMenubar/model/ToolbarColorNames.cpp
  14. 3
      src/gui/toolbarMenubar/model/ToolbarData.cpp
  15. 3
      src/gui/widgets/XournalWidget.cpp
  16. 5
      src/model/Document.cpp
  17. 4
      src/model/Layer.cpp
  18. 3
      src/model/Stroke.cpp
  19. 3
      src/pdf/popplerdirect/PdfObjectWriter.cpp
  20. 3
      src/pdf/popplerdirect/PdfWriter.cpp
  21. 9
      src/test/control/LoadHandlerTest.cpp
  22. 12
      src/util/CrashHandler.cpp
  23. 19
      src/util/GzHelper.cpp
  24. 4
      src/util/LatexAction.cpp
  25. 6
      src/util/Stacktrace.cpp
  26. 3
      src/util/Util.cpp
  27. 3
      src/util/XournalType.cpp
  28. 10
      src/view/DocumentView.cpp

@ -53,8 +53,12 @@ namespace bf = boost::filesystem;
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <iostream>
using std::cout;
using std::cerr;
using std::endl;
#include <vector>
using namespace std;
using std::vector;
// TODO Check for error log on startup, also check for emergency save document!
@ -1332,9 +1336,7 @@ void Control::getDefaultPagesize(double& width, double& height)
GtkPaperSize* s = (GtkPaperSize*) l->data;
//it would be nice to make StringUtils method, but now I'm not in the mood - down there is basically compareIgnoreCase
using namespace bl;
using bl::collator;
if (use_facet<collator<char>>(std::locale()).compare(collator_base::secondary,
if (std::use_facet<bl::collator<char>>(std::locale()).compare(bl::collator_base::secondary,
paper, gtk_paper_size_get_display_name(s)))
{
size = s;

@ -21,7 +21,7 @@
#include <zlib.h>
#include <string>
using namespace std;
using std::string;
enum ParserPosition
{

@ -8,7 +8,8 @@
using boost::filesystem::path;
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
#define MIME "application/x-xoj"
#define MIME_PDF "application/x-pdf"

@ -31,7 +31,8 @@
#include <clocale>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
// TODO LOW PRIO: remove all elements which are complete outside the pages
// TODO LOW PRIO: remove 0 width line parts

@ -20,8 +20,13 @@
namespace bf = boost::filesystem;
#include <string>
using std::string;
#include <iostream>
using namespace std;
using std::cout;
using std::cerr;
using std::endl;
#include <vector>
using std::vector;
#ifdef ENABLE_PYTHON
#include "plugin/python/PythonRunner.h"

@ -6,8 +6,7 @@
#ifdef SHEDULER_DEBUG
#include <StringUtils.h>
#include <iostream>
using namespace std;
#define SDEBUG(msg) cout << bl::format(CONCAT("Scheduler::", msg, "\n"))
#define SDEBUG(msg) std::cout << bl::format(CONCAT("Scheduler::", msg, "\n"))
#else
//kind of workaround
class no_debug_format

@ -3,8 +3,12 @@
#include "cfg.h"
#include "util/Util.h"
#include <exception>
using std::exception;
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
using std::pair;
#include <boost/filesystem.hpp>
namespace bf = boost::filesystem;
@ -164,7 +168,7 @@ void MetadataManager::cleanupMetadata()
loadConfigFile();
vector<pair<string, int>> elements;
std::vector<std::pair<string, int>> elements;
for (bp::ptree::value_type p : *config)
{
@ -172,8 +176,8 @@ void MetadataManager::cleanupMetadata()
{
try
{
elements.push_back(pair<string, int>(p.first,
config->get_child(getINIpath(p.first)).get<int>("atime")));
elements.push_back(std::pair<string, int>(p.first,
config->get_child(getINIpath(p.first)).get<int>("atime")));
}
catch (exception& e)
{
@ -183,7 +187,7 @@ void MetadataManager::cleanupMetadata()
}
std::sort(elements.begin(), elements.end(),
[](const pair<string, int> &left, const pair<string, int> &right) {
[](const std::pair<string, int> &left, const std::pair<string, int> &right) {
return left.second >= right.second;
});
@ -193,7 +197,7 @@ void MetadataManager::cleanupMetadata()
}
bp::ptree* tmpTree = new bp::ptree();
for (pair<string, int> p : elements)
for (std::pair<string, int> p : elements)
{
tmpTree->add_child(getINIpath(p.first), config->get_child(getINIpath(p.first)));
}

@ -36,8 +36,7 @@
#ifdef RECOGNIZER_DEBUG
#include <StringUtils.h>
#include <iostream>
using namespace std;
#define RDEBUG(msg) cout << bl::format(CONCAT("ShapeReco::", msg, "\n"))
#define RDEBUG(msg) std::cout << bl::format(CONCAT("ShapeReco::", msg, "\n"))
#else
class no_debug_format
{

@ -22,7 +22,8 @@
#include <serializing/ObjectInputStream.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
EditSelection::EditSelection(UndoRedoHandler* undo, PageRef page, PageView* view)
{

@ -20,11 +20,12 @@
#include <gdk/gdkkeysyms.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
MainWindow::MainWindow(GladeSearchpath* gladeSearchPath, Control* control) :
GladeGui(gladeSearchPath, "main.glade", "mainWindow")
GladeGui(gladeSearchPath, "main.glade", "mainWindow")
{
XOJ_INIT_TYPE(MainWindow);

@ -6,7 +6,8 @@
#include "model/TexImage.h"
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
LatexGlade::LatexGlade(GladeSearchpath* gladeSearchPath) : GladeGui(gladeSearchPath, "texdialog.glade", "texDialog")
{

@ -25,7 +25,8 @@
#include "ToolItemDragCurrentData.h"
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
class ToolbarAdapter
{

@ -8,7 +8,8 @@
#include <stdio.h>
#include <fstream>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
ToolbarColorNames::ToolbarColorNames()
{

@ -4,7 +4,8 @@
#include <gtk/gtk.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
ToolbarData::ToolbarData(bool predefined)
{

@ -22,7 +22,8 @@
#include <math.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
static void gtk_xournal_class_init(GtkXournalClass* klass);
static void gtk_xournal_init(GtkXournal* xournal);

@ -10,8 +10,9 @@
#include <glib/gi18n-lib.h>
#include <string.h>
using namespace std;
#include <iostream>
using std::cout;
using std::endl;
Document::Document(DocumentHandler* handler)
{

@ -2,7 +2,9 @@
#include <Stacktrace.h>
using namespace std;
#include <iostream>
using std::cout;
using std::endl;
Layer::Layer()
{

@ -8,7 +8,8 @@
#include <math.h>
#include <string.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
Stroke::Stroke() : Element(ELEMENT_STROKE)
{

@ -4,7 +4,8 @@
#include "UpdateRefKey.h"
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
PdfObjectWriter::PdfObjectWriter(PdfWriter* writer, PdfXRef* xref)
{

@ -4,7 +4,8 @@
#include <GzHelper.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
bool PdfWriter::compressPdfOutput = true;

@ -9,14 +9,13 @@
* @license GNU GPLv2 or later
*/
#include <cppunit/extensions/HelperMacros.h>
#include "control/LoadHandler.h"
#include "../../control/LoadHandler.h"
#include <cppunit/extensions/HelperMacros.h>
#include <ctime>
#include "stdlib.h"
using namespace std;
using std::clock;
#include <stdlib.h>
class LoadHandlerTest: public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(LoadHandlerTest);

@ -13,10 +13,12 @@
#include <boost/locale/format.hpp>
#include <iostream>
using std::cerr;
using std::endl;
#include <fstream>
using std::ofstream;
#include <sstream>
#include <execinfo.h>
using namespace std;
static bool alreadyCrashed = false;
static Document* document = NULL;
@ -65,17 +67,17 @@ static void emergencySave();
* you can't do with it. So please don't touch anythink down there without
* previous consultation.
*/
class streamsplit : public stringstream
class streamsplit : public std::stringstream
{
public:
streamsplit(ofstream* file)
streamsplit(std::ofstream* file)
{
f = file;
}
template<typename T>
ostream& operator<<(T const & rhs)
std::ostream& operator<<(T const & rhs)
{
*f << rhs;
cerr << rhs;
@ -83,7 +85,7 @@ public:
}
private:
ofstream* f;
std::ofstream* f;
};
/**

@ -4,10 +4,10 @@
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
namespace bio = boost::iostreams;
#include <iostream>
#include <sstream>
using namespace std;
using std::stringstream;
GzHelper::GzHelper() { }
@ -15,25 +15,28 @@ GzHelper::~GzHelper() { }
string GzHelper::gzcompress(const string& str, const bio::zlib_params& params)
{
std::stringstream compressed;
std::stringstream decompressed;
stringstream decompressed;
decompressed << str;
boost::iostreams::filtering_istreambuf out;
bio::filtering_istreambuf out;
out.push(bio::zlib_compressor(params));
out.push(decompressed);
stringstream compressed;
bio::copy(out, compressed);
return compressed.str();
}
string GzHelper::gzuncompress(const string& str)
{
std::stringstream compressed;
std::stringstream decompressed;
stringstream compressed;
compressed << str;
bio::filtering_istreambuf in;
bio::filtering_istreambuf in;
in.push(bio::zlib_decompressor());
in.push(compressed);
stringstream decompressed;
bio::copy(in, decompressed);
return decompressed.str();
}

@ -15,7 +15,9 @@
#include <glib.h>
#include <iostream>
using namespace std;
using std::cout;
using std::cerr;
using std::endl;
LatexAction::LatexAction(string myTex, double tArea)
{

@ -1,6 +1,8 @@
#include "Stacktrace.h"
#include <execinfo.h>
#include <iostream>
using std::endl;
/**
* This code uses addr2line
@ -19,9 +21,7 @@ void Stacktrace::setExename(string name)
exeName = name;
}
using namespace std;
void Stacktrace::printStracktrace(ostream& stream)
void Stacktrace::printStracktrace(std::ostream& stream)
{
void* trace[32];
char** messages = (char**) NULL;

@ -10,7 +10,8 @@
#include <unistd.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
GdkColor Util::intToGdkColor(int c)
{

@ -6,7 +6,8 @@
#include <stdlib.h>
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
#ifdef XOJ_MEMORY_CHECK_ENABLED

@ -18,7 +18,8 @@
#ifdef SHOW_REPAINT_BOUNDS
#include <iostream>
using namespace std;
using std::cout;
using std::endl;
#endif
DocumentView::DocumentView()
@ -279,8 +280,7 @@ void DocumentView::drawLayer(cairo_t* cr, Layer* l)
gdk_threads_enter();
cairo_set_source_rgb(cr, 0, 1, 0);
cairo_set_line_width(cr, 1);
cairo_rectangle(cr, e->getX(), e->getY(), e->getElementWidth(),
e->getElementHeight());
cairo_rectangle(cr, e->getX(), e->getY(), e->getElementWidth(), e->getElementHeight());
cairo_stroke(cr);
gdk_threads_leave();
#endif // SHOW_ELEMENT_BOUNDS
@ -295,12 +295,12 @@ void DocumentView::drawLayer(cairo_t* cr, Layer* l)
drawed++;
#endif //SHOW_REPAINT_BOUNDS
}
#ifdef SHOW_REPAINT_BOUNDS
else
{
#ifdef SHOW_REPAINT_BOUNDS
notDrawed++;
#endif //SHOW_REPAINT_BOUNDS
}
#endif //SHOW_REPAINT_BOUNDS
}
else

Loading…
Cancel
Save