From: Joel Holdsworth Date: Mon, 30 Dec 2013 15:05:37 +0000 (+0100) Subject: Replaced using namespace with using class directives X-Git-Tag: pulseview-0.2.0~172 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=819f4c25391a9c74d3d2f528d462142d5c4aad4d;p=pulseview.git Replaced using namespace with using class directives This will fix ambiguity issues caused by the arrival of C++11 --- diff --git a/pv/data/analog.cpp b/pv/data/analog.cpp index dd4097a8..21ddb5fb 100644 --- a/pv/data/analog.cpp +++ b/pv/data/analog.cpp @@ -23,8 +23,9 @@ #include "analog.h" #include "analogsnapshot.h" -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::deque; +using std::max; namespace pv { namespace data { diff --git a/pv/data/analogsnapshot.cpp b/pv/data/analogsnapshot.cpp index bec65065..36fad7f7 100644 --- a/pv/data/analogsnapshot.cpp +++ b/pv/data/analogsnapshot.cpp @@ -31,8 +31,12 @@ #include "analogsnapshot.h" -using namespace boost; -using namespace std; +using boost::lock_guard; +using boost::recursive_mutex; +using std::max; +using std::max_element; +using std::min; +using std::min_element; namespace pv { namespace data { diff --git a/pv/data/decode/annotation.cpp b/pv/data/decode/annotation.cpp index b8061cab..b0517ae6 100644 --- a/pv/data/decode/annotation.cpp +++ b/pv/data/decode/annotation.cpp @@ -26,8 +26,6 @@ extern "C" { #include "annotation.h" -using namespace std; - namespace pv { namespace data { namespace decode { diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 05adf250..592a746c 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -24,8 +24,9 @@ #include -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::map; +using std::string; namespace pv { namespace data { diff --git a/pv/data/decoderstack.cpp b/pv/data/decoderstack.cpp index c2ae9116..5b58761f 100644 --- a/pv/data/decoderstack.cpp +++ b/pv/data/decoderstack.cpp @@ -35,8 +35,13 @@ #include #include -using namespace boost; -using namespace std; +using boost::lock_guard; +using boost::mutex; +using boost::shared_ptr; +using std::deque; +using std::min; +using std::list; +using std::vector; namespace pv { namespace data { @@ -202,7 +207,8 @@ void DecoderStack::decode_proc(shared_ptr data) srd_session_start(session); for (int64_t i = 0; - !this_thread::interruption_requested() && i < sample_count; + !boost::this_thread::interruption_requested() && + i < sample_count; i += DecodeChunkLength) { lock_guard decode_lock(_global_decode_mutex); diff --git a/pv/data/logic.cpp b/pv/data/logic.cpp index d13cd766..167c79bd 100644 --- a/pv/data/logic.cpp +++ b/pv/data/logic.cpp @@ -23,8 +23,9 @@ #include "logic.h" #include "logicsnapshot.h" -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::deque; +using std::max; namespace pv { namespace data { diff --git a/pv/data/logicsnapshot.cpp b/pv/data/logicsnapshot.cpp index d32274b3..f2fa81bc 100644 --- a/pv/data/logicsnapshot.cpp +++ b/pv/data/logicsnapshot.cpp @@ -29,8 +29,11 @@ #include "logicsnapshot.h" -using namespace boost; -using namespace std; +using boost::lock_guard; +using boost::recursive_mutex; +using std::max; +using std::min; +using std::pair; namespace pv { namespace data { diff --git a/pv/data/snapshot.cpp b/pv/data/snapshot.cpp index 60238841..85f54e78 100644 --- a/pv/data/snapshot.cpp +++ b/pv/data/snapshot.cpp @@ -24,7 +24,8 @@ #include #include -using namespace boost; +using boost::lock_guard; +using boost::recursive_mutex; namespace pv { namespace data { diff --git a/pv/devicemanager.cpp b/pv/devicemanager.cpp index 0765cac6..14ad16ef 100644 --- a/pv/devicemanager.cpp +++ b/pv/devicemanager.cpp @@ -28,7 +28,11 @@ #include -using namespace std; +using std::list; +using std::map; +using std::ostringstream; +using std::runtime_error; +using std::string; namespace pv { diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index b7efe4f3..52530beb 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -31,7 +31,8 @@ extern "C" { #include } -using namespace std; +using std::list; +using std::string; extern sr_context *sr_ctx; diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 2e0fa0ff..317f3c9a 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -56,8 +56,7 @@ #include #include -using namespace boost; -using namespace std; +using std::list; namespace pv { diff --git a/pv/popups/deviceoptions.cpp b/pv/popups/deviceoptions.cpp index ac7c2b78..30d5f579 100644 --- a/pv/popups/deviceoptions.cpp +++ b/pv/popups/deviceoptions.cpp @@ -27,9 +27,6 @@ #include -using namespace boost; -using namespace std; - namespace pv { namespace popups { diff --git a/pv/popups/probes.cpp b/pv/popups/probes.cpp index 51ba3ddc..60f1e027 100644 --- a/pv/popups/probes.cpp +++ b/pv/popups/probes.cpp @@ -23,9 +23,9 @@ #include #include -using namespace boost; using namespace Qt; -using namespace std; +using boost::shared_ptr; +using std::vector; namespace pv { namespace popups { diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index afdd7030..90e5214e 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -26,7 +26,7 @@ #include "binding.h" -using namespace boost; +using boost::shared_ptr; namespace pv { namespace prop { diff --git a/pv/prop/binding/decoderoptions.cpp b/pv/prop/binding/decoderoptions.cpp index 361d85b2..e2943676 100644 --- a/pv/prop/binding/decoderoptions.cpp +++ b/pv/prop/binding/decoderoptions.cpp @@ -31,8 +31,11 @@ #include #include -using namespace boost; -using namespace std; +using boost::bind; +using boost::none; +using boost::shared_ptr; +using std::map; +using std::string; namespace pv { namespace prop { diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp index ff7be104..35541fbf 100644 --- a/pv/prop/binding/deviceoptions.cpp +++ b/pv/prop/binding/deviceoptions.cpp @@ -32,8 +32,14 @@ #include #include -using namespace boost; -using namespace std; +using boost::bind; +using boost::function; +using boost::optional; +using boost::shared_ptr; +using std::make_pair; +using std::pair; +using std::string; +using std::vector; namespace pv { namespace prop { diff --git a/pv/prop/bool.cpp b/pv/prop/bool.cpp index 179208a5..ac142fd4 100644 --- a/pv/prop/bool.cpp +++ b/pv/prop/bool.cpp @@ -24,9 +24,6 @@ #include "bool.h" -using namespace std; -using namespace boost; - namespace pv { namespace prop { diff --git a/pv/prop/double.cpp b/pv/prop/double.cpp index 188286ae..fa5e5688 100644 --- a/pv/prop/double.cpp +++ b/pv/prop/double.cpp @@ -24,8 +24,8 @@ #include "double.h" -using namespace std; -using namespace boost; +using boost::optional; +using std::pair; namespace pv { namespace prop { diff --git a/pv/prop/enum.cpp b/pv/prop/enum.cpp index 412a31b0..d4a04cbb 100644 --- a/pv/prop/enum.cpp +++ b/pv/prop/enum.cpp @@ -24,8 +24,8 @@ #include "enum.h" -using namespace boost; -using namespace std; +using std::pair; +using std::vector; namespace pv { namespace prop { diff --git a/pv/prop/int.cpp b/pv/prop/int.cpp index faa3171d..42775248 100644 --- a/pv/prop/int.cpp +++ b/pv/prop/int.cpp @@ -25,8 +25,10 @@ #include "int.h" -using namespace std; -using namespace boost; +using boost::optional; +using std::max; +using std::min; +using std::pair; namespace pv { namespace prop { diff --git a/pv/prop/string.cpp b/pv/prop/string.cpp index 4921129e..37efc148 100644 --- a/pv/prop/string.cpp +++ b/pv/prop/string.cpp @@ -25,9 +25,6 @@ #include "string.h" -using namespace std; -using namespace boost; - namespace pv { namespace prop { diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 6c9b57f8..719f9ded 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -47,8 +47,14 @@ #include -using namespace boost; -using namespace std; +using boost::dynamic_pointer_cast; +using boost::function; +using boost::lock_guard; +using boost::mutex; +using boost::shared_ptr; +using std::map; +using std::string; +using std::vector; namespace pv { diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 3bd2cb39..ca0450b4 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -34,7 +34,7 @@ #include #include -using namespace std; +using std::string; namespace pv { namespace toolbars { @@ -303,7 +303,7 @@ void SamplingBar::commit_sample_rate() void SamplingBar::on_device_selected() { - using namespace pv::popups; + using pv::popups::DeviceOptions; if (_updating_device_selector) return; diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 64633717..eb828a1b 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -27,8 +27,10 @@ #include "pv/data/analogsnapshot.h" #include "pv/view/view.h" -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::max; +using std::min; +using std::deque; namespace pv { namespace view { @@ -151,7 +153,6 @@ void AnalogSignal::paint_envelope(QPainter &p, int y, int left, const int64_t start, const int64_t end, const double pixels_offset, const double samples_per_pixel) { - using namespace Qt; using pv::data::AnalogSnapshot; AnalogSnapshot::EnvelopeSection e; @@ -160,7 +161,7 @@ void AnalogSignal::paint_envelope(QPainter &p, if (e.length < 2) return; - p.setPen(QPen(NoPen)); + p.setPen(QPen(Qt::NoPen)); p.setBrush(_colour); QRectF *const rects = new QRectF[e.length]; diff --git a/pv/view/cursor.cpp b/pv/view/cursor.cpp index 1b30518e..ca22eefd 100644 --- a/pv/view/cursor.cpp +++ b/pv/view/cursor.cpp @@ -33,7 +33,7 @@ #include -using namespace boost; +using boost::shared_ptr; namespace pv { namespace view { diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 83e6f733..ed8829d2 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -25,8 +25,11 @@ #include -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::max; +using std::make_pair; +using std::min; +using std::pair; namespace pv { namespace view { diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index cf5cd2ee..37beed98 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -47,8 +47,13 @@ extern "C" { #include #include -using namespace boost; -using namespace std; +using boost::dynamic_pointer_cast; +using boost::shared_ptr; +using std::list; +using std::max; +using std::map; +using std::min; +using std::vector; namespace pv { namespace view { diff --git a/pv/view/header.cpp b/pv/view/header.cpp index ca5df96f..af67abdd 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -36,8 +36,11 @@ #include -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::max; +using std::make_pair; +using std::pair; +using std::vector; namespace pv { namespace view { diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index ae4f11e2..e240ebad 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -33,8 +33,12 @@ #include "pv/data/logicsnapshot.h" #include "pv/view/view.h" -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::deque; +using std::max; +using std::min; +using std::pair; +using std::vector; namespace pv { namespace view { diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 8d7569e3..aec3de97 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -37,8 +37,8 @@ #include -using namespace boost; -using namespace std; +using namespace Qt; +using boost::shared_ptr; namespace pv { namespace view { @@ -92,7 +92,6 @@ QSize Ruler::sizeHint() const void Ruler::paintEvent(QPaintEvent*) { - using namespace Qt; const double SpacingIncrement = 32.0f; const double MinValueSpacing = 32.0f; diff --git a/pv/view/timemarker.cpp b/pv/view/timemarker.cpp index 2dabaa0e..a5d280bd 100644 --- a/pv/view/timemarker.cpp +++ b/pv/view/timemarker.cpp @@ -27,8 +27,6 @@ #include -using namespace std; - namespace pv { namespace view { diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 18ce679d..438f72dd 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -45,8 +45,14 @@ #include "pv/data/logic.h" #include "pv/data/logicsnapshot.h" -using namespace boost; -using namespace std; +using boost::shared_ptr; +using boost::weak_ptr; +using std::deque; +using std::list; +using std::max; +using std::min; +using std::set; +using std::vector; namespace pv { namespace view { diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 145f040f..e9a14422 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -28,8 +28,10 @@ #include -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::max; +using std::min; +using std::vector; namespace pv { namespace view { diff --git a/pv/widgets/popup.cpp b/pv/widgets/popup.cpp index 73ac1d84..6857358a 100644 --- a/pv/widgets/popup.cpp +++ b/pv/widgets/popup.cpp @@ -26,7 +26,8 @@ #include "popup.h" -using namespace std; +using std::max; +using std::min; namespace pv { namespace widgets { diff --git a/test/data/analogsnapshot.cpp b/test/data/analogsnapshot.cpp index cd1fd773..4f32ebca 100644 --- a/test/data/analogsnapshot.cpp +++ b/test/data/analogsnapshot.cpp @@ -27,8 +27,6 @@ #include "../../pv/data/analogsnapshot.h" -using namespace std; - using pv::data::AnalogSnapshot; BOOST_AUTO_TEST_SUITE(AnalogSnapshotTest) diff --git a/test/data/decoderstack.cpp b/test/data/decoderstack.cpp index 84a496f1..d6e4f75a 100644 --- a/test/data/decoderstack.cpp +++ b/test/data/decoderstack.cpp @@ -28,15 +28,16 @@ #include "../../pv/sigsession.h" #include "../../pv/view/decodetrace.h" -using namespace boost; -using namespace std; +using boost::shared_ptr; +using pv::data::DecoderStack; +using pv::data::decode::Decoder; +using pv::view::DecodeTrace; +using std::vector; BOOST_AUTO_TEST_SUITE(DecoderStackTest) BOOST_AUTO_TEST_CASE(TwoDecoderStack) { - using namespace pv; - sr_context *ctx = NULL; BOOST_REQUIRE(sr_init(&ctx) == SR_OK); @@ -59,13 +60,13 @@ BOOST_AUTO_TEST_CASE(TwoDecoderStack) ss.add_decoder(dec); // Check the signals were created - const vector< shared_ptr > sigs = + const vector< shared_ptr > sigs = ss.get_decode_signals(); - shared_ptr dec0 = sigs[0]->decoder(); + shared_ptr dec0 = sigs[0]->decoder(); BOOST_REQUIRE(dec0); - shared_ptr dec1 = sigs[0]->decoder(); + shared_ptr dec1 = sigs[0]->decoder(); BOOST_REQUIRE(dec1); // Wait for the decode threads to complete diff --git a/test/data/logicsnapshot.cpp b/test/data/logicsnapshot.cpp index bbc74383..8be915f0 100644 --- a/test/data/logicsnapshot.cpp +++ b/test/data/logicsnapshot.cpp @@ -27,9 +27,8 @@ #include "../../pv/data/logicsnapshot.h" -using namespace std; - using pv::data::LogicSnapshot; +using std::vector; BOOST_AUTO_TEST_SUITE(LogicSnapshotTest)