summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2019-03-06 23:54:12 +0000
committerMartin Owens <doctormo@gmail.com>2019-03-06 23:54:12 +0000
commit3711d5d705436c20590c1ff4cef12e67beed6597 (patch)
tree9026f75a574bc3b9b531acb959eced87c5d4a9f7 /src
parentMerge: Correct text for enabling grid (diff)
parentAvoid the “using std::*;” or “using namespace std;” constructs. (diff)
downloadinkscape-3711d5d705436c20590c1ff4cef12e67beed6597.tar.gz
inkscape-3711d5d705436c20590c1ff4cef12e67beed6597.zip
Merge: Avoid the “using std::*;” or “using namespace std;” construct
Diffstat (limited to 'src')
-rw-r--r--src/color.cpp4
-rw-r--r--src/device-manager.cpp1
-rw-r--r--src/file-update.cpp24
-rw-r--r--src/graphlayout.cpp36
-rw-r--r--src/layer-fns.cpp2
-rw-r--r--src/live_effects/lpe-bendpath.cpp4
-rw-r--r--src/live_effects/lpe-envelope.cpp2
-rw-r--r--src/live_effects/lpe-gears.cpp1
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp3
-rw-r--r--src/live_effects/lpe-test-doEffect-stack.cpp2
-rw-r--r--src/live_effects/lpe-vonkoch.cpp2
-rw-r--r--src/object/sp-filter.cpp14
-rw-r--r--src/object/sp-guide.cpp8
-rw-r--r--src/object/sp-item-rm-unsatisfied-cns.cpp3
-rw-r--r--src/object/sp-item-update-cns.cpp11
-rw-r--r--src/object/sp-object.cpp23
-rw-r--r--src/snap.cpp2
-rw-r--r--src/sp-item-notify-moveto.cpp3
-rw-r--r--src/splivarot.cpp5
-rw-r--r--src/style.cpp2
-rw-r--r--src/svg/strip-trailing-zeros.cpp18
-rw-r--r--src/svg/svg-color.cpp27
-rw-r--r--src/svg/svg-length.cpp1
-rw-r--r--src/ui/dialog/document-properties.cpp3
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp19
-rw-r--r--src/ui/tools/spray-tool.cpp2
-rw-r--r--src/ui/uxmanager.cpp16
-rw-r--r--src/ui/widget/page-sizer.cpp14
-rw-r--r--src/ui/widget/preview.cpp8
-rw-r--r--src/widgets/gradient-selector.cpp2
-rw-r--r--src/xml/composite-node-observer.cpp6
31 files changed, 116 insertions, 152 deletions
diff --git a/src/color.cpp b/src/color.cpp
index 6baf6470c..c3353ef1c 100644
--- a/src/color.cpp
+++ b/src/color.cpp
@@ -15,6 +15,7 @@
#include <cmath>
#include <cstdio>
+#include <vector>
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
@@ -29,7 +30,6 @@
#define return_val_if_fail(x, val) if (!(x)) { printf("assertion failed: " #x); return val; }
using Inkscape::CSSOStringStream;
-using std::vector;
static bool profileMatches( SVGICCColor const* first, SVGICCColor const* second );
@@ -205,7 +205,7 @@ std::string SPColor::toString() const
css << " ";
}
css << "icc-color(" << icc->colorProfile;
- for (vector<double>::const_iterator i(icc->colors.begin()),
+ for (std::vector<double>::const_iterator i(icc->colors.begin()),
iEnd(icc->colors.end());
i != iEnd; ++i) {
css << ", " << *i;
diff --git a/src/device-manager.cpp b/src/device-manager.cpp
index 165ad6c4e..a9d9ef818 100644
--- a/src/device-manager.cpp
+++ b/src/device-manager.cpp
@@ -11,6 +11,7 @@
#include "device-manager.h"
#include <set>
+#include <vector>
#include "preferences.h"
diff --git a/src/file-update.cpp b/src/file-update.cpp
index 22dd022bc..f35107e2d 100644
--- a/src/file-update.cpp
+++ b/src/file-update.cpp
@@ -19,6 +19,7 @@
*/
#include <clocale>
#include <string>
+#include <vector>
#include <gtkmm.h>
@@ -64,7 +65,6 @@
using Inkscape::DocumentUndo;
-using namespace std;
int sp_file_convert_dpi_method_commandline = -1; // Unset
@@ -85,9 +85,9 @@ void fix_blank_line(SPObject *o)
SPIFontSize fontsize = o->style->font_size;
SPILengthOrNormal lineheight = o->style->line_height;
- vector<SPObject *> cl = o->childList(false);
+ std::vector<SPObject *> cl = o->childList(false);
bool beginning = true;
- for (vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) {
+ for (std::vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) {
SPObject *i = *ci;
if ((SP_IS_TSPAN(i) && is_line(i)) || SP_IS_FLOWPARA(i) || SP_IS_FLOWDIV(i)) {
if (sp_text_get_length((SPItem *)i) <= 1) { // empty line
@@ -116,8 +116,8 @@ void fix_line_spacing(SPObject *o)
{
SPILengthOrNormal lineheight = o->style->line_height;
bool inner = false;
- vector<SPObject *> cl = o->childList(false);
- for (vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) {
+ std::vector<SPObject *> cl = o->childList(false);
+ for (std::vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) {
SPObject *i = *ci;
if ((SP_IS_TSPAN(i) && is_line(i)) || SP_IS_FLOWPARA(i) || SP_IS_FLOWDIV(i)) {
// if no line-height attribute, set it
@@ -138,10 +138,10 @@ void fix_line_spacing(SPObject *o)
void fix_font_name(SPObject *o)
{
- vector<SPObject *> cl = o->childList(false);
- for (vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci)
+ std::vector<SPObject *> cl = o->childList(false);
+ for (std::vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci)
fix_font_name(*ci);
- string prev = o->style->font_family.value ? o->style->font_family.value : o->style->font_family.value_default;
+ std::string prev = o->style->font_family.value ? o->style->font_family.value : o->style->font_family.value_default;
if (prev == "Sans")
o->style->font_family.read("sans-serif");
else if (prev == "Serif")
@@ -157,8 +157,8 @@ void fix_font_size(SPObject *o)
if (!fontsize.set)
return;
bool inner = false;
- vector<SPObject *> cl = o->childList(false);
- for (vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) {
+ std::vector<SPObject *> cl = o->childList(false);
+ for (std::vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) {
SPObject *i = *ci;
fix_font_size(i);
if ((SP_IS_TSPAN(i) && is_line(i)) || SP_IS_FLOWPARA(i) || SP_IS_FLOWDIV(i)) {
@@ -181,8 +181,8 @@ void sp_file_text_run_recursive(void (*f)(SPObject *), SPObject *o)
if (SP_IS_TEXT(o) || SP_IS_FLOWTEXT(o))
f(o);
else {
- vector<SPObject *> cl = o->childList(false);
- for (vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci)
+ std::vector<SPObject *> cl = o->childList(false);
+ for (std::vector<SPObject *>::const_iterator ci = cl.begin(); ci != cl.end(); ++ci)
sp_file_text_run_recursive(f, *ci);
}
}
diff --git a/src/graphlayout.cpp b/src/graphlayout.cpp
index 6173854d9..4c244489c 100644
--- a/src/graphlayout.cpp
+++ b/src/graphlayout.cpp
@@ -16,7 +16,10 @@
#include <algorithm>
#include <cstring>
#include <iostream>
+#include <list>
#include <map>
+#include <string>
+#include <valarray>
#include <vector>
#include <2geom/transforms.h>
@@ -36,7 +39,6 @@
#include "object/sp-path.h"
#include "style.h"
-using namespace std;
using namespace cola;
using namespace vpsc;
@@ -52,19 +54,19 @@ bool isConnector(SPItem const * const item) {
}
struct CheckProgress: TestConvergence {
- CheckProgress(double d, unsigned i, list<SPItem*> & selected, Rectangles & rs,
- map<string, unsigned> & nodelookup)
+ CheckProgress(double d, unsigned i, std::list<SPItem*> & selected, Rectangles & rs,
+ std::map<std::string, unsigned> & nodelookup)
: TestConvergence(d, i)
, selected(selected)
, rs(rs)
, nodelookup(nodelookup)
{}
- bool operator()(const double new_stress, valarray<double> & X, valarray<double> & Y) override {
+ bool operator()(const double new_stress, std::valarray<double> & X, std::valarray<double> & Y) override {
/* This is where, if we wanted to animate the layout, we would need to update
* the positions of all objects and redraw the canvas and maybe sleep a bit
cout << "stress="<<new_stress<<endl;
cout << "x[0]="<<rs[0]->getMinX()<<endl;
- for (list<SPItem *>::iterator it(selected.begin());
+ for (std::list<SPItem *>::iterator it(selected.begin());
it != selected.end();
++it)
{
@@ -80,16 +82,16 @@ struct CheckProgress: TestConvergence {
*/
return TestConvergence::operator()(new_stress, X, Y);
}
- list<SPItem*> & selected;
+ std::list<SPItem*> & selected;
Rectangles & rs;
- map<string, unsigned> & nodelookup;
+ std::map<std::string, unsigned> & nodelookup;
};
/**
* Scans the items list and places those items that are
* not connectors in filtered
*/
-void filterConnectors(std::vector<SPItem*> const & items, list<SPItem*> & filtered) {
+void filterConnectors(std::vector<SPItem*> const & items, std::list<SPItem*> & filtered) {
for (SPItem * item: items) {
if (!isConnector(item)) {
filtered.push_back(item);
@@ -105,7 +107,7 @@ void filterConnectors(std::vector<SPItem*> const & items, list<SPItem*> & filter
void graphlayout(std::vector<SPItem*> const & items) {
if (items.empty()) return;
- list<SPItem*> selected;
+ std::list<SPItem*> selected;
filterConnectors(items, selected);
if (selected.size() < 2) return;
@@ -116,9 +118,9 @@ void graphlayout(std::vector<SPItem*> const & items) {
double spacing = 0;
if (desktop) spacing = desktop->namedview->connector_spacing + 0.1;
- map<string, unsigned> nodelookup;
+ std::map<std::string, unsigned> nodelookup;
Rectangles rs;
- vector<Edge> es;
+ std::vector<Edge> es;
for (SPItem * item: selected) {
Geom::OptRect const item_box = item->desktopVisualBounds();
if (item_box) {
@@ -145,11 +147,11 @@ void graphlayout(std::vector<SPItem*> const & items) {
bool avoid_overlaps = prefs->getBool("/tools/connector/avoidoverlaplayout");
for (SPItem * item: selected) {
- map<string, unsigned>::iterator i_iter=nodelookup.find(item->getId());
+ std::map<std::string, unsigned>::iterator i_iter=nodelookup.find(item->getId());
if (i_iter == nodelookup.end()) continue;
unsigned u = i_iter->second;
- vector<SPItem*> nlist = item->avoidRef->getAttachedConnectors(Avoid::runningFrom);
- list<SPItem*> connectors;
+ std::vector<SPItem*> nlist = item->avoidRef->getAttachedConnectors(Avoid::runningFrom);
+ std::list<SPItem*> connectors;
connectors.insert(connectors.end(), nlist.begin(), nlist.end());
@@ -172,7 +174,7 @@ void graphlayout(std::vector<SPItem*> const & items) {
// If iv not in nodelookup we again treat the connector
// as disconnected and continue
- map<string, unsigned>::iterator v_pair = nodelookup.find(iv->getId());
+ std::map<std::string, unsigned>::iterator v_pair = nodelookup.find(iv->getId());
if (v_pair != nodelookup.end()) {
unsigned v = v_pair->second;
//cout << "Edge: (" << u <<","<<v<<")"<<endl;
@@ -187,7 +189,7 @@ void graphlayout(std::vector<SPItem*> const & items) {
}
}
EdgeLengths elengths(es.size(), 1);
- vector<Component*> cs;
+ std::vector<Component*> cs;
connectedComponents(rs, es, cs);
for (Component * c: cs) {
if (c->edges.size() < 2) continue;
@@ -201,7 +203,7 @@ void graphlayout(std::vector<SPItem*> const & items) {
for (SPItem * item: selected) {
if (!isConnector(item)) {
- map<string, unsigned>::iterator i = nodelookup.find(item->getId());
+ std::map<std::string, unsigned>::iterator i = nodelookup.find(item->getId());
if (i != nodelookup.end()) {
Rectangle * r = rs[i->second];
Geom::OptRect item_box = item->desktopVisualBounds();
diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp
index dfb003727..81c722ddc 100644
--- a/src/layer-fns.cpp
+++ b/src/layer-fns.cpp
@@ -107,8 +107,6 @@ static SPObject *last_elder_layer(SPObject *root, SPObject *layer) {
* @returns NULL if there are no further layers under \a root
*/
SPObject *next_layer(SPObject *root, SPObject *layer) {
- using std::find_if;
-
g_return_val_if_fail(layer != nullptr, NULL);
SPObject *result = nullptr;
diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp
index 6f4dcf6c3..5214f0e2c 100644
--- a/src/live_effects/lpe-bendpath.cpp
+++ b/src/live_effects/lpe-bendpath.cpp
@@ -6,6 +6,7 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
+#include <vector>
#include "live_effects/lpe-bendpath.h"
#include "knot-holder-entity.h"
#include "knotholder.h"
@@ -13,9 +14,6 @@
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-using std::vector;
-
-
/* Theory in e-mail from J.F. Barraud
Let B be the skeleton path, and P the pattern (the path to be deformed).
diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp
index 968714cf7..325bf3935 100644
--- a/src/live_effects/lpe-envelope.cpp
+++ b/src/live_effects/lpe-envelope.cpp
@@ -10,8 +10,6 @@
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-using std::vector;
-
namespace Inkscape {
namespace LivePathEffect {
diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp
index f1e287704..a7bbfd567 100644
--- a/src/live_effects/lpe-gears.cpp
+++ b/src/live_effects/lpe-gears.cpp
@@ -12,7 +12,6 @@
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-using std::vector;
using namespace Geom;
class Gear {
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp
index 081c87990..c667bdc49 100644
--- a/src/live_effects/lpe-patternalongpath.cpp
+++ b/src/live_effects/lpe-patternalongpath.cpp
@@ -7,6 +7,7 @@
#include <cmath>
#include <algorithm>
+#include <vector>
#include <2geom/bezier-to-sbasis.h>
@@ -20,8 +21,6 @@
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-using std::vector;
-
/* Theory in e-mail from J.F. Barraud
Let B be the skeleton path, and P the pattern (the path to be deformed).
diff --git a/src/live_effects/lpe-test-doEffect-stack.cpp b/src/live_effects/lpe-test-doEffect-stack.cpp
index ffe507e34..55d707af2 100644
--- a/src/live_effects/lpe-test-doEffect-stack.cpp
+++ b/src/live_effects/lpe-test-doEffect-stack.cpp
@@ -10,8 +10,6 @@
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-using std::memcpy;
-
namespace Inkscape {
namespace LivePathEffect {
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index aa0f46ecc..8936bd83a 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -5,11 +5,11 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
+#include <vector>
#include "live_effects/lpe-vonkoch.h"
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
-//using std::vector;
namespace Inkscape {
namespace LivePathEffect {
diff --git a/src/object/sp-filter.cpp b/src/object/sp-filter.cpp
index 24f849cc6..da7e8142d 100644
--- a/src/object/sp-filter.cpp
+++ b/src/object/sp-filter.cpp
@@ -19,6 +19,7 @@
#include <map>
#include <cstring>
#include <utility>
+#include <vector>
#include <glibmm.h>
@@ -31,9 +32,6 @@
#include "uri.h"
#include "xml/repr.h"
-using std::map;
-using std::pair;
-
static void filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter);
static void filter_ref_modified(SPObject *href, guint flags, SPFilter *filter);
@@ -101,7 +99,7 @@ void SPFilter::release() {
this->href = nullptr;
}
- for (map<gchar *, int, ltstr>::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; ++i) {
+ for (std::map<gchar *, int, ltstr>::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; ++i) {
g_free(i->first);
}
@@ -421,7 +419,7 @@ int SPFilter::primitive_count() const {
}
int SPFilter::get_image_name(gchar const *name) const {
- map<gchar *, int, ltstr>::iterator result = this->_image_name->find(const_cast<gchar*>(name));
+ std::map<gchar *, int, ltstr>::iterator result = this->_image_name->find(const_cast<gchar*>(name));
if (result == this->_image_name->end()) return -1;
else return (*result).second;
}
@@ -430,8 +428,8 @@ int SPFilter::set_image_name(gchar const *name) {
int value = this->_image_number_next;
this->_image_number_next++;
gchar *name_copy = strdup(name);
- pair<gchar*,int> new_pair(name_copy, value);
- const pair<map<gchar*,int,ltstr>::iterator,bool> ret = this->_image_name->insert(new_pair);
+ std::pair<gchar*,int> new_pair(name_copy, value);
+ const std::pair<std::map<gchar*,int,ltstr>::iterator,bool> ret = this->_image_name->insert(new_pair);
if (ret.second == false) {
// The element is not inserted (because an element with the same key was already in the map)
// Therefore, free the memory allocated for the new entry:
@@ -467,7 +465,7 @@ gchar const *SPFilter::name_for_image(int const image) const {
return nullptr;
break;
default:
- for (map<gchar *, int, ltstr>::const_iterator i
+ for (std::map<gchar *, int, ltstr>::const_iterator i
= this->_image_name->begin() ;
i != this->_image_name->end() ; ++i) {
if (i->second == image) {
diff --git a/src/object/sp-guide.cpp b/src/object/sp-guide.cpp
index bbb66aa4a..8dbc68f09 100644
--- a/src/object/sp-guide.cpp
+++ b/src/object/sp-guide.cpp
@@ -19,6 +19,7 @@
#include <algorithm>
#include <cstring>
#include <string>
+#include <vector>
#include "display/sp-canvas.h"
#include "display/guideline.h"
@@ -40,7 +41,6 @@
#include "verbs.h"
using Inkscape::DocumentUndo;
-using std::vector;
SPGuide::SPGuide()
: SPObject()
@@ -406,7 +406,7 @@ void SPGuide::moveto(Geom::Point const point_on_line, bool const commit)
}
/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
- for (vector<SPGuideAttachment>::const_iterator i(attached_items.begin()),
+ for (std::vector<SPGuideAttachment>::const_iterator i(attached_items.begin()),
iEnd(attached_items.end());
i != iEnd; ++i)
{
@@ -445,7 +445,7 @@ void SPGuide::set_normal(Geom::Point const normal_to_line, bool const commit)
}
/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
- for (vector<SPGuideAttachment>::const_iterator i(attached_items.begin()),
+ for (std::vector<SPGuideAttachment>::const_iterator i(attached_items.begin()),
iEnd(attached_items.end());
i != iEnd; ++i)
{
@@ -550,7 +550,7 @@ void sp_guide_remove(SPGuide *guide)
{
g_assert(SP_IS_GUIDE(guide));
- for (vector<SPGuideAttachment>::const_iterator i(guide->attached_items.begin()),
+ for (std::vector<SPGuideAttachment>::const_iterator i(guide->attached_items.begin()),
iEnd(guide->attached_items.end());
i != iEnd; ++i)
{
diff --git a/src/object/sp-item-rm-unsatisfied-cns.cpp b/src/object/sp-item-rm-unsatisfied-cns.cpp
index 88fe6ca56..3b476e20d 100644
--- a/src/object/sp-item-rm-unsatisfied-cns.cpp
+++ b/src/object/sp-item-rm-unsatisfied-cns.cpp
@@ -10,13 +10,12 @@
#include <algorithm>
#include <2geom/coord.h>
+#include <vector>
#include "remove-last.h"
#include "sp-guide.h"
#include "sp-item-rm-unsatisfied-cns.h"
-using std::vector;
-
void sp_item_rm_unsatisfied_cns(SPItem &item)
{
if (item.constraints.empty()) {
diff --git a/src/object/sp-item-update-cns.cpp b/src/object/sp-item-update-cns.cpp
index f70d91b9f..c16627eab 100644
--- a/src/object/sp-item-update-cns.cpp
+++ b/src/object/sp-item-update-cns.cpp
@@ -8,31 +8,28 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
-
+#include <vector>
#include "satisfied-guide-cns.h"
#include "sp-item-update-cns.h"
#include "sp-guide.h"
-using std::find;
-using std::vector;
-
void sp_item_update_cns(SPItem &item, SPDesktop const &desktop)
{
std::vector<Inkscape::SnapCandidatePoint> snappoints;
item.getSnappoints(snappoints, nullptr);
/* TODO: Implement the ordering. */
- vector<SPGuideConstraint> found_cns;
+ std::vector<SPGuideConstraint> found_cns;
satisfied_guide_cns(desktop, snappoints, found_cns);
/* effic: It might be nice to avoid an n^2 algorithm, but in practice n will be
small enough that it's still usually more efficient. */
- for (vector<SPGuideConstraint>::const_iterator fi(found_cns.begin()),
+ for (std::vector<SPGuideConstraint>::const_iterator fi(found_cns.begin()),
fiEnd(found_cns.end());
fi != fiEnd; ++fi)
{
SPGuideConstraint const &cn = *fi;
- if ( find(item.constraints.begin(),
+ if ( std::find(item.constraints.begin(),
item.constraints.end(),
cn)
== item.constraints.end() )
diff --git a/src/object/sp-object.cpp b/src/object/sp-object.cpp
index 5222fc5f2..714518f08 100644
--- a/src/object/sp-object.cpp
+++ b/src/object/sp-object.cpp
@@ -18,6 +18,7 @@
#include <cstring>
#include <string>
+#include <vector>
#include <boost/range/adaptor/transformed.hpp>
@@ -44,12 +45,6 @@
#include "util/format.h"
#include "util/longest-common-suffix.h"
-using std::memcpy;
-using std::strchr;
-using std::strcmp;
-using std::strlen;
-using std::strstr;
-
#define noSP_OBJECT_DEBUG_CASCADE
#define noSP_OBJECT_DEBUG
@@ -736,7 +731,7 @@ void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, uns
}
/* Redefine ID, if required */
- if ((id == nullptr) || (strcmp(id, this->getId()) != 0)) {
+ if ((id == nullptr) || (std::strcmp(id, this->getId()) != 0)) {
this->repr->setAttribute("id", this->getId());
}
} else if (id) {
@@ -944,17 +939,17 @@ void SPObject::set(SPAttributeEnum key, gchar const* value) {
object->_default_label = nullptr;
break;
case SP_ATTR_INKSCAPE_COLLECT:
- if ( value && !strcmp(value, "always") ) {
+ if ( value && !std::strcmp(value, "always") ) {
object->setCollectionPolicy(SPObject::ALWAYS_COLLECT);
} else {
object->setCollectionPolicy(SPObject::COLLECT_WITH_PARENT);
}
break;
case SP_ATTR_XML_SPACE:
- if (value && !strcmp(value, "preserve")) {
+ if (value && !std::strcmp(value, "preserve")) {
object->xml_space.value = SP_XML_SPACE_PRESERVE;
object->xml_space.set = TRUE;
- } else if (value && !strcmp(value, "default")) {
+ } else if (value && !std::strcmp(value, "default")) {
object->xml_space.value = SP_XML_SPACE_DEFAULT;
object->xml_space.set = TRUE;
} else if (object->parent) {
@@ -1410,7 +1405,7 @@ sp_object_get_unique_id(SPObject *object,
gchar const *name = object->getRepr()->name();
g_assert(name != nullptr);
- gchar const *local = strchr(name, ':');
+ gchar const *local = std::strchr(name, ':');
if (local) {
name = local + 1;
}
@@ -1421,10 +1416,10 @@ sp_object_get_unique_id(SPObject *object,
}
}
- size_t const name_len = strlen(name);
+ size_t const name_len = std::strlen(name);
size_t const buflen = name_len + (sizeof(count) * 10 / 4) + 1;
gchar *const buf = (gchar *) g_malloc(buflen);
- memcpy(buf, name, name_len);
+ std::memcpy(buf, name, name_len);
gchar *const count_buf = buf + name_len;
size_t const count_buflen = buflen - name_len;
do {
@@ -1567,7 +1562,7 @@ SPObject* SPObject::findFirstChild(gchar const *tagname) const
for (auto& child: const_cast<SPObject*>(this)->children)
{
if (child.repr->type() == Inkscape::XML::ELEMENT_NODE &&
- !strcmp(child.repr->name(), tagname)) {
+ !std::strcmp(child.repr->name(), tagname)) {
return &child;
}
}
diff --git a/src/snap.cpp b/src/snap.cpp
index 55c67b0ff..210a1989e 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -17,6 +17,7 @@
*/
#include <utility>
+#include <vector>
#include <2geom/transforms.h>
@@ -36,7 +37,6 @@
#include "ui/tools/tool-base.h"
-using std::vector;
using Inkscape::Util::round_to_upper_multiple_plus;
using Inkscape::Util::round_to_lower_multiple_plus;
diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp
index 1da630004..57e44f45a 100644
--- a/src/sp-item-notify-moveto.cpp
+++ b/src/sp-item-notify-moveto.cpp
@@ -12,6 +12,7 @@
*/
#include <2geom/transforms.h>
+#include <vector>
#include "sp-item-notify-moveto.h"
@@ -19,8 +20,6 @@
#include "object/sp-item.h"
#include "object/sp-item-rm-unsatisfied-cns.h"
-using std::vector;
-
#define return_if_fail(test) if (!(test)) { printf("WARNING: assertion '%s' failed", #test); return; }
/**
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 38b5c7f89..38d4c65ff 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -466,9 +466,8 @@ BoolOpErrors Inkscape::ObjectSet::pathBoolOp(bool_op bop, const bool skip_undo,
// reverse if needed
// note that the selection list keeps its order
if ( reverseOrderForOp ) {
- using std::swap;
- swap(originaux[0], originaux[1]);
- swap(origWind[0], origWind[1]);
+ std::swap(originaux[0], originaux[1]);
+ std::swap(origWind[0], origWind[1]);
}
// and work
diff --git a/src/style.cpp b/src/style.cpp
index 305952248..c87d84a9f 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -26,6 +26,7 @@
#include <string>
#include <algorithm>
#include <unordered_map>
+#include <vector>
#include <glibmm/regex.h>
@@ -51,7 +52,6 @@
#include "xml/simple-document.h"
using Inkscape::CSSOStringStream;
-using std::vector;
#define BMAX 8192
diff --git a/src/svg/strip-trailing-zeros.cpp b/src/svg/strip-trailing-zeros.cpp
index f6ffaf8cc..8abe4fa3d 100644
--- a/src/svg/strip-trailing-zeros.cpp
+++ b/src/svg/strip-trailing-zeros.cpp
@@ -14,28 +14,26 @@
#include "svg/strip-trailing-zeros.h"
-using std::string;
-
-string
-strip_trailing_zeros(string str)
+std::string
+strip_trailing_zeros(std::string str)
{
- string::size_type p_ix = str.find('.');
- if (p_ix != string::npos) {
- string::size_type e_ix = str.find('e', p_ix);
+ std::string::size_type p_ix = str.find('.');
+ if (p_ix != std::string::npos) {
+ std::string::size_type e_ix = str.find('e', p_ix);
/* N.B. In some contexts (e.g. CSS) it is an error for a number to contain `e'. fixme:
* Default to avoiding `e', e.g. using sprintf(str, "%17f", d). Add a new function that
* allows use of `e' and use that function only where the spec allows it.
*/
- string::size_type nz_ix = str.find_last_not_of('0', (e_ix == string::npos
+ std::string::size_type nz_ix = str.find_last_not_of('0', (e_ix == std::string::npos
? e_ix
: e_ix - 1));
- if (nz_ix == string::npos || nz_ix < p_ix || nz_ix >= e_ix) {
+ if (nz_ix == std::string::npos || nz_ix < p_ix || nz_ix >= e_ix) {
g_error("have `.' but couldn't find non-0");
} else {
str.erase(str.begin() + (nz_ix == p_ix
? p_ix
: nz_ix + 1),
- (e_ix == string::npos
+ (e_ix == std::string::npos
? str.end()
: str.begin() + e_ix));
}
diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp
index be919ca54..1a0c3d8b8 100644
--- a/src/svg/svg-color.cpp
+++ b/src/svg/svg-color.cpp
@@ -35,6 +35,7 @@
#include "color.h"
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
+#include <vector>
#include "object/color-profile.h"
#include "document.h"
@@ -44,13 +45,9 @@
#include "cms-system.h"
-using std::sprintf;
-using std::string;
-using Inkscape::CMSSystem;
-
struct SPSVGColor {
unsigned long rgb;
- const string name;
+ const std::string name;
};
/*
@@ -207,7 +204,7 @@ static SPSVGColor const sp_svg_color_named[] = {
{ 0x9ACD32, "yellowgreen" }
};
-static std::map<string, unsigned long> sp_svg_create_color_hash();
+static std::map<std::string, unsigned long> sp_svg_create_color_hash();
guint32 sp_svg_read_color(gchar const *str, guint32 const dfl)
{
@@ -216,7 +213,7 @@ guint32 sp_svg_read_color(gchar const *str, guint32 const dfl)
static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_ptr, guint32 def)
{
- static std::map<string, unsigned long> colors;
+ static std::map<std::string, unsigned long> colors;
guint32 val = 0;
if (str == nullptr) return def;
@@ -382,8 +379,8 @@ static guint32 internal_sp_svg_read_color(gchar const *str, gchar const **end_pt
}
c[31] = '\0';
- if (colors.count(string(c))) {
- val = colors[string(c)];
+ if (colors.count(std::string(c))) {
+ val = colors[std::string(c)];
}
else {
return def;
@@ -462,12 +459,12 @@ static void rgb24_to_css(char *const buf, unsigned const rgb24)
default: {
if ((rgb24 & 0xf0f0f) * 0x11 == rgb24) {
/* Can use the shorter three-digit form #rgb instead of #rrggbb. */
- sprintf(buf, "#%x%x%x",
+ std::sprintf(buf, "#%x%x%x",
(rgb24 >> 16) & 0xf,
(rgb24 >> 8) & 0xf,
rgb24 & 0xf);
} else {
- sprintf(buf, "#%06x", rgb24);
+ std::sprintf(buf, "#%06x", rgb24);
}
break;
}
@@ -500,10 +497,10 @@ void sp_svg_write_color(gchar *buf, unsigned const buflen, guint32 const rgba32)
}
}
-static std::map<string, unsigned long>
+static std::map<std::string, unsigned long>
sp_svg_create_color_hash()
{
- std::map<string, unsigned long> colors;
+ std::map<std::string, unsigned long> colors;
for (const auto & i : sp_svg_color_named) {
colors[i.name] = i.rgb;
@@ -524,7 +521,7 @@ g_message("profile name: %s", icc->colorProfile.c_str());
if ( trans ) {
std::vector<colorspace::Component> comps = colorspace::getColorSpaceInfo( prof );
- size_t count = CMSSystem::getChannelCount( prof );
+ size_t count = Inkscape::CMSSystem::getChannelCount( prof );
size_t cap = std::min(count, comps.size());
guchar color_in[4];
for (size_t i = 0; i < cap; i++) {
@@ -532,7 +529,7 @@ g_message("profile name: %s", icc->colorProfile.c_str());
g_message("input[%d]: %d", (int)i, (int)color_in[i]);
}
- CMSSystem::doTransform( trans, color_in, color_out, 1 );
+ Inkscape::CMSSystem::doTransform( trans, color_in, color_out, 1 );
g_message("transform to sRGB done");
}
*r = color_out[0];
diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp
index 262c6e1d5..a84c38bd4 100644
--- a/src/svg/svg-length.cpp
+++ b/src/svg/svg-length.cpp
@@ -16,6 +16,7 @@
#include <string>
#include <glib.h>
#include <iostream>
+#include <vector>
#include "svg.h"
#include "stringstream.h"
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 5ff5d128a..6828602ee 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -23,6 +23,7 @@
# include "config.h" // only include where actually required!
#endif
+#include <vector>
#include "style.h"
#include "rdf.h"
#include "verbs.h"
@@ -47,8 +48,6 @@
#include "object/color-profile.h"
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
-using std::pair;
-
namespace Inkscape {
namespace UI {
namespace Dialog {
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index dbe84ea38..d993c2113 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -21,6 +21,8 @@
#include <gdkmm/general.h>
#include <glibmm/fileutils.h>
#include <glibmm/i18n.h>
+#include <list>
+#include <vector>
//Inkscape includes
#include "display/cairo-utils.h"
@@ -34,7 +36,6 @@
#include "util/units.h"
-using namespace std;
using namespace Glib;
using namespace Cairo;
using namespace Gdk::Cairo;
@@ -184,7 +185,7 @@ FileOpenDialogImplWin32::~FileOpenDialogImplWin32()
void FileOpenDialogImplWin32::addFilterMenu(Glib::ustring name, Glib::ustring pattern)
{
- list<Filter> filter_list;
+ std::list<Filter> filter_list;
int extension_index = 0;
int filter_length = 1;
@@ -210,7 +211,7 @@ void FileOpenDialogImplWin32::addFilterMenu(Glib::ustring name, Glib::ustring pa
_filter = new wchar_t[filter_length];
wchar_t *filterptr = _filter;
- for(list<Filter>::iterator filter_iterator = filter_list.begin();
+ for(std::list<Filter>::iterator filter_iterator = filter_list.begin();
filter_iterator != filter_list.end(); ++filter_iterator)
{
const Filter &filter = *filter_iterator;
@@ -242,7 +243,7 @@ void FileOpenDialogImplWin32::addFilterMenu(Glib::ustring name, Glib::ustring pa
void FileOpenDialogImplWin32::createFilterMenu()
{
- list<Filter> filter_list;
+ std::list<Filter> filter_list;
int extension_index = 0;
int filter_length = 1;
@@ -427,7 +428,7 @@ void FileOpenDialogImplWin32::createFilterMenu()
_filter = new wchar_t[filter_length];
wchar_t *filterptr = _filter;
- for(list<Filter>::iterator filter_iterator = filter_list.begin();
+ for(std::list<Filter>::iterator filter_iterator = filter_list.begin();
filter_iterator != filter_list.end(); ++filter_iterator)
{
const Filter &filter = *filter_iterator;
@@ -1609,7 +1610,7 @@ FileSaveDialogImplWin32::~FileSaveDialogImplWin32()
void FileSaveDialogImplWin32::createFilterMenu()
{
- list<Filter> filter_list;
+ std::list<Filter> filter_list;
knownExtensions.clear();
@@ -1655,7 +1656,7 @@ void FileSaveDialogImplWin32::createFilterMenu()
_filter = new wchar_t[filter_length];
wchar_t *filterptr = _filter;
- for(list<Filter>::iterator filter_iterator = filter_list.begin();
+ for(std::list<Filter>::iterator filter_iterator = filter_list.begin();
filter_iterator != filter_list.end(); ++filter_iterator)
{
const Filter &filter = *filter_iterator;
@@ -1685,7 +1686,7 @@ void FileSaveDialogImplWin32::createFilterMenu()
void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring pattern)
{
- list<Filter> filter_list;
+ std::list<Filter> filter_list;
knownExtensions.clear();
@@ -1716,7 +1717,7 @@ void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring patt
_filter = new wchar_t[filter_length];
wchar_t *filterptr = _filter;
- for(list<Filter>::iterator filter_iterator = filter_list.begin();
+ for(std::list<Filter>::iterator filter_iterator = filter_list.begin();
filter_iterator != filter_list.end(); ++filter_iterator)
{
const Filter &filter = *filter_iterator;
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index 4ae36ed23..28990bd2d 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -22,6 +22,7 @@
*/
#include <numeric>
+#include <vector>
#include <gdk/gdkkeysyms.h>
#include <glibmm/i18n.h>
@@ -66,7 +67,6 @@
using Inkscape::DocumentUndo;
-using namespace std;
#define DDC_RED_RGBA 0xff0000ff
#define DYNA_MIN_WIDTH 1.0e-6
diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp
index 8c52dafa0..1f62ecec6 100644
--- a/src/ui/uxmanager.cpp
+++ b/src/ui/uxmanager.cpp
@@ -10,6 +10,7 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
+#include <vector>
#include "widgets/desktop-widget.h"
#include "uxmanager.h"
@@ -18,9 +19,6 @@
#include "util/ege-tags.h"
#include "widgets/toolbox.h"
-
-using std::vector;
-
class TrackItem
{
public:
@@ -33,8 +31,8 @@ public:
std::vector<GtkWidget*> boxes;
};
-static vector<SPDesktop*> desktops;
-static vector<SPDesktopWidget*> dtws;
+static std::vector<SPDesktop*> desktops;
+static std::vector<SPDesktopWidget*> dtws;
static std::map<SPDesktop*, TrackItem> trackedBoxes;
@@ -82,7 +80,7 @@ public:
void addTrack( SPDesktopWidget* dtw ) override;
void delTrack( SPDesktopWidget* dtw ) override;
- void connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ) override;
+ void connectToDesktop( std::vector<GtkWidget *> const & toolboxes, SPDesktop *desktop ) override;
gint getDefaultTask( SPDesktop *desktop ) override;
void setTask(SPDesktop* dt, gint val) override;
@@ -199,20 +197,20 @@ void UXManagerImpl::addTrack( SPDesktopWidget* dtw )
void UXManagerImpl::delTrack( SPDesktopWidget* dtw )
{
- vector<SPDesktopWidget*>::iterator iter = std::find(dtws.begin(), dtws.end(), dtw);
+ std::vector<SPDesktopWidget*>::iterator iter = std::find(dtws.begin(), dtws.end(), dtw);
if (iter != dtws.end()) {
dtws.erase(iter);
}
}
-void UXManagerImpl::connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDesktop *desktop )
+void UXManagerImpl::connectToDesktop( std::vector<GtkWidget *> const & toolboxes, SPDesktop *desktop )
{
if (!desktop)
{
return;
}
TrackItem &tracker = trackedBoxes[desktop];
- vector<GtkWidget*>& tracked = tracker.boxes;
+ std::vector<GtkWidget*>& tracked = tracker.boxes;
tracker.destroyConn = desktop->connectDestroy(&desktopDestructHandler);
for (auto toolbox : toolboxes) {
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 030e90af0..df6af9626 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -27,9 +27,6 @@
#include "object/sp-root.h"
#include "io/resource.h"
-using std::pair;
-using Inkscape::Util::unit_table;
-
namespace Inkscape {
namespace UI {
namespace Widget {
@@ -133,7 +130,7 @@ PageSizer::PageSizer(Registry & _wr)
snprintf(formatBuf, 79, "%0.1f x %0.1f", width, height);
Glib::ustring desc = formatBuf;
desc.append(" " + std::string(line[3]));
- PaperSize paper(name, width, height, unit_table.getUnit(line[3]));
+ PaperSize paper(name, width, height, Inkscape::Util::unit_table.getUnit(line[3]));
_paperSizeTable[name] = paper;
Gtk::TreeModel::Row row = *(_paperSizeListStore->append());
row[_paperSizeListColumns.nameColumn] = name;
@@ -450,12 +447,9 @@ PageSizer::updateFitMarginsUI(Inkscape::XML::Node *nv_repr)
Gtk::ListStore::iterator
PageSizer::find_paper_size (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h) const
{
- using Inkscape::Util::Quantity;
- using std::swap;
-
// The code below assumes that w < h, so make sure that's the case:
if ( h < w ) {
- swap(h,w);
+ std::swap(h,w);
}
g_return_val_if_fail(w <= h, _paperSizeListStore->children().end());
@@ -464,8 +458,8 @@ PageSizer::find_paper_size (Inkscape::Util::Quantity w, Inkscape::Util::Quantity
for (iter = _paperSizeTable.begin() ;
iter != _paperSizeTable.end() ; ++iter) {
PaperSize paper = iter->second;
- Quantity smallX (paper.smaller, paper.unit);
- Quantity largeX (paper.larger, paper.unit);
+ Inkscape::Util::Quantity smallX (paper.smaller, paper.unit);
+ Inkscape::Util::Quantity largeX (paper.larger, paper.unit);
g_return_val_if_fail(smallX.quantity < largeX.quantity + 0.001, _paperSizeListStore->children().end());
diff --git a/src/ui/widget/preview.cpp b/src/ui/widget/preview.cpp
index f22032b65..2de9a9a28 100644
--- a/src/ui/widget/preview.cpp
+++ b/src/ui/widget/preview.cpp
@@ -36,8 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include <algorithm>
-using std::min;
-
#include <gdkmm/general.h>
#include "preview.h"
#include "preferences.h"
@@ -272,7 +270,7 @@ Preview::on_draw(const Cairo::RefPtr<Cairo::Context> &cr)
context->render_arrow(cr,
G_PI, // Down-pointing arrow
area.x, area.y,
- min(area.width, area.height)
+ std::min(area.width, area.height)
);
}
@@ -286,7 +284,7 @@ Preview::on_draw(const Cairo::RefPtr<Cairo::Context> &cr)
context->render_arrow(cr,
G_PI, // Down-pointing arrow
otherArea.x, otherArea.y,
- min(otherArea.width, otherArea.height)
+ std::min(otherArea.width, otherArea.height)
);
}
@@ -300,7 +298,7 @@ Preview::on_draw(const Cairo::RefPtr<Cairo::Context> &cr)
context->render_arrow(cr,
1.5*G_PI, // Left-pointing arrow
otherArea.x, otherArea.y,
- min(otherArea.width, otherArea.height)
+ std::min(otherArea.width, otherArea.height)
);
}
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index b4a58fe4d..9cd0cf19f 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -16,6 +16,7 @@
#include <glibmm/i18n.h>
#include <gtkmm/treeview.h>
+#include <vector>
#include "document-undo.h"
#include "document.h"
@@ -213,7 +214,6 @@ static void sp_gradient_selector_dispose(GObject *object)
if ( sel->safelyInit ) {
sel->safelyInit = false;
- using std::vector;
sel->nonsolid.~vector<GtkWidget*>();
sel->swatch_widgets.~vector<GtkWidget*>();
}
diff --git a/src/xml/composite-node-observer.cpp b/src/xml/composite-node-observer.cpp
index e3b40d43b..1f9c08681 100644
--- a/src/xml/composite-node-observer.cpp
+++ b/src/xml/composite-node-observer.cpp
@@ -161,8 +161,6 @@ void CompositeNodeObserver::addListener(NodeEventVector const &vector,
namespace {
-using std::find_if;
-using Algorithms::find_if_before;
typedef CompositeNodeObserver::ObserverRecord ObserverRecord;
typedef CompositeNodeObserver::ObserverRecordList ObserverRecordList;
@@ -205,7 +203,7 @@ bool remove_one(ObserverRecordList &observers, unsigned &/*marked_count*/,
return true;
}
- ObserverRecordList::iterator found=find_if_before(
+ ObserverRecordList::iterator found=Algorithms::find_if_before(
observers.begin(), observers.end(),
unmarked_record_satisfying<Predicate>(p)
);
@@ -233,7 +231,7 @@ void remove_all_marked(ObserverRecordList &observers, unsigned &marked_count)
iter = observers.begin();
while (marked_count) {
- iter = find_if_before(iter, observers.end(), is_marked);
+ iter = Algorithms::find_if_before(iter, observers.end(), is_marked);
observers.erase_after(iter);
--marked_count;
}