diff --git a/src/color.cpp b/src/color.cpp index 6baf6470cf8c33197932c6536efd45a9c58d7348..c3353ef1c3347a357452373cfcf925164dd5e18f 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -15,6 +15,7 @@ #include #include +#include #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::const_iterator i(icc->colors.begin()), + for (std::vector::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 165ad6c4ee7640d4a231550ca2d454bcd13310ff..a9d9ef818486fe29eed2437bf2b4208c3124263d 100644 --- a/src/device-manager.cpp +++ b/src/device-manager.cpp @@ -11,6 +11,7 @@ #include "device-manager.h" #include +#include #include "preferences.h" diff --git a/src/file-update.cpp b/src/file-update.cpp index 22dd022bc0b4ab08311c189ac60239b77f794409..f35107e2d1978408b2d6111b89a0394e30e2e45d 100644 --- a/src/file-update.cpp +++ b/src/file-update.cpp @@ -19,6 +19,7 @@ */ #include #include +#include #include @@ -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 cl = o->childList(false); + std::vector cl = o->childList(false); bool beginning = true; - for (vector::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) { + for (std::vector::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 cl = o->childList(false); - for (vector::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) { + std::vector cl = o->childList(false); + for (std::vector::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 cl = o->childList(false); - for (vector::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) + std::vector cl = o->childList(false); + for (std::vector::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 cl = o->childList(false); - for (vector::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) { + std::vector cl = o->childList(false); + for (std::vector::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 cl = o->childList(false); - for (vector::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) + std::vector cl = o->childList(false); + for (std::vector::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 6173854d9891161af66a189023a27eacae4a222c..4c244489c455415df8a0e460c4636c9df7685ae8 100644 --- a/src/graphlayout.cpp +++ b/src/graphlayout.cpp @@ -16,7 +16,10 @@ #include #include #include +#include #include +#include +#include #include #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 & selected, Rectangles & rs, - map & nodelookup) + CheckProgress(double d, unsigned i, std::list & selected, Rectangles & rs, + std::map & nodelookup) : TestConvergence(d, i) , selected(selected) , rs(rs) , nodelookup(nodelookup) {} - bool operator()(const double new_stress, valarray & X, valarray & Y) override { + bool operator()(const double new_stress, std::valarray & X, std::valarray & 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="<::iterator i_iter=nodelookup.find(item->getId()); + std::map::iterator i_iter=nodelookup.find(item->getId()); if (i_iter == nodelookup.end()) continue; unsigned u = i_iter->second; - vector nlist = item->avoidRef->getAttachedConnectors(Avoid::runningFrom); - list connectors; + std::vector nlist = item->avoidRef->getAttachedConnectors(Avoid::runningFrom); + std::list connectors; connectors.insert(connectors.end(), nlist.begin(), nlist.end()); @@ -172,7 +174,7 @@ void graphlayout(std::vector const & items) { // If iv not in nodelookup we again treat the connector // as disconnected and continue - map::iterator v_pair = nodelookup.find(iv->getId()); + std::map::iterator v_pair = nodelookup.find(iv->getId()); if (v_pair != nodelookup.end()) { unsigned v = v_pair->second; //cout << "Edge: (" << u <<","< const & items) { } } EdgeLengths elengths(es.size(), 1); - vector cs; + std::vector cs; connectedComponents(rs, es, cs); for (Component * c: cs) { if (c->edges.size() < 2) continue; @@ -201,7 +203,7 @@ void graphlayout(std::vector const & items) { for (SPItem * item: selected) { if (!isConnector(item)) { - map::iterator i = nodelookup.find(item->getId()); + std::map::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 dfb003727dace69f9a34c1d1df6c4b678c1078c2..81c722ddc2b7839638b006cd2e4719230497fea7 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 6f4dcf6c3b79eb1a73917a8b876729b42f1e5098..5214f0e2ce901d9a6456cadc999e77310fb9df7d 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 #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 -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 968714cf7646118dbca1379b3d2a674da6d98de0..325bf3935b98c3fb5808055845e0df29b9356d1c 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 -using std::vector; - namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp index f1e28770425112c95a58394374a33f5d3d641b3d..a7bbfd567b2dd9d09cf8e8eff1550405ec76d03e 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 -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 081c879907bbd752b761c62c8baf66b887164053..c667bdc49b2f5b3a9f0fe539543961d9a039642d 100644 --- a/src/live_effects/lpe-patternalongpath.cpp +++ b/src/live_effects/lpe-patternalongpath.cpp @@ -7,6 +7,7 @@ #include #include +#include #include <2geom/bezier-to-sbasis.h> @@ -20,8 +21,6 @@ // TODO due to internal breakage in glibmm headers, this must be last: #include -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 ffe507e340eda8c80d2aac199fff9c19f4aa2ffb..55d707af2e258a8972d72668fb6d7a2120d32848 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 -using std::memcpy; - namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index aa0f46eccdcc6bd83a67bcfe28a0cf2fb1925910..8936bd83aff5966af7c92053949c1226ba9de2d0 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 #include "live_effects/lpe-vonkoch.h" // TODO due to internal breakage in glibmm headers, this must be last: #include -//using std::vector; namespace Inkscape { namespace LivePathEffect { diff --git a/src/object/sp-filter.cpp b/src/object/sp-filter.cpp index 24f849cc6657d18a02578d149e6766089a18dcfd..da7e8142d5b91cf19fe04ddd94e2d703ff952f4e 100644 --- a/src/object/sp-filter.cpp +++ b/src/object/sp-filter.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -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::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; ++i) { + for (std::map::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::iterator result = this->_image_name->find(const_cast(name)); + std::map::iterator result = this->_image_name->find(const_cast(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 new_pair(name_copy, value); - const pair::iterator,bool> ret = this->_image_name->insert(new_pair); + std::pair new_pair(name_copy, value); + const std::pair::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::const_iterator i + for (std::map::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 bbb66aa4ab1f8b98f7f82659c636b0ad7b0d2e4b..8dbc68f09c423ce536d8d83689abba425b0d5e01 100644 --- a/src/object/sp-guide.cpp +++ b/src/object/sp-guide.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #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::const_iterator i(attached_items.begin()), + for (std::vector::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::const_iterator i(attached_items.begin()), + for (std::vector::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::const_iterator i(guide->attached_items.begin()), + for (std::vector::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 88fe6ca5680dd1fb2531f4ede31cf6b090f6a1ed..3b476e20d053b44615c620781955938655efa9b3 100644 --- a/src/object/sp-item-rm-unsatisfied-cns.cpp +++ b/src/object/sp-item-rm-unsatisfied-cns.cpp @@ -10,13 +10,12 @@ #include #include <2geom/coord.h> +#include #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 f70d91b9fd78545e44414f85ed059992d426baaf..c16627eab7d7fe3b5c7640b9bc7356d3ac67e638 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 #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 snappoints; item.getSnappoints(snappoints, nullptr); /* TODO: Implement the ordering. */ - vector found_cns; + std::vector 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::const_iterator fi(found_cns.begin()), + for (std::vector::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 5222fc5f27339d89a875a25a73443f10449f2d0f..714518f08b5dca7f4457ebe3bcb55c6bb9202007 100644 --- a/src/object/sp-object.cpp +++ b/src/object/sp-object.cpp @@ -18,6 +18,7 @@ #include #include +#include #include @@ -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(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 55c67b0ff8bd895541eb4bb925ac71032b5869cd..210a1989ee7cc05e261adaff028e262a19e6ad59 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -17,6 +17,7 @@ */ #include +#include #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 1da630004b7c0aebf143b8c5762f526a90068f6c..57e44f45aac8f61f0ad26ec846f7fcb426c309f5 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -12,6 +12,7 @@ */ #include <2geom/transforms.h> +#include #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 38b5c7f89c741153c779faf6dfc8c906a0b3a2c0..38d4c65ff821aaff98f579ad5c7440c0e21ea3c5 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 305952248c8e7ba8425b5e3563548d6eefb372c4..c87d84a9fdd1d19a26aeadae4676b16175760303 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -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 f6ffaf8cc267ec9b30fc586e39e290e984ec693f..8abe4fa3df9227fbaefdda90bf0d0839a256e1e8 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 be919ca546accff57e7e0bfe51d20bcab26ddca3..1a0c3d8b8ef31ba07c1d6bbc1702bc287f93d266 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 #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 sp_svg_create_color_hash(); +static std::map 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 colors; + static std::map 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 +static std::map sp_svg_create_color_hash() { - std::map colors; + std::map 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 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 262c6e1d50db2ab7834be3e50c484ad7641f4a6b..a84c38bd4fa6ff20c68eb784d67c175b87cfef19 100644 --- a/src/svg/svg-length.cpp +++ b/src/svg/svg-length.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "svg.h" #include "stringstream.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index ba101921b91eaa1f74c40d2c1124d39a2febd999..c751950ba146fbd87b9a0c1ad5cce77e7b460f09 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 #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 dbe84ea3839ea1354bfe914bc421aea096ed796d..d993c211321e7cb10050dac2a8381319b9380f3c 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include //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_list; + std::list 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::iterator filter_iterator = filter_list.begin(); + for(std::list::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_list; + std::list 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::iterator filter_iterator = filter_list.begin(); + for(std::list::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_list; + std::list filter_list; knownExtensions.clear(); @@ -1655,7 +1656,7 @@ void FileSaveDialogImplWin32::createFilterMenu() _filter = new wchar_t[filter_length]; wchar_t *filterptr = _filter; - for(list::iterator filter_iterator = filter_list.begin(); + for(std::list::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_list; + std::list 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::iterator filter_iterator = filter_list.begin(); + for(std::list::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 4ae36ed232ebe109e8a4bfc3ad7a8ce95f8f2dde..28990bd2d61cab3d4d781671bf9b1e22aeb5d767 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -22,6 +22,7 @@ */ #include +#include #include #include @@ -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 8c52dafa0702d4badb94cc3882240307db91705c..1f62ecec6d9e17597da23f1f3ff936f084a75cf9 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 #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 boxes; }; -static vector desktops; -static vector dtws; +static std::vector desktops; +static std::vector dtws; static std::map trackedBoxes; @@ -82,7 +80,7 @@ public: void addTrack( SPDesktopWidget* dtw ) override; void delTrack( SPDesktopWidget* dtw ) override; - void connectToDesktop( vector const & toolboxes, SPDesktop *desktop ) override; + void connectToDesktop( std::vector 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::iterator iter = std::find(dtws.begin(), dtws.end(), dtw); + std::vector::iterator iter = std::find(dtws.begin(), dtws.end(), dtw); if (iter != dtws.end()) { dtws.erase(iter); } } -void UXManagerImpl::connectToDesktop( vector const & toolboxes, SPDesktop *desktop ) +void UXManagerImpl::connectToDesktop( std::vector const & toolboxes, SPDesktop *desktop ) { if (!desktop) { return; } TrackItem &tracker = trackedBoxes[desktop]; - vector& tracked = tracker.boxes; + std::vector& 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 030e90af0782df77f342a2e4d6702b2fdcd09e3d..df6af9626b9fe1465e78e8cf042259ae4c2b7b5f 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 f22032b651839eae89a44ec71b06297c62d31eec..2de9a9a28c92ff3233af16f7469e55484ef42d53 100644 --- a/src/ui/widget/preview.cpp +++ b/src/ui/widget/preview.cpp @@ -36,8 +36,6 @@ * ***** END LICENSE BLOCK ***** */ #include -using std::min; - #include #include "preview.h" #include "preferences.h" @@ -272,7 +270,7 @@ Preview::on_draw(const Cairo::RefPtr &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 &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 &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 b4a58fe4d4f361d3ebc685c613e7c50d09e82830..9cd0cf19fd59116dd489aadfbb4174c5549a7ffc 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -16,6 +16,7 @@ #include #include +#include #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(); sel->swatch_widgets.~vector(); } diff --git a/src/xml/composite-node-observer.cpp b/src/xml/composite-node-observer.cpp index e3b40d43bccc922406903d9855e171cb90522047..1f9c08681dcf432073f19be6deae0b0d29b25733 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(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; }