diff options
author | Friedemann Kleint <[email protected]> | 2022-12-16 08:44:38 +0100 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2022-12-19 11:12:39 +0100 |
commit | 7c670b40b9fc2681260d0fdbcc275afd9bf6c2e8 (patch) | |
tree | 079b9c9db430888764b75ef5d0a514cf371265e0 /sources/shiboken6/tests/libsample | |
parent | 2a37c2a1c8d6ba3ce58a699254eac9da3b1ae106 (diff) |
shiboken6/test: Remove using namespace std
It causes clashes wrt std::byte/byte in CMake UNITY_BUILD (jumbo) builds.
Task-number: PYSIDE-2155
Change-Id: I62184c363f85ca7aa227453f2a4d776e61ae0c70
Reviewed-by: Cristian Maureira-Fredes <[email protected]>
Diffstat (limited to 'sources/shiboken6/tests/libsample')
22 files changed, 137 insertions, 194 deletions
diff --git a/sources/shiboken6/tests/libsample/abstract.cpp b/sources/shiboken6/tests/libsample/abstract.cpp index 7d4a21ceb..5994e685c 100644 --- a/sources/shiboken6/tests/libsample/abstract.cpp +++ b/sources/shiboken6/tests/libsample/abstract.cpp @@ -5,8 +5,6 @@ #include "abstract.h" #include "objecttype.h" -using namespace std; - const int Abstract::staticPrimitiveField = 0; Abstract::Abstract(int id) : m_id(id) @@ -42,23 +40,23 @@ Abstract::callPureVirtual() void Abstract::show(PrintFormat format) { - cout << '<'; + std::cout << '<'; switch(format) { case Short: - cout << this; + std::cout << this; break; case Verbose: - cout << "class " << className() << " | cptr: " << this; - cout << ", id: " << m_id; + std::cout << "class " << className() << " | cptr: " << this + << ", id: " << m_id; break; case OnlyId: - cout << "id: " << m_id; + std::cout << "id: " << m_id; break; case ClassNameAndId: - cout << className() << " - id: " << m_id; + std::cout << className() << " - id: " << m_id; break; } - cout << '>'; + std::cout << '>'; } void Abstract::callVirtualGettingEnum(PrintFormat p) diff --git a/sources/shiboken6/tests/libsample/blackbox.cpp b/sources/shiboken6/tests/libsample/blackbox.cpp index f648a3770..e6fc20049 100644 --- a/sources/shiboken6/tests/libsample/blackbox.cpp +++ b/sources/shiboken6/tests/libsample/blackbox.cpp @@ -3,8 +3,6 @@ #include "blackbox.h" -using namespace std; - BlackBox::~BlackBox() { // Free all maps. diff --git a/sources/shiboken6/tests/libsample/bucket.cpp b/sources/shiboken6/tests/libsample/bucket.cpp index 01a1f591e..87a42118a 100644 --- a/sources/shiboken6/tests/libsample/bucket.cpp +++ b/sources/shiboken6/tests/libsample/bucket.cpp @@ -12,9 +12,6 @@ #define SLEEP(x) usleep(x) #endif - -using namespace std; - Bucket::Bucket() : m_locked(false) { } diff --git a/sources/shiboken6/tests/libsample/complex.cpp b/sources/shiboken6/tests/libsample/complex.cpp index ce2c2b7de..d06b33fbf 100644 --- a/sources/shiboken6/tests/libsample/complex.cpp +++ b/sources/shiboken6/tests/libsample/complex.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "complex.h" -using namespace std; - Complex::Complex(double real, double imag) : m_real(real), m_imag(imag) { @@ -23,7 +21,7 @@ Complex::operator+(Complex& other) void Complex::show() { - cout << "(real: " << m_real << ", imag: " << m_imag << ")"; + std::cout << "(real: " << m_real << ", imag: " << m_imag << ")"; } diff --git a/sources/shiboken6/tests/libsample/derived.cpp b/sources/shiboken6/tests/libsample/derived.cpp index 87a8669ff..62b64c6c4 100644 --- a/sources/shiboken6/tests/libsample/derived.cpp +++ b/sources/shiboken6/tests/libsample/derived.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "derived.h" -using namespace std; - Derived::Derived(int id) : Abstract(id) { } diff --git a/sources/shiboken6/tests/libsample/functions.cpp b/sources/shiboken6/tests/libsample/functions.cpp index d96a58abd..210daec7c 100644 --- a/sources/shiboken6/tests/libsample/functions.cpp +++ b/sources/shiboken6/tests/libsample/functions.cpp @@ -7,12 +7,10 @@ #include <iostream> #include <numeric> -using namespace std; - void printSomething() { - cout << __FUNCTION__ << endl; + std::cout << __FUNCTION__ << std::endl; } int @@ -227,7 +225,7 @@ void ClassWithFunctionPointer::doNothing(void *operand) (void) operand; } -string addStdStrings(const std::string &s1, const std::string &s2) +std::string addStdStrings(const std::string &s1, const std::string &s2) { return s1 + s2; } @@ -239,5 +237,5 @@ std::wstring addStdWStrings(const std::wstring &s1, const std::wstring &s2) void testNullPtrT(std::nullptr_t) { - cout << __FUNCTION__ << '\n'; + std::cout << __FUNCTION__ << '\n'; } diff --git a/sources/shiboken6/tests/libsample/injectcode.cpp b/sources/shiboken6/tests/libsample/injectcode.cpp index 488f7faae..d83d53d1a 100644 --- a/sources/shiboken6/tests/libsample/injectcode.cpp +++ b/sources/shiboken6/tests/libsample/injectcode.cpp @@ -4,8 +4,6 @@ #include "injectcode.h" #include <sstream> -using namespace std; - InjectCode::InjectCode() { } diff --git a/sources/shiboken6/tests/libsample/listuser.cpp b/sources/shiboken6/tests/libsample/listuser.cpp index 6801bfdf3..4260c1fb5 100644 --- a/sources/shiboken6/tests/libsample/listuser.cpp +++ b/sources/shiboken6/tests/libsample/listuser.cpp @@ -5,8 +5,6 @@ #include <cstdlib> #include "listuser.h" -using namespace std; - std::list<int> ListUser::callCreateList() { diff --git a/sources/shiboken6/tests/libsample/main.cpp b/sources/shiboken6/tests/libsample/main.cpp index 9d62e753b..8791deaf2 100644 --- a/sources/shiboken6/tests/libsample/main.cpp +++ b/sources/shiboken6/tests/libsample/main.cpp @@ -12,42 +12,40 @@ #include "listuser.h" #include "samplenamespace.h" -using namespace std; - int main(int argv, char **argc) { - cout << endl; + std::cout << std::endl; Derived derived; - cout << endl; + std::cout << std::endl; derived.unpureVirtual(); derived.pureVirtual(); derived.callPureVirtual(); - cout << endl; + std::cout << std::endl; Abstract* abs; abs = Abstract::createObject(); - cout << "Abstract::createObject(): " << abs << endl << endl; + std::cout << "Abstract::createObject(): " << abs << std::endl << std::endl; delete abs; abs = Derived::createObject(); - cout << "Derived::createObject() : "; + std::cout << "Derived::createObject() : "; abs->show(); - cout << endl; + std::cout << std::endl; delete abs; - cout << endl; + std::cout << std::endl; abs = Derived::createObject(); - cout << "Derived::createObject() : "; + std::cout << "Derived::createObject() : "; abs->show(); - cout << endl; + std::cout << std::endl; delete abs; - cout << endl; + std::cout << std::endl; - cout << endl << "-----------------------------------------" << endl; + std::cout << "\n-----------------------------------------\n"; KinderGarten kg; Derived* d[] = { 0, 0, 0 }; @@ -55,164 +53,157 @@ main(int argv, char **argc) for (int i = 0; i < 3; i++) { d[i] = new Derived(i); d[i]->show(); - cout << endl; + std::cout << std::endl; kg.addChild(d[i]); } kg.show(); - cout << endl; + std::cout << std::endl; - cout << endl << "* kill child "; + std::cout << "\n* kill child "; d[2]->show(); - cout << " ----------------" << endl; + std::cout << " ----------------\n"; kg.killChild(d[2]); kg.show(); - cout << endl; + std::cout << std::endl; - cout << endl << "* release child "; + std::cout << "\n* release child "; d[1]->show(); - cout << " -------------" << endl; + std::cout << " -------------\n"; Abstract* released = kg.releaseChild(d[1]); - cout << "released: "; + std::cout << "released: "; released->show(); - cout << endl; + std::cout << std::endl; kg.show(); - cout << endl; - - cout << endl << "* kill children ------------------------------------" << endl; + std::cout << "\n\n* kill children ------------------------------------\n"; kg.killChildren(); kg.show(); - cout << endl << endl; - - cout << "-----------------------------------------" << endl; + std::cout << "\n\n-----------------------------------------\n"; ListUser lu; - cout << "ListUser::createList()" << endl; + std::cout << "ListUser::createList()\n"; std::list<int> intlist = lu.createList(); - for (std::list<int>::iterator it = intlist.begin(); it != intlist.end(); it++) { - cout << "* " << *it << endl; - } + for (std::list<int>::iterator it = intlist.begin(); it != intlist.end(); it++) + std::cout << "* " << *it << std::endl; - cout << "ListUser::createComplexList" << endl; + std::cout << "ListUser::createComplexList\n"; std::list<Complex> cpxlist = ListUser::createComplexList(Complex(1.1, 2.2), Complex(3.3, 4.4)); for (std::list<Complex>::iterator it = cpxlist.begin(); it != cpxlist.end(); it++) { - cout << "* "; + std::cout << "* "; (*it).show(); - cout << endl; + std::cout << std::endl; } - cout << endl; - - cout << "-----------------------------------------" << endl; - cout << "SampleNamespace" << endl; - - cout << "SampleNamespace::RandomNumber: "; - cout << SampleNamespace::getNumber(SampleNamespace::RandomNumber); - cout << endl; - cout << "SampleNamespace::UnixTime: "; - cout << SampleNamespace::getNumber(SampleNamespace::UnixTime); - cout << endl; + std::cout << "\n-----------------------------------------\n" + << "SampleNamespace\n"; + + std::cout << "SampleNamespace::RandomNumber: "; + std::cout << SampleNamespace::getNumber(SampleNamespace::RandomNumber); + std::cout << std::endl; + std::cout << "SampleNamespace::UnixTime: "; + std::cout << SampleNamespace::getNumber(SampleNamespace::UnixTime); + std::cout << std::endl; double val_d = 1.3; - cout << "SampleNamespace::powerOfTwo(" << val_d << "): "; - cout << SampleNamespace::powerOfTwo(val_d) << endl; + std::cout << "SampleNamespace::powerOfTwo(" << val_d << "): "; + std::cout << SampleNamespace::powerOfTwo(val_d) << std::endl; int val_i = 7; - cout << "SampleNamespace::powerOfTwo(" << val_i << "): "; - cout << SampleNamespace::powerOfTwo(val_i) << endl; - cout << endl; + std::cout << "SampleNamespace::powerOfTwo(" << val_i << "): "; + std::cout << SampleNamespace::powerOfTwo(val_i) << std::endl; + std::cout << std::endl; - cout << "-----------------------------------------" << endl; - cout << "Point" << endl; + std::cout << "-----------------------------------------" << std::endl; + std::cout << "Point" << std::endl; Point p1(1.1, 2.2); - cout << "p1: "; + std::cout << "p1: "; p1.show(); - cout << endl; + std::cout << std::endl; Point p2(3.4, 5.6); - cout << "p2: "; + std::cout << "p2: "; p2.show(); - cout << endl; + std::cout << std::endl; - cout << "p1 + p2 == "; + std::cout << "p1 + p2 == "; (p1 + p2).show(); - cout << endl; + std::cout << std::endl; - cout << "p1 * 2.0 == "; + std::cout << "p1 * 2.0 == "; (p1 * 2.0).show(); - cout << endl; + std::cout << std::endl; - cout << "1.5 * p2 == "; + std::cout << "1.5 * p2 == "; (1.5 * p2).show(); - cout << endl; + std::cout << std::endl; - cout << "p1: "; + std::cout << "p1: "; p1.show(); - cout << endl << "p2: "; + std::cout << std::endl << "p2: "; p2.show(); - cout << endl << "p1 += p2" << endl; + std::cout << std::endl << "p1 += p2" << std::endl; p1 += p2; - cout << "p1: "; + std::cout << "p1: "; p1.show(); - cout << endl; + std::cout << std::endl; - cout << "p1 == p2 ? " << ((p1 == p2) ? "true" : "false") << endl; - cout << "p1 == p1 ? " << ((p1 == p1) ? "true" : "false") << endl; - cout << "p2 == p2 ? " << ((p2 == p2) ? "true" : "false") << endl; + std::cout << "p1 == p2 ? " << ((p1 == p2) ? "true" : "false") << std::endl; + std::cout << "p1 == p1 ? " << ((p1 == p1) ? "true" : "false") << std::endl; + std::cout << "p2 == p2 ? " << ((p2 == p2) ? "true" : "false") << std::endl; - cout << "-----------------------------------------" << endl; - cout << "Size" << endl; + std::cout << "-----------------------------------------" << std::endl; + std::cout << "Size" << std::endl; Size s1(2, 2); - cout << "s1: "; + std::cout << "s1: "; s1.show(); - cout << ", area: " << s1.calculateArea(); - cout << endl; + std::cout << ", area: " << s1.calculateArea(); + std::cout << std::endl; Size s2(3, 5); - cout << "s2: "; + std::cout << "s2: "; s2.show(); - cout << ", area: " << s2.calculateArea(); - cout << endl; - - cout << endl; - - cout << "s1 == s2 ? " << ((s1 == s2) ? "true" : "false") << endl; - cout << "s1 != s2 ? " << ((s1 != s2) ? "true" : "false") << endl; - - cout << "s1 < s2 ? " << ((s1 < s2) ? "true" : "false") << endl; - cout << "s1 <= s2 ? " << ((s1 <= s2) ? "true" : "false") << endl; - cout << "s1 > s2 ? " << ((s1 > s2) ? "true" : "false") << endl; - cout << "s1 >= s2 ? " << ((s1 >= s2) ? "true" : "false") << endl; - - cout << "s1 < 10 ? " << ((s1 < 10) ? "true" : "false") << endl; - cout << "s1 <= 10 ? " << ((s1 <= 10) ? "true" : "false") << endl; - cout << "s1 > 10 ? " << ((s1 > 10) ? "true" : "false") << endl; - cout << "s1 >= 10 ? " << ((s1 >= 10) ? "true" : "false") << endl; - cout << "s2 < 10 ? " << ((s2 < 10) ? "true" : "false") << endl; - cout << "s2 <= 10 ? " << ((s2 <= 10) ? "true" : "false") << endl; - cout << "s2 > 10 ? " << ((s2 > 10) ? "true" : "false") << endl; - cout << "s2 >= 10 ? " << ((s2 >= 10) ? "true" : "false") << endl; - cout << endl; - - cout << "s1: "; + std::cout << ", area: " << s2.calculateArea(); + std::cout << std::endl; + + std::cout << std::endl; + + std::cout << "s1 == s2 ? " << ((s1 == s2) ? "true" : "false") << std::endl; + std::cout << "s1 != s2 ? " << ((s1 != s2) ? "true" : "false") << std::endl; + + std::cout << "s1 < s2 ? " << ((s1 < s2) ? "true" : "false") << std::endl; + std::cout << "s1 <= s2 ? " << ((s1 <= s2) ? "true" : "false") << std::endl; + std::cout << "s1 > s2 ? " << ((s1 > s2) ? "true" : "false") << std::endl; + std::cout << "s1 >= s2 ? " << ((s1 >= s2) ? "true" : "false") << std::endl; + + std::cout << "s1 < 10 ? " << ((s1 < 10) ? "true" : "false") << std::endl; + std::cout << "s1 <= 10 ? " << ((s1 <= 10) ? "true" : "false") << std::endl; + std::cout << "s1 > 10 ? " << ((s1 > 10) ? "true" : "false") << std::endl; + std::cout << "s1 >= 10 ? " << ((s1 >= 10) ? "true" : "false") << std::endl; + std::cout << "s2 < 10 ? " << ((s2 < 10) ? "true" : "false") << std::endl; + std::cout << "s2 <= 10 ? " << ((s2 <= 10) ? "true" : "false") << std::endl; + std::cout << "s2 > 10 ? " << ((s2 > 10) ? "true" : "false") << std::endl; + std::cout << "s2 >= 10 ? " << ((s2 >= 10) ? "true" : "false") << std::endl; + std::cout << std::endl; + + std::cout << "s1: "; s1.show(); - cout << endl << "s2: "; + std::cout << std::endl << "s2: "; s2.show(); - cout << endl << "s1 += s2" << endl; + std::cout << std::endl << "s1 += s2" << std::endl; s1 += s2; - cout << "s1: "; + std::cout << "s1: "; s1.show(); - cout << endl; + std::cout << std::endl; - cout << endl; + std::cout << std::endl; - cout << "s1: "; + std::cout << "s1: "; s1.show(); - cout << endl << "s1 *= 2.0" << endl; + std::cout << std::endl << "s1 *= 2.0" << std::endl; s1 *= 2.0; - cout << "s1: "; + std::cout << "s1: "; s1.show(); - cout << endl; + std::cout << std::endl; - cout << endl; + std::cout << std::endl; return 0; } diff --git a/sources/shiboken6/tests/libsample/mapuser.cpp b/sources/shiboken6/tests/libsample/mapuser.cpp index 032d465d8..56b5f6652 100644 --- a/sources/shiboken6/tests/libsample/mapuser.cpp +++ b/sources/shiboken6/tests/libsample/mapuser.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "mapuser.h" -using namespace std; - std::map<std::string, std::pair<Complex, int> > MapUser::callCreateMap() { @@ -36,9 +34,9 @@ MapUser::createMap() void MapUser::showMap(std::map<std::string, int> mapping) { - cout << __FUNCTION__ << endl; + std::cout << __FUNCTION__ << std::endl; for (auto it = mapping.begin(), end = mapping.end(); it != end; ++it) - cout << (*it).first << " => " << (*it).second << endl; + std::cout << (*it).first << " => " << (*it).second << std::endl; } void MapUser::pointerToMap(std::map<std::string, std::string> *) diff --git a/sources/shiboken6/tests/libsample/modifications.cpp b/sources/shiboken6/tests/libsample/modifications.cpp index 8b1ba07dc..c200baa17 100644 --- a/sources/shiboken6/tests/libsample/modifications.cpp +++ b/sources/shiboken6/tests/libsample/modifications.cpp @@ -5,8 +5,6 @@ #include "modifications.h" #include "objecttype.h" -using namespace std; - Modifications::Modifications() { m_object = new ObjectType(); @@ -127,7 +125,7 @@ Modifications::increment(int number) void Modifications::exclusiveCppStuff() { - cout << __FUNCTION__ << endl; + std::cout << __FUNCTION__ << std::endl; } int diff --git a/sources/shiboken6/tests/libsample/objecttype.cpp b/sources/shiboken6/tests/libsample/objecttype.cpp index 1e3920734..5a85dbfda 100644 --- a/sources/shiboken6/tests/libsample/objecttype.cpp +++ b/sources/shiboken6/tests/libsample/objecttype.cpp @@ -10,8 +10,6 @@ #include <algorithm> -using namespace std; - ObjectType::ObjectType(ObjectType* parent) : m_parent(nullptr), m_layout(nullptr), m_call_id(-1) { setParent(parent); @@ -161,14 +159,16 @@ void ObjectType::setLayout(ObjectTypeLayout* l) { if (!l) { - cerr << "[WARNING] ObjectType::setLayout: Cannot set layout to 0." << endl; + std::cerr << "[WARNING] ObjectType::setLayout: Cannot set layout to 0.\n"; return; } if (layout()) { if (layout() != l) { - cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '" << l->objectName().cstring(); - cerr << "' on ObjectType '" << objectName().cstring() << "', which already has a layout." << endl; + std::cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '" + << l->objectName().cstring() + << "' on ObjectType '" << objectName().cstring() + << "', which already has a layout.\n"; } return; } @@ -176,8 +176,10 @@ ObjectType::setLayout(ObjectTypeLayout* l) ObjectType* oldParent = l->parent(); if (oldParent && oldParent != this) { if (oldParent->isLayoutType()) { - cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '" << l->objectName().cstring(); - cerr << "' on ObjectType '" << objectName().cstring() << "', when the ObjectTypeLayout already has a parent layout." << endl; + std::cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '" + << l->objectName().cstring() + << "' on ObjectType '" << objectName().cstring() + << "', when the ObjectTypeLayout already has a parent layout.\n"; return; } else { // Steal the layout from an ObjectType parent. diff --git a/sources/shiboken6/tests/libsample/objecttypelayout.cpp b/sources/shiboken6/tests/libsample/objecttypelayout.cpp index 2fbd20ccf..bb826df4e 100644 --- a/sources/shiboken6/tests/libsample/objecttypelayout.cpp +++ b/sources/shiboken6/tests/libsample/objecttypelayout.cpp @@ -4,15 +4,13 @@ #include "objecttypelayout.h" #include <iostream> -using namespace std; - void ObjectTypeLayout::addObject(ObjectType* obj) { if (obj->isLayoutType()) { ObjectTypeLayout* l = reinterpret_cast<ObjectTypeLayout*>(obj); if (l->parent()) { - cerr << "[WARNING] ObjectTypeLayout::addObject: layout '" << l->objectName().cstring(); - cerr << "' already has a parent." << endl; + std::cerr << "[WARNING] ObjectTypeLayout::addObject: layout '" + << l->objectName().cstring() << "' already has a parent.\n"; return; } diff --git a/sources/shiboken6/tests/libsample/pairuser.cpp b/sources/shiboken6/tests/libsample/pairuser.cpp index f1f182c5a..9d0b9864f 100644 --- a/sources/shiboken6/tests/libsample/pairuser.cpp +++ b/sources/shiboken6/tests/libsample/pairuser.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "pairuser.h" -using namespace std; - std::pair<int, int> PairUser::callCreatePair() { diff --git a/sources/shiboken6/tests/libsample/point.cpp b/sources/shiboken6/tests/libsample/point.cpp index 397dea3e6..cb15107c4 100644 --- a/sources/shiboken6/tests/libsample/point.cpp +++ b/sources/shiboken6/tests/libsample/point.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "point.h" -using namespace std; - Point::Point(int x, int y) : m_x(x), m_y(y) { } @@ -35,7 +33,7 @@ Point::copy() const void Point::show() { - cout << "(x: " << m_x << ", y: " << m_y << ")"; + std::cout << "(x: " << m_x << ", y: " << m_y << ")"; } bool diff --git a/sources/shiboken6/tests/libsample/pointf.cpp b/sources/shiboken6/tests/libsample/pointf.cpp index f68dd0f41..107325aa3 100644 --- a/sources/shiboken6/tests/libsample/pointf.cpp +++ b/sources/shiboken6/tests/libsample/pointf.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "pointf.h" -using namespace std; - PointF::PointF(const Point& point) : m_x(point.x()), m_y(point.y()) { } @@ -26,7 +24,7 @@ PointF::midpoint(const PointF& other, PointF* midpoint) const void PointF::show() { - cout << "(x: " << m_x << ", y: " << m_y << ")"; + std::cout << "(x: " << m_x << ", y: " << m_y << ")"; } bool diff --git a/sources/shiboken6/tests/libsample/polygon.cpp b/sources/shiboken6/tests/libsample/polygon.cpp index 617ac4f9f..a13a3ef5c 100644 --- a/sources/shiboken6/tests/libsample/polygon.cpp +++ b/sources/shiboken6/tests/libsample/polygon.cpp @@ -4,8 +4,6 @@ #include <iostream> #include "polygon.h" -using namespace std; - Polygon::Polygon(double x, double y) { m_points.push_back(Point(x, y)); diff --git a/sources/shiboken6/tests/libsample/reference.cpp b/sources/shiboken6/tests/libsample/reference.cpp index 25db84bfd..8e8152905 100644 --- a/sources/shiboken6/tests/libsample/reference.cpp +++ b/sources/shiboken6/tests/libsample/reference.cpp @@ -4,12 +4,10 @@ #include <iostream> #include "reference.h" -using namespace std; - void Reference::show() const { - cout << "Reference.objId: " << m_objId << ", address: " << this; + std::cout << "Reference.objId: " << m_objId << ", address: " << this; } Reference &Reference::returnMySecondArg(int, Reference &ref) diff --git a/sources/shiboken6/tests/libsample/samplenamespace.cpp b/sources/shiboken6/tests/libsample/samplenamespace.cpp index 8d1fa888f..265dcea52 100644 --- a/sources/shiboken6/tests/libsample/samplenamespace.cpp +++ b/sources/shiboken6/tests/libsample/samplenamespace.cpp @@ -6,8 +6,6 @@ #include <time.h> #include "samplenamespace.h" -using namespace std; - namespace SampleNamespace { diff --git a/sources/shiboken6/tests/libsample/size.cpp b/sources/shiboken6/tests/libsample/size.cpp index 5edb8a77b..e8e5ce85f 100644 --- a/sources/shiboken6/tests/libsample/size.cpp +++ b/sources/shiboken6/tests/libsample/size.cpp @@ -4,11 +4,9 @@ #include <iostream> #include "size.h" -using namespace std; - void Size::show() const { - cout << "(width: " << m_width << ", height: " << m_height << ")"; + std::cout << "(width: " << m_width << ", height: " << m_height << ")"; } diff --git a/sources/shiboken6/tests/libsample/str.cpp b/sources/shiboken6/tests/libsample/str.cpp index dd7909bef..773718c35 100644 --- a/sources/shiboken6/tests/libsample/str.cpp +++ b/sources/shiboken6/tests/libsample/str.cpp @@ -7,8 +7,6 @@ #include <cstring> #include <sstream> -using namespace std; - Str::Str(char c) { char str[2] = { c, 0 }; @@ -65,7 +63,7 @@ Str::toInt(bool* ok, int base) const { bool my_ok; int result = 0; - istringstream conv(m_str); + std::istringstream conv(m_str); switch (base) { case 8: conv >> std::oct >> result; @@ -77,7 +75,7 @@ Str::toInt(bool* ok, int base) const conv >> std::hex >> result; break; } - my_ok = istringstream::eofbit & conv.rdstate(); + my_ok = std::istringstream::eofbit & conv.rdstate(); if (!my_ok) result = 0; if (ok) @@ -106,7 +104,7 @@ Str::set_char(int pos, char ch) Str Str::operator+(int number) const { - ostringstream in; + std::ostringstream in; in << m_str << number; return in.str().c_str(); } @@ -118,7 +116,7 @@ bool Str::operator==(const Str& other) const Str operator+(int number, const Str& str) { - ostringstream in; + std::ostringstream in; in << number << str.m_str; return in.str().c_str(); } diff --git a/sources/shiboken6/tests/libsample/transform.cpp b/sources/shiboken6/tests/libsample/transform.cpp index d23cb6179..33fbff9d7 100644 --- a/sources/shiboken6/tests/libsample/transform.cpp +++ b/sources/shiboken6/tests/libsample/transform.cpp @@ -4,15 +4,7 @@ #include "transform.h" -#ifdef _WIN32 -#include <math.h> -#include <float.h> -static inline bool isfinite(double a) { return _finite(a); } -#else #include <cmath> -#endif - -using namespace std; Point applyHomogeneousTransform( const Point& in, @@ -25,14 +17,11 @@ Point applyHomogeneousTransform( double y = m21 * in.x() + m22 * in.y() + m23; double w = m31 * in.x() + m32 * in.y() + m33; - if (isfinite(w) && fabs(w) > 1e-10) - { + if (std::isfinite(w) && fabs(w) > 1e-10) { if (okay) *okay = true; return Point(x / w, y / w); - } - else - { + } else { if (okay) *okay = false; return Point(); |