From ebdf25bf6710c9cf585489302dcd8ca23b9b226a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 12 May 2002 21:15:40 +0000 Subject: [PATCH] removed all 'using namespace std;' calls. --- src/Basemenu.cc | 3 ++- src/Image.cc | 3 ++- src/Screen.cc | 45 ++++++++++++++++++++++----------------------- src/Slit.cc | 14 +++++++------- src/Toolbar.cc | 14 +++++++------- src/Window.cc | 10 +--------- 6 files changed, 41 insertions(+), 48 deletions(-) diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 8a3429a0..689d2018 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc @@ -43,7 +43,8 @@ #endif // HAVE_STRING_H #include -using namespace std; +using std::min; +using std::max; #include "i18n.h" #include "openbox.h" diff --git a/src/Image.cc b/src/Image.cc index 3a4c14cf..cd702f6f 100644 --- a/src/Image.cc +++ b/src/Image.cc @@ -67,7 +67,8 @@ typedef unsigned int u_int32_t; #endif // HAVE_CTYPE_H #include -using namespace std; +using std::min; +using std::max; static unsigned long bsqrt(unsigned long x) { if (x <= 0) return 0; diff --git a/src/Screen.cc b/src/Screen.cc index 60ae159e..5e52e10e 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1,4 +1,3 @@ -#include // Screen.cc for Openbox // Copyright (c) 2001 Sean 'Shaleh' Perry // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) @@ -105,7 +104,7 @@ #include #include #include -using namespace std; +using std::ends; static Bool running = True; @@ -916,7 +915,7 @@ XFontSet BScreen::createFontSet(const char *fontname) { void BScreen::setSloppyFocus(bool b) { resource.sloppy_focus = b; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".focusModel" << ends; config.setValue(s.str(), (resource.sloppy_focus ? @@ -928,7 +927,7 @@ void BScreen::setSloppyFocus(bool b) { void BScreen::setAutoRaise(bool a) { resource.auto_raise = a; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".focusModel" << ends; config.setValue(s.str(), (resource.sloppy_focus ? @@ -940,7 +939,7 @@ void BScreen::setAutoRaise(bool a) { void BScreen::setImageDither(bool d, bool reconfig) { image_control->setDither(d); - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".imageDither" << ends; config.setValue(s.str(), imageDither()); if (reconfig) @@ -951,7 +950,7 @@ void BScreen::setImageDither(bool d, bool reconfig) { void BScreen::setOpaqueMove(bool o) { resource.opaque_move = o; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".opaqueMove" << ends; config.setValue(s.str(), resource.opaque_move); s.rdbuf()->freeze(0); @@ -960,7 +959,7 @@ void BScreen::setOpaqueMove(bool o) { void BScreen::setFullMax(bool f) { resource.full_max = f; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".fullMaximization" << ends; config.setValue(s.str(), resource.full_max); s.rdbuf()->freeze(0); @@ -969,7 +968,7 @@ void BScreen::setFullMax(bool f) { void BScreen::setFocusNew(bool f) { resource.focus_new = f; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".focusNewWindows" << ends; config.setValue(s.str(), resource.focus_new); s.rdbuf()->freeze(0); @@ -978,7 +977,7 @@ void BScreen::setFocusNew(bool f) { void BScreen::setFocusLast(bool f) { resource.focus_last = f; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".focusLastWindow" << ends; config.setValue(s.str(), resource.focus_last); s.rdbuf()->freeze(0); @@ -987,7 +986,7 @@ void BScreen::setFocusLast(bool f) { void BScreen::setWindowZones(int z) { resource.zones = z; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".windowZones" << ends; config.setValue(s.str(), resource.zones); s.rdbuf()->freeze(0); @@ -996,7 +995,7 @@ void BScreen::setWindowZones(int z) { void BScreen::setWorkspaceCount(int w) { resource.workspaces = w; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".workspaces" << ends; config.setValue(s.str(), resource.workspaces); s.rdbuf()->freeze(0); @@ -1005,7 +1004,7 @@ void BScreen::setWorkspaceCount(int w) { void BScreen::setPlacementPolicy(int p) { resource.placement_policy = p; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".windowPlacement" << ends; const char *placement; switch (resource.placement_policy) { @@ -1024,7 +1023,7 @@ void BScreen::setPlacementPolicy(int p) { void BScreen::setEdgeSnapThreshold(int t) { resource.edge_snap_threshold = t; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".edgeSnapThreshold" << ends; config.setValue(s.str(), resource.edge_snap_threshold); s.rdbuf()->freeze(0); @@ -1033,7 +1032,7 @@ void BScreen::setEdgeSnapThreshold(int t) { void BScreen::setRowPlacementDirection(int d) { resource.row_direction = d; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".rowPlacementDirection" << ends; config.setValue(s.str(), resource.row_direction == LeftRight ? @@ -1044,7 +1043,7 @@ void BScreen::setRowPlacementDirection(int d) { void BScreen::setColPlacementDirection(int d) { resource.col_direction = d; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".colPlacementDirection" << ends; config.setValue(s.str(), resource.col_direction == TopBottom ? @@ -1072,7 +1071,7 @@ void BScreen::setStrftimeFormat(const char *f) { delete [] resource.strftime_format; resource.strftime_format = bstrdup(f); - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".strftimeFormat" << ends; config.setValue(s.str(), resource.strftime_format); s.rdbuf()->freeze(0); @@ -1082,7 +1081,7 @@ void BScreen::setStrftimeFormat(const char *f) { void BScreen::setDateFormat(int f) { resource.date_format = f; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".dateFormat" << ends; config.setValue(s.str(), resource.date_format == B_EuropeanDate ? "European" : "American"); @@ -1092,7 +1091,7 @@ void BScreen::setDateFormat(int f) { void BScreen::setClock24Hour(Bool c) { resource.clock24hour = c; - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".clockFormat" << ends; config.setValue(s.str(), resource.clock24hour ? 24 : 12); s.rdbuf()->freeze(0); @@ -1106,7 +1105,7 @@ void BScreen::setHideToolbar(bool b) { getToolbar()->unMapToolbar(); else getToolbar()->mapToolbar(); - ostrstream s; + std::ostrstream s; s << "session.screen" << getScreenNumber() << ".hideToolbar" << ends; config.setValue(s.str(), resource.hide_toolbar ? "True" : "False"); s.rdbuf()->freeze(0); @@ -1114,7 +1113,7 @@ void BScreen::setHideToolbar(bool b) { void BScreen::saveWorkspaceNames() { - ostrstream rc, names; + std::ostrstream rc, names; wkspList::iterator it; wkspList::iterator last = workspacesList.end() - 1; @@ -1165,7 +1164,7 @@ void BScreen::save() { void BScreen::load() { - ostrstream rscreen, rname, rclass; + std::ostrstream rscreen, rname, rclass; std::string s; bool b; long l; @@ -1251,9 +1250,9 @@ void BScreen::load() { rname << rscreen.str() << "workspaceNames" << ends; rclass << rscreen.str() << "WorkspaceNames" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { - string::const_iterator it = s.begin(), end = s.end(); + std::string::const_iterator it = s.begin(), end = s.end(); while(1) { - string::const_iterator tmp = it;// current string.begin() + std::string::const_iterator tmp = it;// current string.begin() it = std::find(tmp, end, ','); // look for comma between tmp and end std::string name(tmp, it); // name = s[tmp:it] addWorkspaceName(name.c_str()); diff --git a/src/Slit.cc b/src/Slit.cc index 85a7c64d..034a054b 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -43,7 +43,7 @@ #include #include -using namespace std; +using std::ends; Slit::Slit(BScreen &scr, Resource &conf) : screen(scr), openbox(scr.getOpenbox()), config(conf) @@ -212,7 +212,7 @@ void Slit::removeClient(Window w, Bool remap) { void Slit::setOnTop(bool b) { m_ontop = b; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".slit.onTop" << ends; config.setValue(s.str(), m_ontop ? "True" : "False"); s.rdbuf()->freeze(0); @@ -220,7 +220,7 @@ void Slit::setOnTop(bool b) { void Slit::setAutoHide(bool b) { m_autohide = b; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".slit.autoHide" << ends; config.setValue(s.str(), m_autohide ? "True" : "False"); s.rdbuf()->freeze(0); @@ -228,7 +228,7 @@ void Slit::setAutoHide(bool b) { void Slit::setPlacement(int p) { m_placement = p; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".slit.placement" << ends; const char *placement; @@ -248,7 +248,7 @@ void Slit::setPlacement(int p) { void Slit::setDirection(int d) { m_direction = d; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".slit.direction" << ends; config.setValue(s.str(), @@ -264,8 +264,8 @@ void Slit::save() { } void Slit::load() { - ostrstream rscreen, rname, rclass; - string s; + std::ostrstream rscreen, rname, rclass; + std::string s; bool b; rscreen << "session.screen" << screen.getScreenNumber() << '.' << ends; diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 5d5e924a..fd219144 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -64,7 +64,7 @@ #include #include -using namespace std; +using std::ends; Toolbar::Toolbar(BScreen &scrn, Resource &conf) : screen(scrn), openbox(scrn.getOpenbox()), config(conf) @@ -215,7 +215,7 @@ Toolbar::~Toolbar() { void Toolbar::setOnTop(bool b) { m_ontop = b; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".toolbar.onTop" << ends; config.setValue(s.str(), m_ontop ? "True" : "False"); s.rdbuf()->freeze(0); @@ -223,7 +223,7 @@ void Toolbar::setOnTop(bool b) { void Toolbar::setAutoHide(bool b) { m_autohide = b; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".toolbar.autoHide" << ends; config.setValue(s.str(), m_autohide ? "True" : "False"); @@ -232,7 +232,7 @@ void Toolbar::setAutoHide(bool b) { void Toolbar::setWidthPercent(int w) { m_width_percent = w; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".toolbar.widthPercent" << ends; config.setValue(s.str(), m_width_percent); @@ -241,7 +241,7 @@ void Toolbar::setWidthPercent(int w) { void Toolbar::setPlacement(int p) { m_placement = p; - ostrstream s; + std::ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".toolbar.placement" << ends; const char *placement; @@ -265,8 +265,8 @@ void Toolbar::save() { } void Toolbar::load() { - ostrstream rscreen, rname, rclass; - string s; + std::ostrstream rscreen, rname, rclass; + std::string s; bool b; long l; rscreen << "session.screen" << screen.getScreenNumber() << '.' << ends; diff --git a/src/Window.cc b/src/Window.cc index 0a02daa1..ec042c30 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -56,9 +56,6 @@ #endif // SLIT #include "Util.h" -#include -using namespace std; - /* * Initializes the class with default values/the window's set initial values. */ @@ -2208,7 +2205,6 @@ void OpenboxWindow::redrawCloseButton(Bool pressed) { void OpenboxWindow::mapRequestEvent(XMapRequestEvent *re) { - cout << "MAP REQUEST " << client.window << " " << client.title << endl; if (re->window == client.window) { #ifdef DEBUG fprintf(stderr, i18n->getMessage(WindowSet, WindowMapRequest, @@ -2797,7 +2793,6 @@ void OpenboxWindow::startMove(int x, int y) { } frame.grab_x = x - frame.x - frame.border_w; frame.grab_y = y - frame.y - frame.border_w; - cout << "START MOVE " << client.window << " " << client.title << endl; } @@ -2891,7 +2886,6 @@ void OpenboxWindow::endMove() { // cause problems XEvent e; while (XCheckTypedWindowEvent(display, frame.window, MotionNotify, &e)); - cout << "END MOVE " << client.window << " " << client.title << endl; } @@ -2910,7 +2904,6 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { Bool left = resize_zone & ZoneLeft; if (! flags.resizing) { - cout << "START RESIZE " << client.window << " " << client.title << endl; Cursor cursor; if (resize_zone & ZoneTop) cursor = (resize_zone & ZoneLeft) ? @@ -2984,8 +2977,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { screen->showGeometry(gx, gy); } - } else - cout << "MOTION " << client.window << " " << client.title << endl; + } } -- 2.44.0