]> sigrok.org Git - pulseview.git/commitdiff
Don't use std:: in the code directly (where possible).
authorUwe Hermann <redacted>
Wed, 15 Mar 2017 22:16:05 +0000 (23:16 +0100)
committerUwe Hermann <redacted>
Sat, 18 Mar 2017 19:00:51 +0000 (20:00 +0100)
Use "using std::foo" to make the actual code itself a lot more readable.

There are some exceptions where we usually cannot do this, e.g. std::thread
often conflicts with "thread" from Qt or Boost.

103 files changed:
android/assetreader.cpp
android/assetreader.hpp
main.cpp
pv/application.cpp
pv/binding/binding.cpp
pv/binding/binding.hpp
pv/binding/decoder.hpp
pv/binding/device.cpp
pv/binding/device.hpp
pv/binding/inputoutput.hpp
pv/data/analog.cpp
pv/data/analog.hpp
pv/data/analogsegment.cpp
pv/data/analogsegment.hpp
pv/data/decode/annotation.cpp
pv/data/decode/annotation.hpp
pv/data/decode/decoder.cpp
pv/data/decode/decoder.hpp
pv/data/decode/rowdata.hpp
pv/data/decoderstack.cpp
pv/data/decoderstack.hpp
pv/data/logic.cpp
pv/data/logic.hpp
pv/data/logicsegment.cpp
pv/data/logicsegment.hpp
pv/data/segment.cpp
pv/data/segment.hpp
pv/data/signalbase.cpp
pv/data/signalbase.hpp
pv/data/signaldata.hpp
pv/devicemanager.cpp
pv/devicemanager.hpp
pv/devices/device.cpp
pv/devices/device.hpp
pv/devices/file.cpp
pv/devices/file.hpp
pv/devices/hardwaredevice.cpp
pv/devices/hardwaredevice.hpp
pv/devices/inputfile.cpp
pv/devices/inputfile.hpp
pv/devices/sessionfile.cpp
pv/devices/sessionfile.hpp
pv/dialogs/connect.hpp
pv/dialogs/inputoutputoptions.hpp
pv/dialogs/settings.cpp
pv/dialogs/storeprogress.cpp
pv/dialogs/storeprogress.hpp
pv/globalsettings.cpp
pv/globalsettings.hpp
pv/mainwindow.cpp
pv/mainwindow.hpp
pv/popups/channels.hpp
pv/popups/deviceoptions.hpp
pv/prop/double.hpp
pv/prop/enum.hpp
pv/prop/int.hpp
pv/prop/property.hpp
pv/session.cpp
pv/session.hpp
pv/storesession.cpp
pv/storesession.hpp
pv/toolbars/mainbar.cpp
pv/toolbars/mainbar.hpp
pv/util.cpp
pv/view/analogsignal.cpp
pv/view/analogsignal.hpp
pv/view/cursor.hpp
pv/view/cursorpair.hpp
pv/view/decodetrace.cpp
pv/view/decodetrace.hpp
pv/view/flag.cpp
pv/view/flag.hpp
pv/view/header.cpp
pv/view/header.hpp
pv/view/logicsignal.cpp
pv/view/logicsignal.hpp
pv/view/marginwidget.hpp
pv/view/ruler.cpp
pv/view/ruler.hpp
pv/view/signal.cpp
pv/view/signal.hpp
pv/view/trace.cpp
pv/view/trace.hpp
pv/view/tracegroup.cpp
pv/view/tracegroup.hpp
pv/view/tracetreeitem.hpp
pv/view/tracetreeitemowner.cpp
pv/view/tracetreeitemowner.hpp
pv/view/view.cpp
pv/view/view.hpp
pv/view/viewitemiterator.hpp
pv/view/viewitemowner.hpp
pv/view/viewport.cpp
pv/view/viewport.hpp
pv/view/viewwidget.hpp
pv/views/viewbase.hpp
pv/widgets/devicetoolbutton.hpp
pv/widgets/exportmenu.cpp
pv/widgets/exportmenu.hpp
pv/widgets/importmenu.hpp
test/test.cpp
test/test.hpp
test/util.cpp

index f14e7b65117933b5a153c0cf704e2af5dad191fb..d0af1678ed137ebf5c0303ff8c36e177ea279320 100644 (file)
 
 using namespace pv;
 
+using std::string;
+using std::unique_ptr;
+
 AndroidAssetReader::~AndroidAssetReader()
 {}
 
-void AndroidAssetReader::open(struct sr_resource *res, std::string name)
+void AndroidAssetReader::open(struct sr_resource *res, string name)
 {
        if (res->type == SR_RESOURCE_FIRMWARE) {
                auto path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
@@ -37,7 +40,7 @@ void AndroidAssetReader::open(struct sr_resource *res, std::string name)
                if (path.isEmpty())
                        path = QString::fromStdString("assets:/sigrok-firmware/" + name);
 
-               std::unique_ptr<QFile> file {new QFile{path}};
+               unique_ptr<QFile> file {new QFile{path}};
 
                if (!file->open(QIODevice::ReadOnly))
                        throw sigrok::Error{SR_ERR};
@@ -60,7 +63,7 @@ void AndroidAssetReader::close(struct sr_resource *res)
                qCritical("AndroidAssetReader: Invalid handle");
                throw sigrok::Error{SR_ERR_ARG};
        }
-       const std::unique_ptr<QFile> file {static_cast<QFile*>(res->handle)};
+       const unique_ptr<QFile> file {static_cast<QFile*>(res->handle)};
        res->handle = nullptr;
 
        file->close();
index 74d4999155cbd4807b7c9e3a091c53c26fea6b93..819945c22848610d98d0aa144b22aeedf34ddd21 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
+using std::string;
+
 namespace pv {
 
 class AndroidAssetReader : public sigrok::ResourceReader
@@ -31,7 +33,7 @@ public:
        virtual ~AndroidAssetReader();
 
 private:
-       void open(struct sr_resource *res, std::string name) override;
+       void open(struct sr_resource *res, string name) override;
        void close(struct sr_resource *res) override;
        size_t read(const struct sr_resource *res, void *buf, size_t count) override;
 };
index 0881c184a913d3c704abffca86e50485166e2da9..51e6100295d18efc113d825351ee4390a54eb0ba 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -49,6 +49,10 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 Q_IMPORT_PLUGIN(QSvgPlugin)
 #endif
 
+using std::exception;
+using std::shared_ptr;
+using std::string;
+
 void usage()
 {
        fprintf(stdout,
@@ -69,8 +73,8 @@ void usage()
 int main(int argc, char *argv[])
 {
        int ret = 0;
-       std::shared_ptr<sigrok::Context> context;
-       std::string open_file, open_file_format;
+       shared_ptr<sigrok::Context> context;
+       string open_file, open_file_format;
 
        Application a(argc, argv);
 
@@ -182,7 +186,7 @@ int main(int argc, char *argv[])
                        // Run the application
                        ret = a.exec();
 
-               } catch (std::exception e) {
+               } catch (exception e) {
                        qDebug() << e.what();
                }
 
index 80a22ab9ebb51faefc8124bc36b13df0c1e54ba7..383b5c23d29737c6c14ebb537b4756a57ee83139 100644 (file)
 
 #include <iostream>
 
+using std::cerr;
+using std::endl;
+using std::exception;
+
 Application::Application(int &argc, char* argv[]) :
        QApplication(argc, argv)
 {
@@ -35,8 +39,8 @@ bool Application::notify(QObject *receiver, QEvent *event)
 {
        try {
                return QApplication::notify(receiver, event);
-       } catch (std::exception& e) {
-               std::cerr << "Caught exception: " << e.what() << std::endl;
+       } catch (exception& e) {
+               cerr << "Caught exception: " << e.what() << endl;
                exit(1);
                return false;
        }
index 26cbce48e774f8f7b5a9b4c4d55fea7fb9d67eba..79ce90a3e7eed7b1e6f4548a838e850e80c0edd5 100644 (file)
 #include "binding.hpp"
 
 using std::shared_ptr;
+using std::string;
+using std::vector;
 
 namespace pv {
 namespace binding {
 
-const std::vector< std::shared_ptr<prop::Property> >& Binding::properties()
+const vector< shared_ptr<prop::Property> >& Binding::properties()
 {
        return properties_;
 }
@@ -78,7 +80,7 @@ QString Binding::print_gvariant(Glib::VariantBase gvar)
                s = QString::fromStdString("(null)");
        else if (gvar.is_of_type(Glib::VariantType("s")))
                s = QString::fromStdString(
-                       Glib::VariantBase::cast_dynamic<Glib::Variant<std::string>>(
+                       Glib::VariantBase::cast_dynamic<Glib::Variant<string>>(
                                gvar).get());
        else
                s = QString::fromStdString(gvar.print());
index 35492e30ec435e9930303f974ada51e30bee0fbd..aed8c34ca4f95c5073ea54d1cfd1d43d6376dfc9 100644 (file)
@@ -31,6 +31,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
 #include <QString>
 
+using std::shared_ptr;
+using std::vector;
+
 class QFormLayout;
 class QWidget;
 
@@ -45,7 +48,7 @@ namespace binding {
 class Binding
 {
 public:
-       const std::vector< std::shared_ptr<prop::Property> >& properties();
+       const vector< shared_ptr<prop::Property> >& properties();
 
        void commit();
 
@@ -58,7 +61,7 @@ public:
        static QString print_gvariant(Glib::VariantBase gvar);
 
 protected:
-       std::vector< std::shared_ptr<prop::Property> > properties_;
+       vector< shared_ptr<prop::Property> > properties_;
 };
 
 } // binding
index dce9533252fad4e13c490d7b5f811da5aa091b93..0e93cffee8ddc9b284222f036cb9174b1f7746d7 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <pv/prop/property.hpp>
 
+using std::shared_ptr;
+
 struct srd_decoder_option;
 
 namespace pv {
@@ -40,11 +42,11 @@ namespace binding {
 class Decoder : public Binding
 {
 public:
-       Decoder(std::shared_ptr<pv::data::DecoderStack> decoder_stack,
-               std::shared_ptr<pv::data::decode::Decoder> decoder);
+       Decoder(shared_ptr<pv::data::DecoderStack> decoder_stack,
+               shared_ptr<pv::data::decode::Decoder> decoder);
 
 private:
-       static std::shared_ptr<prop::Property> bind_enum(const QString &name,
+       static shared_ptr<prop::Property> bind_enum(const QString &name,
                const srd_decoder_option *option,
                prop::Property::Getter getter, prop::Property::Setter setter);
 
@@ -53,8 +55,8 @@ private:
        void setter(const char *id, Glib::VariantBase value);
 
 private:
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack_;
-       std::shared_ptr<pv::data::decode::Decoder> decoder_;
+       shared_ptr<pv::data::DecoderStack> decoder_stack_;
+       shared_ptr<pv::data::decode::Decoder> decoder_;
 };
 
 } // binding
index 8ef05f05bcfa20baaf608e9975a6beeadaa666cc..fe08d2b4ab48a8c91e1543ee971ea398ae6eda4e 100644 (file)
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
 using boost::optional;
+
 using std::function;
 using std::make_pair;
 using std::pair;
+using std::set;
 using std::shared_ptr;
 using std::string;
 using std::vector;
@@ -143,7 +145,7 @@ void Device::bind_bool(const QString &name,
 }
 
 void Device::bind_enum(const QString &name,
-       const ConfigKey *key, std::set<const Capability *> capabilities,
+       const ConfigKey *key, set<const Capability *> capabilities,
        Property::Getter getter,
        Property::Setter setter, function<QString (Glib::VariantBase)> printer)
 {
@@ -164,7 +166,7 @@ void Device::bind_enum(const QString &name,
 }
 
 void Device::bind_int(const QString &name, QString suffix,
-       optional< std::pair<int64_t, int64_t> > range,
+       optional< pair<int64_t, int64_t> > range,
        Property::Getter getter, Property::Setter setter)
 {
        assert(configurable_);
index 81c505986c85ac27662dfa7443b13ff5bcceff5f..cd835f2993a4c246ed49b3e6a047eafd95f44eb1 100644 (file)
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
+using std::function;
+using std::pair;
+using std::set;
+using std::shared_ptr;
+
 namespace pv {
 
 namespace binding {
@@ -40,7 +45,7 @@ class Device : public QObject, public Binding
        Q_OBJECT
 
 public:
-       Device(std::shared_ptr<sigrok::Configurable> configurable);
+       Device(shared_ptr<sigrok::Configurable> configurable);
 
 Q_SIGNALS:
        void config_changed();
@@ -50,11 +55,11 @@ private:
                prop::Property::Getter getter, prop::Property::Setter setter);
        void bind_enum(const QString &name,
                const sigrok::ConfigKey *key,
-               std::set<const sigrok::Capability *> capabilities,
+               set<const sigrok::Capability *> capabilities,
                prop::Property::Getter getter, prop::Property::Setter setter,
-               std::function<QString (Glib::VariantBase)> printer = print_gvariant);
+               function<QString (Glib::VariantBase)> printer = print_gvariant);
        void bind_int(const QString &name, QString suffix,
-               boost::optional< std::pair<int64_t, int64_t> > range,
+               boost::optional< pair<int64_t, int64_t> > range,
                prop::Property::Getter getter, prop::Property::Setter setter);
 
        static QString print_timebase(Glib::VariantBase gvar);
@@ -63,7 +68,7 @@ private:
        static QString print_probe_factor(Glib::VariantBase gvar);
 
 protected:
-       std::shared_ptr<sigrok::Configurable> configurable_;
+       shared_ptr<sigrok::Configurable> configurable_;
 };
 
 } // binding
index 7cf535b27450b5955a5223701fa5ce6ab477fdf3..3c64781f2ffa17ecd8f2f8f1979f0696e0b72686 100644 (file)
 
 #include <pv/prop/property.hpp>
 
+using std::map;
+using std::shared_ptr;
+using std::string;
+using std::vector;
+
 namespace sigrok {
 class Option;
 }
@@ -45,15 +50,13 @@ public:
         * Constructs a new @c InputOutput binding.
         * @param options the map of options to use as a template.
         */
-       InputOutput(
-               const std::map<std::string, std::shared_ptr<sigrok::Option>>
-                       &options);
+       InputOutput(const map<string, shared_ptr<sigrok::Option>> &options);
 
        /**
         * Gets the map of selected options.
         * @return the options.
         */
-       const std::map<std::string, Glib::VariantBase>& options() const;
+       const map<string, Glib::VariantBase>& options() const;
 
 private:
        /**
@@ -63,15 +66,15 @@ private:
         * @param getter the getter that will read the values out of the map.
         * @param setter the setter that will set the values into the map.
         */
-       std::shared_ptr<prop::Property> bind_enum(const QString &name,
-               const std::vector<Glib::VariantBase> &values,
+       shared_ptr<prop::Property> bind_enum(const QString &name,
+               const vector<Glib::VariantBase> &values,
                prop::Property::Getter getter, prop::Property::Setter setter);
 
 private:
        /**
         * The current map of options.
         */
-       std::map<std::string, Glib::VariantBase> options_;
+       map<string, Glib::VariantBase> options_;
 };
 
 } // binding
index 1a2449891d9d8b86922c6b6efb6350d8b14db70d..854dae3e68eaaec8d71212219365323abcefbbe8 100644 (file)
@@ -61,7 +61,7 @@ void Analog::clear()
 uint64_t Analog::max_sample_count() const
 {
        uint64_t l = 0;
-       for (const std::shared_ptr<AnalogSegment> s : segments_) {
+       for (const shared_ptr<AnalogSegment> s : segments_) {
                assert(s);
                l = max(l, s->get_sample_count());
        }
index 6fd01e035208b0374bf44dfe59e7e1fc57646619..5b6e5ee8600acf15452f52b40d1f815b9fc04f2d 100644 (file)
 
 #include <QObject>
 
+using std::deque;
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 namespace data {
 
@@ -39,13 +43,11 @@ class Analog : public QObject, public SignalData
 public:
        Analog();
 
-       void push_segment(
-               std::shared_ptr<AnalogSegment> &segment);
+       void push_segment(shared_ptr<AnalogSegment> &segment);
 
-       const std::deque< std::shared_ptr<AnalogSegment> >&
-               analog_segments() const;
+       const deque< shared_ptr<AnalogSegment> >& analog_segments() const;
 
-       std::vector< std::shared_ptr<Segment> > segments() const;
+       vector< shared_ptr<Segment> > segments() const;
 
        void clear();
 
@@ -61,7 +63,7 @@ Q_SIGNALS:
                uint64_t end_sample);
 
 private:
-       std::deque< std::shared_ptr<AnalogSegment> > segments_;
+       deque< shared_ptr<AnalogSegment> > segments_;
 };
 
 } // namespace data
index 7458a074fff8c229650a16279fa785945faef067..6719340c5e9e06eb58698de193c3dfd7927d238c 100644 (file)
 
 using std::lock_guard;
 using std::recursive_mutex;
+using std::make_pair;
 using std::max;
 using std::max_element;
 using std::min;
 using std::min_element;
+using std::pair;
 
 namespace pv {
 namespace data {
@@ -101,9 +103,9 @@ const float* AnalogSegment::get_samples(
        return (float*)get_raw_samples(start_sample, (end_sample - start_sample));
 }
 
-const std::pair<float, float> AnalogSegment::get_min_max() const
+const pair<float, float> AnalogSegment::get_min_max() const
 {
-       return std::make_pair(min_value_, max_value_);
+       return make_pair(min_value_, max_value_);
 }
 
 SegmentAnalogDataIterator* AnalogSegment::begin_sample_iteration(uint64_t start)
index 27c9863b07b0a830806ba7ec5dd122653648a6e2..8dd6f5f189746ec903157c7563892ad2073f1170 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <QObject>
 
+using std::pair;
+
 namespace AnalogSegmentTest {
 struct Basic;
 }
@@ -87,7 +89,7 @@ public:
        const float* get_samples(int64_t start_sample,
                int64_t end_sample) const;
 
-       const std::pair<float, float> get_min_max() const;
+       const pair<float, float> get_min_max() const;
 
        SegmentAnalogDataIterator* begin_sample_iteration(uint64_t start);
        void continue_sample_iteration(SegmentAnalogDataIterator* it, uint64_t increase);
index e47f8f03732ca82929ae6489755f4089f3519665..7c720430e9d6cf7e6a688fd6c138cad2cd90589b 100644 (file)
@@ -26,6 +26,8 @@ extern "C" {
 
 #include "annotation.hpp"
 
+using std::vector;
+
 namespace pv {
 namespace data {
 namespace decode {
@@ -63,7 +65,7 @@ int Annotation::format() const
        return format_;
 }
 
-const std::vector<QString>& Annotation::annotations() const
+const vector<QString>& Annotation::annotations() const
 {
        return annotations_;
 }
index 7e62cea1f6d07cf6c78d9b26ee961599ed15fc19..2be8e88d989e4cddacaa18d9b86156ca875c4e95 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <QString>
 
+using std::vector;
+
 struct srd_proto_data;
 
 namespace pv {
@@ -38,13 +40,13 @@ public:
        uint64_t start_sample() const;
        uint64_t end_sample() const;
        int format() const;
-       const std::vector<QString>& annotations() const;
+       const vector<QString>& annotations() const;
 
 private:
        uint64_t start_sample_;
        uint64_t end_sample_;
        int format_;
-       std::vector<QString> annotations_;
+       vector<QString> annotations_;
 };
 
 } // namespace decode
index 5fae925886155a900394cb64d6861e6e3fb37b82..d3ee3459255ebc1ff3246fcda2d6a61b53859e56 100644 (file)
@@ -68,13 +68,13 @@ Decoder::channels() const
        return channels_;
 }
 
-void Decoder::set_channels(std::map<const srd_channel*,
-       std::shared_ptr<data::SignalBase> > channels)
+void Decoder::set_channels(map<const srd_channel*,
+       shared_ptr<data::SignalBase> > channels)
 {
        channels_ = channels;
 }
 
-const std::map<std::string, GVariant*>& Decoder::options() const
+const map<string, GVariant*>& Decoder::options() const
 {
        return options_;
 }
index 3d3e01d4787df95cbce69d9f1dd5471eaed8cbed..1b323f0b74dc0b7b8de2d1b87605b6f0d39ca851 100644 (file)
 
 #include <glib.h>
 
+using std::map;
+using std::set;
+using std::shared_ptr;
+using std::string;
+
 struct srd_decoder;
 struct srd_decoder_inst;
 struct srd_channel;
@@ -52,12 +57,12 @@ public:
        bool shown() const;
        void show(bool show = true);
 
-       const std::map<const srd_channel*,
-               std::shared_ptr<data::SignalBase> >& channels() const;
-       void set_channels(std::map<const srd_channel*,
-               std::shared_ptr<data::SignalBase> > channels);
+       const map<const srd_channel*,
+               shared_ptr<data::SignalBase> >& channels() const;
+       void set_channels(map<const srd_channel*,
+               shared_ptr<data::SignalBase> > channels);
 
-       const std::map<std::string, GVariant*>& options() const;
+       const map<string, GVariant*>& options() const;
 
        void set_option(const char *id, GVariant *value);
 
@@ -66,16 +71,15 @@ public:
        srd_decoder_inst* create_decoder_inst(
                srd_session *session) const;
 
-       std::set< std::shared_ptr<pv::data::Logic> > get_data();
+       set< shared_ptr<pv::data::Logic> > get_data();
 
 private:
        const srd_decoder *const decoder_;
 
        bool shown_;
 
-       std::map<const srd_channel*, std::shared_ptr<pv::data::SignalBase> >
-               channels_;
-       std::map<std::string, GVariant*> options_;
+       map<const srd_channel*, shared_ptr<pv::data::SignalBase> > channels_;
+       map<string, GVariant*> options_;
 };
 
 } // namespace decode
index b62711117d0c1a0066ad05570ca6ad7623e3073b..21543c5c1141a9e95ecbd9513d90a6145f21d8cf 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "annotation.hpp"
 
+using std::vector;
+
 namespace pv {
 namespace data {
 namespace decode {
@@ -40,13 +42,13 @@ public:
         * Extracts sorted annotations between two period into a vector.
         */
        void get_annotation_subset(
-               std::vector<pv::data::decode::Annotation> &dest,
+               vector<pv::data::decode::Annotation> &dest,
                uint64_t start_sample, uint64_t end_sample) const;
 
        void push_annotation(const Annotation &a);
 
 private:
-       std::vector<Annotation> annotations_;
+       vector<Annotation> annotations_;
 };
 
 }
index 1f158c230b7f55c53630c0eb2e78f5f09ded6ed4..f393a1bb84dc06b7034235a88cb110b5879c96a9 100644 (file)
@@ -34,7 +34,6 @@
 
 using std::lock_guard;
 using std::mutex;
-using boost::optional;
 using std::unique_lock;
 using std::deque;
 using std::make_pair;
@@ -47,6 +46,8 @@ using std::shared_ptr;
 using std::make_shared;
 using std::vector;
 
+using boost::optional;
+
 using namespace pv::data::decode;
 
 namespace pv {
@@ -87,13 +88,12 @@ DecoderStack::~DecoderStack()
        }
 }
 
-const std::list< std::shared_ptr<decode::Decoder> >&
-DecoderStack::stack() const
+const list< shared_ptr<decode::Decoder> >& DecoderStack::stack() const
 {
        return stack_;
 }
 
-void DecoderStack::push(std::shared_ptr<decode::Decoder> decoder)
+void DecoderStack::push(shared_ptr<decode::Decoder> decoder)
 {
        assert(decoder);
        stack_.push_back(decoder);
@@ -129,7 +129,7 @@ int64_t DecoderStack::samples_decoded() const
        return samples_decoded_;
 }
 
-std::vector<Row> DecoderStack::get_visible_rows() const
+vector<Row> DecoderStack::get_visible_rows() const
 {
        lock_guard<mutex> lock(output_mutex_);
 
@@ -160,7 +160,7 @@ std::vector<Row> DecoderStack::get_visible_rows() const
 }
 
 void DecoderStack::get_annotation_subset(
-       std::vector<pv::data::decode::Annotation> &dest,
+       vector<pv::data::decode::Annotation> &dest,
        const Row &row, uint64_t start_sample,
        uint64_t end_sample) const
 {
index 19a060f2bccdaa37360982fe54677ceb7b7a8608..8a9e0e45c9116cee863b8e245044de78923016bf 100644 (file)
 #include <pv/data/decode/rowdata.hpp>
 #include <pv/util.hpp>
 
+using std::atomic;
+using std::condition_variable;
+using std::list;
+using std::map;
+using std::mutex;
+using std::pair;
+using std::shared_ptr;
+using std::vector;
+
 struct srd_decoder;
 struct srd_decoder_annotation_row;
 struct srd_channel;
@@ -82,8 +91,8 @@ public:
 
        virtual ~DecoderStack();
 
-       const std::list< std::shared_ptr<decode::Decoder> >& stack() const;
-       void push(std::shared_ptr<decode::Decoder> decoder);
+       const list< shared_ptr<decode::Decoder> >& stack() const;
+       void push(shared_ptr<decode::Decoder> decoder);
        void remove(int index);
 
        double samplerate() const;
@@ -92,13 +101,13 @@ public:
 
        int64_t samples_decoded() const;
 
-       std::vector<decode::Row> get_visible_rows() const;
+       vector<decode::Row> get_visible_rows() const;
 
        /**
         * Extracts sorted annotations between two period into a vector.
         */
        void get_annotation_subset(
-               std::vector<pv::data::decode::Annotation> &dest,
+               vector<pv::data::decode::Annotation> &dest,
                const decode::Row &row, uint64_t start_sample,
                uint64_t end_sample) const;
 
@@ -143,28 +152,28 @@ private:
         * @todo A proper solution should be implemented to allow multiple
         * decode operations in parallel.
         */
-       static std::mutex global_srd_mutex_;
+       static mutex global_srd_mutex_;
 
-       std::list< std::shared_ptr<decode::Decoder> > stack_;
+       list< shared_ptr<decode::Decoder> > stack_;
 
-       std::shared_ptr<pv::data::LogicSegment> segment_;
+       shared_ptr<pv::data::LogicSegment> segment_;
 
-       mutable std::mutex input_mutex_;
-       mutable std::condition_variable input_cond_;
+       mutable mutex input_mutex_;
+       mutable condition_variable input_cond_;
        int64_t sample_count_;
        bool frame_complete_;
 
-       mutable std::mutex output_mutex_;
+       mutable mutex output_mutex_;
        int64_t samples_decoded_;
 
-       std::map<const decode::Row, decode::RowData> rows_;
+       map<const decode::Row, decode::RowData> rows_;
 
-       std::map<std::pair<const srd_decoder*, int>, decode::Row> class_rows_;
+       map<pair<const srd_decoder*, int>, decode::Row> class_rows_;
 
        QString error_message_;
 
        std::thread decode_thread_;
-       std::atomic<bool> interrupt_;
+       atomic<bool> interrupt_;
 
        friend struct DecoderStackTest::TwoDecoderStack;
 };
index cd80ac99de13ca54384e9a7013239d68076f7823..399c81349c3087ceea417a0e75a610f436e49c59 100644 (file)
@@ -69,7 +69,7 @@ void Logic::clear()
 uint64_t Logic::max_sample_count() const
 {
        uint64_t l = 0;
-       for (std::shared_ptr<LogicSegment> s : segments_) {
+       for (shared_ptr<LogicSegment> s : segments_) {
                assert(s);
                l = max(l, s->get_sample_count());
        }
index e7f7a055da3db150f12f8365edf16af3b7aec59c..c80f0151f8957122d8a87687a75c535b083d196f 100644 (file)
 
 #include <QObject>
 
+using std::deque;
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 namespace data {
 
@@ -40,13 +44,11 @@ public:
 
        unsigned int num_channels() const;
 
-       void push_segment(
-               std::shared_ptr<LogicSegment> &segment);
+       void push_segment(shared_ptr<LogicSegment> &segment);
 
-       const std::deque< std::shared_ptr<LogicSegment> >&
-               logic_segments() const;
+       const deque< shared_ptr<LogicSegment> >& logic_segments() const;
 
-       std::vector< std::shared_ptr<Segment> > segments() const;
+       vector< shared_ptr<Segment> > segments() const;
 
        void clear();
 
@@ -63,7 +65,7 @@ Q_SIGNALS:
 
 private:
        const unsigned int num_channels_;
-       std::deque< std::shared_ptr<LogicSegment> > segments_;
+       deque< shared_ptr<LogicSegment> > segments_;
 };
 
 } // namespace data
index 5191a3f03e76a2654202f84039e18d574898b56e..6350682f95ac2a5ae69e8c11e482fc6212914a67 100644 (file)
@@ -35,6 +35,7 @@ using std::max;
 using std::min;
 using std::pair;
 using std::shared_ptr;
+using std::vector;
 
 using sigrok::Logic;
 
@@ -298,7 +299,7 @@ uint64_t LogicSegment::get_unpacked_sample(uint64_t index) const
 }
 
 void LogicSegment::get_subsampled_edges(
-       std::vector<EdgePair> &edges,
+       vector<EdgePair> &edges,
        uint64_t start, uint64_t end,
        float min_length, int sig_index)
 {
index c450f0a905d9a96391e5ca759a65f06279acc225..b8e41835a4bbaedcac10786d1b56ffb43495855d 100644 (file)
 
 #include <QObject>
 
+using std::pair;
+using std::shared_ptr;
+using std::vector;
+
 namespace sigrok {
        class Logic;
 }
@@ -70,14 +74,14 @@ private:
        static const uint64_t MipMapDataUnit;
 
 public:
-       typedef std::pair<int64_t, bool> EdgePair;
+       typedef pair<int64_t, bool> EdgePair;
 
 public:
-       LogicSegment(pv::data::Logic& owner, std::shared_ptr<sigrok::Logic> data, uint64_t samplerate);
+       LogicSegment(pv::data::Logic& owner, shared_ptr<sigrok::Logic> data, uint64_t samplerate);
 
        virtual ~LogicSegment();
 
-       void append_payload(std::shared_ptr<sigrok::Logic> logic);
+       void append_payload(shared_ptr<sigrok::Logic> logic);
 
        const uint8_t* get_samples(int64_t start_sample, int64_t end_sample) const;
 
@@ -106,7 +110,7 @@ public:
         * can be resolved at this level of detail.
         * @param[in] sig_index The index of the signal.
         */
-       void get_subsampled_edges(std::vector<EdgePair> &edges,
+       void get_subsampled_edges(vector<EdgePair> &edges,
                uint64_t start, uint64_t end,
                float min_length, int sig_index);
 
index a2a213afcdcbca59a6c0bba9a66632bdc78af7d8..86211f8218f52d02eb8ed59df0e2eecf998379a9 100644 (file)
@@ -26,6 +26,7 @@
 #include <vector>
 
 using std::lock_guard;
+using std::min;
 using std::recursive_mutex;
 using std::vector;
 
@@ -47,8 +48,7 @@ Segment::Segment(uint64_t samplerate, unsigned int unit_size) :
 
        // Determine the number of samples we can fit in one chunk
        // without exceeding MaxChunkSize
-       chunk_size_ = std::min(MaxChunkSize,
-               (MaxChunkSize / unit_size_) * unit_size_);
+       chunk_size_ = min(MaxChunkSize, (MaxChunkSize / unit_size_) * unit_size_);
 
        // Create the initial chunk
        current_chunk_ = new uint8_t[chunk_size_];
@@ -188,7 +188,7 @@ uint8_t* Segment::get_raw_samples(uint64_t start, uint64_t count) const
        while (count > 0) {
                const uint8_t* chunk = data_chunks_[chunk_num];
 
-               uint64_t copy_size = std::min(count * unit_size_,
+               uint64_t copy_size = min(count * unit_size_,
                        chunk_size_ - chunk_offs);
 
                memcpy(dest_ptr, chunk + chunk_offs, copy_size);
index f1ff0f527370a80bbf6137d3291ee53715e6698d..b46af4925184fbf3b6bab8c14ef16a6eec2d5dc2 100644 (file)
@@ -27,6 +27,9 @@
 #include <mutex>
 #include <vector>
 
+using std::recursive_mutex;
+using std::vector;
+
 namespace SegmentTest {
 struct SmallSize8Single;
 struct MediumSize8Single;
@@ -78,8 +81,8 @@ protected:
        void continue_raw_sample_iteration(SegmentRawDataIterator* it, uint64_t increase);
        void end_raw_sample_iteration(SegmentRawDataIterator* it);
 
-       mutable std::recursive_mutex mutex_;
-       std::vector<uint8_t*> data_chunks_;
+       mutable recursive_mutex mutex_;
+       vector<uint8_t*> data_chunks_;
        uint8_t* current_chunk_;
        uint64_t used_samples_, unused_samples_;
        uint64_t sample_count_;
index 561439a2d961549f4c1036c39649ac1019bec069..06b3e1d866b671b397bb396d95f1c714b6b340f6 100644 (file)
@@ -139,12 +139,12 @@ bool SignalBase::is_decode_signal() const
        return (decoder_stack_ != nullptr);
 }
 
-std::shared_ptr<pv::data::DecoderStack> SignalBase::decoder_stack() const
+shared_ptr<pv::data::DecoderStack> SignalBase::decoder_stack() const
 {
        return decoder_stack_;
 }
 
-void SignalBase::set_decoder_stack(std::shared_ptr<pv::data::DecoderStack>
+void SignalBase::set_decoder_stack(shared_ptr<pv::data::DecoderStack>
        decoder_stack)
 {
        decoder_stack_ = decoder_stack;
index 6667dd76847cab8ce3235c99d6ec19deb73544fb..8b60c36688dcf6f1665ae8c4c7745bb4b60bcc90 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
+using std::shared_ptr;
 
 namespace sigrok {
 class Channel;
@@ -50,14 +51,14 @@ private:
        static const int ColourBGAlpha;
 
 public:
-       SignalBase(std::shared_ptr<sigrok::Channel> channel);
+       SignalBase(shared_ptr<sigrok::Channel> channel);
        virtual ~SignalBase() {}
 
 public:
        /**
         * Returns the underlying SR channel.
         */
-       std::shared_ptr<sigrok::Channel> channel() const;
+       shared_ptr<sigrok::Channel> channel() const;
 
        /**
         * Returns enabled status of this channel.
@@ -113,25 +114,24 @@ public:
        /**
         * Sets the internal data object.
         */
-       void set_data(std::shared_ptr<pv::data::SignalData> data);
+       void set_data(shared_ptr<pv::data::SignalData> data);
 
        /**
         * Get the internal data as analog data object in case of analog type.
         */
-       std::shared_ptr<pv::data::Analog> analog_data() const;
+       shared_ptr<pv::data::Analog> analog_data() const;
 
        /**
         * Get the internal data as logic data object in case of logic type.
         */
-       std::shared_ptr<pv::data::Logic> logic_data() const;
+       shared_ptr<pv::data::Logic> logic_data() const;
 
 #ifdef ENABLE_DECODE
        bool is_decode_signal() const;
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack() const;
+       shared_ptr<pv::data::DecoderStack> decoder_stack() const;
 
-       void set_decoder_stack(std::shared_ptr<pv::data::DecoderStack>
-               decoder_stack);
+       void set_decoder_stack(shared_ptr<pv::data::DecoderStack> decoder_stack);
 #endif
 
        void save_settings(QSettings &settings) const;
@@ -146,11 +146,11 @@ Q_SIGNALS:
        void colour_changed(const QColor &colour);
 
 private:
-       std::shared_ptr<sigrok::Channel> channel_;
-       std::shared_ptr<pv::data::SignalData> data_;
+       shared_ptr<sigrok::Channel> channel_;
+       shared_ptr<pv::data::SignalData> data_;
 
 #ifdef ENABLE_DECODE
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack_;
+       shared_ptr<pv::data::DecoderStack> decoder_stack_;
 #endif
 
        QString internal_name_, name_;
index f8ae97282cd8d244df0e9cf8ae9e163361873219..034703e19a2df88dec8ba57580fa9f6bfb1507aa 100644 (file)
@@ -24,6 +24,9 @@
 #include <memory>
 #include <vector>
 
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 namespace data {
 
@@ -36,7 +39,7 @@ public:
        virtual ~SignalData() {}
 
 public:
-       virtual std::vector< std::shared_ptr<Segment> > segments() const = 0;
+       virtual vector< shared_ptr<Segment> > segments() const = 0;
 
        virtual void clear() = 0;
 
index 9e3944b5974e4ce5fa1dbd9c2d268c1ebb1e72bd..bd41eb8db2135c37db45d0e4cd44a3e9e6af6bb4 100644 (file)
@@ -64,7 +64,7 @@ DeviceManager::DeviceManager(shared_ptr<Context> context) :
                driver_scan(entry.second, map<const ConfigKey *, VariantBase>());
 }
 
-const std::shared_ptr<sigrok::Context>& DeviceManager::context() const
+const shared_ptr<sigrok::Context>& DeviceManager::context() const
 {
        return context_;
 }
index 145f9e80a44e68fbfa96bafe027a4a2781c89e75..43d93a7a88f5778d0bed24bcead6ec1f2e9dc85e 100644 (file)
 #include <memory>
 #include <string>
 
+using std::list;
+using std::map;
+using std::shared_ptr;
+using std::string;
+
 namespace Glib {
 class VariantBase;
 }
@@ -47,34 +52,33 @@ class Session;
 class DeviceManager
 {
 public:
-       DeviceManager(std::shared_ptr<sigrok::Context> context);
+       DeviceManager(shared_ptr<sigrok::Context> context);
 
        ~DeviceManager() = default;
 
-       const std::shared_ptr<sigrok::Context>& context() const;
+       const shared_ptr<sigrok::Context>& context() const;
 
-       std::shared_ptr<sigrok::Context> context();
+       shared_ptr<sigrok::Context> context();
 
-       const std::list< std::shared_ptr<devices::HardwareDevice> >&
-               devices() const;
+       const list< shared_ptr<devices::HardwareDevice> >& devices() const;
 
-       std::list< std::shared_ptr<devices::HardwareDevice> > driver_scan(
-               std::shared_ptr<sigrok::Driver> driver,
-               std::map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts);
+       list< shared_ptr<devices::HardwareDevice> > driver_scan(
+               shared_ptr<sigrok::Driver> driver,
+               map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts);
 
-       const std::map<std::string, std::string> get_device_info(
-               const std::shared_ptr<devices::Device> device);
+       const map<string, string> get_device_info(
+               const shared_ptr<devices::Device> device);
 
-       const std::shared_ptr<devices::HardwareDevice> find_device_from_info(
-               const std::map<std::string, std::string> search_info);
+       const shared_ptr<devices::HardwareDevice> find_device_from_info(
+               const map<string, string> search_info);
 
 private:
-       bool compare_devices(std::shared_ptr<devices::Device> a,
-               std::shared_ptr<devices::Device> b);
+       bool compare_devices(shared_ptr<devices::Device> a,
+               shared_ptr<devices::Device> b);
 
 protected:
-       std::shared_ptr<sigrok::Context> context_;
-       std::list< std::shared_ptr<devices::HardwareDevice> > devices_;
+       shared_ptr<sigrok::Context> context_;
+       list< shared_ptr<devices::HardwareDevice> > devices_;
 };
 
 } // namespace pv
index c6784d403661a21d5ae58f82686695fc577d1d77..de489bc2a6f292c909b5156c4b9676f0fd8a0d08 100644 (file)
@@ -25,6 +25,7 @@
 
 using std::map;
 using std::set;
+using std::shared_ptr;
 
 using sigrok::ConfigKey;
 using sigrok::Capability;
@@ -42,12 +43,12 @@ Device::~Device()
                session_->remove_datafeed_callbacks();
 }
 
-std::shared_ptr<sigrok::Session> Device::session() const
+shared_ptr<sigrok::Session> Device::session() const
 {
        return session_;
 }
 
-std::shared_ptr<sigrok::Device> Device::device() const
+shared_ptr<sigrok::Device> Device::device() const
 {
        return device_;
 }
index b4518fbee97091f1365c5589603f7ae6f251cf3f..fd78960c153f50917eb08fca0745e54186c104f2 100644 (file)
@@ -23,6 +23,9 @@
 #include <memory>
 #include <string>
 
+using std::shared_ptr;
+using std::string;
+
 namespace sigrok {
 class ConfigKey;
 class Device;
@@ -43,9 +46,9 @@ protected:
 public:
        virtual ~Device();
 
-       std::shared_ptr<sigrok::Session> session() const;
+       shared_ptr<sigrok::Session> session() const;
 
-       std::shared_ptr<sigrok::Device> device() const;
+       shared_ptr<sigrok::Device> device() const;
 
        template<typename T>
        T read_config(const sigrok::ConfigKey *key, const T default_value = 0);
@@ -53,14 +56,14 @@ public:
        /**
         * Builds the full name. It only contains all the fields.
         */
-       virtual std::string full_name() const = 0;
+       virtual string full_name() const = 0;
 
        /**
         * Builds the display name. It only contains fields as required.
         * @param device_manager a reference to the device manager is needed
         * so that other similarly titled devices can be detected.
         */
-       virtual std::string display_name(
+       virtual string display_name(
                const DeviceManager &device_manager) const = 0;
 
        virtual void open() = 0;
@@ -74,8 +77,8 @@ public:
        virtual void stop();
 
 protected:
-       std::shared_ptr<sigrok::Session> session_;
-       std::shared_ptr<sigrok::Device> device_;
+       shared_ptr<sigrok::Session> session_;
+       shared_ptr<sigrok::Device> device_;
 };
 
 } // namespace devices
index 04c8be3792ad1ffc95d9d5139e97c25d90a7578a..dc64246a9dbcefb1e600e80c12f8916487908779 100644 (file)
 
 #include "file.hpp"
 
+using std::string;
+
 namespace pv {
 namespace devices {
 
-File::File(const std::string &file_name) :
+File::File(const string &file_name) :
        file_name_(file_name)
 {
 }
 
-std::string File::full_name() const
+string File::full_name() const
 {
        return file_name_;
 }
 
-std::string File::display_name(const DeviceManager&) const
+string File::display_name(const DeviceManager&) const
 {
        return boost::filesystem::path(file_name_).filename().string();
 }
index acaac84783726756fbaf102eb5d164e3daa38f95..d8e9ae9a01eb2b6879ddae931a9da2c04d39d788 100644 (file)
 
 #include "device.hpp"
 
+using std::string;
+
 namespace pv {
 namespace devices {
 
 class File : public Device
 {
 protected:
-       File(const std::string &file_name);
+       File(const string &file_name);
 
 public:
        /**
         * Builds the full name. It only contains all the fields.
         */
-       std::string full_name() const;
+       string full_name() const;
 
        /**
         * Builds the display name. It only contains fields as required.
         */
-       std::string display_name(const DeviceManager&) const;
+       string display_name(const DeviceManager&) const;
 
 protected:
-       const std::string file_name_;
+       const string file_name_;
 };
 
 } // namespace devices
index 591c756ba84519abce9b2e0eed39e41f07b83763..0ed5c4ae3ee4cb5f6339505c9e640c03ab3fe69c 100644 (file)
@@ -40,8 +40,8 @@ using sigrok::HardwareDevice;
 namespace pv {
 namespace devices {
 
-HardwareDevice::HardwareDevice(const std::shared_ptr<sigrok::Context> &context,
-       std::shared_ptr<sigrok::HardwareDevice> device) :
+HardwareDevice::HardwareDevice(const shared_ptr<sigrok::Context> &context,
+       shared_ptr<sigrok::HardwareDevice> device) :
        context_(context),
        device_open_(false)
 {
index ed479c4fc6d238fdd1e8e83e610ab5d612b2ed8c..32f5b644172cca873c51b04c0102cc3a9911e6c6 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "device.hpp"
 
+using std::shared_ptr;
+using std::string;
+
 namespace sigrok {
 class Context;
 class HardwareDevice;
@@ -33,31 +36,31 @@ namespace devices {
 class HardwareDevice final : public Device
 {
 public:
-       HardwareDevice(const std::shared_ptr<sigrok::Context> &context,
-               std::shared_ptr<sigrok::HardwareDevice> device);
+       HardwareDevice(const shared_ptr<sigrok::Context> &context,
+               shared_ptr<sigrok::HardwareDevice> device);
 
        ~HardwareDevice();
 
-       std::shared_ptr<sigrok::HardwareDevice> hardware_device() const;
+       shared_ptr<sigrok::HardwareDevice> hardware_device() const;
 
        /**
         * Builds the full name. It only contains all the fields.
         */
-       std::string full_name() const;
+       string full_name() const;
 
        /**
         * Builds the display name. It only contains fields as required.
         * @param device_manager a reference to the device manager is needed
         * so that other similarly titled devices can be detected.
         */
-       std::string display_name(const DeviceManager &device_manager) const;
+       string display_name(const DeviceManager &device_manager) const;
 
        void open();
 
        void close();
 
 private:
-       const std::shared_ptr<sigrok::Context> context_;
+       const shared_ptr<sigrok::Context> context_;
        bool device_open_;
 };
 
index 7c981f1acd926bfd13054e186292b60d36d3a971..58c60d700bbd25375222b20f09c7f35a41097e3a 100644 (file)
 
 #include "inputfile.hpp"
 
+using std::map;
+using std::shared_ptr;
+using std::streamsize;
+using std::string;
+using std::ifstream;
+using std::ios;
+
 namespace pv {
 namespace devices {
 
-const std::streamsize InputFile::BufferSize = 16384;
+const streamsize InputFile::BufferSize = 16384;
 
-InputFile::InputFile(const std::shared_ptr<sigrok::Context> &context,
-       const std::string &file_name,
-       std::shared_ptr<sigrok::InputFormat> format,
-       const std::map<std::string, Glib::VariantBase> &options) :
+InputFile::InputFile(const shared_ptr<sigrok::Context> &context,
+       const string &file_name,
+       shared_ptr<sigrok::InputFormat> format,
+       const map<string, Glib::VariantBase> &options) :
        File(file_name),
        context_(context),
        format_(format),
@@ -55,11 +62,11 @@ void InputFile::open()
 
        // open() should add the input device to the session but
        // we can't open the device without sending some data first
-       f = new std::ifstream(file_name_, std::ios::binary);
+       f = new ifstream(file_name_, ios::binary);
 
        char buffer[BufferSize];
        f->read(buffer, BufferSize);
-       const std::streamsize size = f->gcount();
+       const streamsize size = f->gcount();
        if (size == 0)
                return;
 
@@ -90,14 +97,14 @@ void InputFile::run()
 
        if (!f) {
                // Previous call to run() processed the entire file already
-               f = new std::ifstream(file_name_, std::ios::binary);
+               f = new ifstream(file_name_, ios::binary);
                input_->reset();
        }
 
        interrupt_ = false;
        while (!interrupt_ && !f->eof()) {
                f->read(buffer, BufferSize);
-               const std::streamsize size = f->gcount();
+               const streamsize size = f->gcount();
                if (size == 0)
                        break;
 
index 3efaf795b2ea985c57d69b91e40f3421c107bdfb..41698e6d6be45638b7d00f24cb139deb9f2c6f6a 100644 (file)
 
 #include "file.hpp"
 
+using std::atomic;
+using std::ifstream;
+using std::map;
+using std::shared_ptr;
+using std::streamsize;
+using std::string;
+
 namespace pv {
 namespace devices {
 
 class InputFile final : public File
 {
 private:
-       static const std::streamsize BufferSize;
+       static const streamsize BufferSize;
 
 public:
-       InputFile(const std::shared_ptr<sigrok::Context> &context,
-               const std::string &file_name,
-               std::shared_ptr<sigrok::InputFormat> format,
-               const std::map<std::string, Glib::VariantBase> &options);
+       InputFile(const shared_ptr<sigrok::Context> &context,
+               const string &file_name,
+               shared_ptr<sigrok::InputFormat> format,
+               const map<string, Glib::VariantBase> &options);
 
        void open();
 
@@ -51,13 +58,13 @@ public:
        void stop();
 
 private:
-       const std::shared_ptr<sigrok::Context> context_;
-       const std::shared_ptr<sigrok::InputFormat> format_;
-       const std::map<std::string, Glib::VariantBase> options_;
-       std::shared_ptr<sigrok::Input> input_;
+       const shared_ptr<sigrok::Context> context_;
+       const shared_ptr<sigrok::InputFormat> format_;
+       const map<string, Glib::VariantBase> options_;
+       shared_ptr<sigrok::Input> input_;
 
-       std::ifstream *f;
-       std::atomic<bool> interrupt_;
+       ifstream *f;
+       atomic<bool> interrupt_;
 };
 
 } // namespace devices
index 1e8c3acda039f3184e32e701972f16b7f5617bfd..0ba64a9b48cf6ffa4c2e7843bb95cf0a739dea7e 100644 (file)
 
 #include "sessionfile.hpp"
 
+using std::shared_ptr;
+using std::string;
+
 namespace pv {
 namespace devices {
 
-SessionFile::SessionFile(const std::shared_ptr<sigrok::Context> context,
-       const std::string &file_name) :
+SessionFile::SessionFile(const shared_ptr<sigrok::Context> context,
+       const string &file_name) :
        File(file_name),
        context_(context)
 {
index 42078ec13d6192616d27af88106be3dcc264c69e..1e34ce0577b3185ff5007eb1f20c1a54c0e6df38 100644 (file)
@@ -24,6 +24,9 @@
 
 #include "file.hpp"
 
+using std::shared_ptr;
+using std::string;
+
 namespace sigrok {
 class Context;
 } // sigrok
@@ -34,15 +37,15 @@ namespace devices {
 class SessionFile final : public File
 {
 public:
-       SessionFile(const std::shared_ptr<sigrok::Context> context,
-               const std::string &file_name);
+       SessionFile(const shared_ptr<sigrok::Context> context,
+               const string &file_name);
 
        void open();
 
        void close();
 
 private:
-       const std::shared_ptr<sigrok::Context> context_;
+       const shared_ptr<sigrok::Context> context_;
 };
 
 } // namespace devices
index e14972abd47150824dec6d811596df855bcec014..b35f5899f502d0419f87a456d0cabe8f5485a53b 100644 (file)
@@ -34,6 +34,8 @@
 #include <QPushButton>
 #include <QVBoxLayout>
 
+using std::shared_ptr;
+
 namespace sigrok {
 class Driver;
 }
@@ -44,8 +46,8 @@ class HardwareDevice;
 }
 }
 
-Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Driver>);
-Q_DECLARE_METATYPE(std::shared_ptr<pv::devices::HardwareDevice>);
+Q_DECLARE_METATYPE(shared_ptr<sigrok::Driver>);
+Q_DECLARE_METATYPE(shared_ptr<pv::devices::HardwareDevice>);
 
 namespace pv {
 
@@ -60,12 +62,12 @@ class Connect : public QDialog
 public:
        Connect(QWidget *parent, pv::DeviceManager &device_manager);
 
-       std::shared_ptr<devices::HardwareDevice> get_selected_device() const;
+       shared_ptr<devices::HardwareDevice> get_selected_device() const;
 
 private:
        void populate_drivers();
 
-       void populate_serials(std::shared_ptr<sigrok::Driver> driver);
+       void populate_serials(shared_ptr<sigrok::Driver> driver);
 
        void unset_connection();
 
index 037f3d41b008ab43ba12eb06a0672d7725e2ab97..5d5ab55a1a967af98494534c949814b49efd6782 100644 (file)
 
 #include <pv/binding/inputoutput.hpp>
 
+using std::map;
+using std::shared_ptr;
+using std::string;
+
 namespace pv {
 namespace dialogs {
 
@@ -45,15 +49,14 @@ public:
         * @param parent the parent widget of the dialog.
         */ 
        InputOutputOptions(const QString &title,
-               const std::map<std::string, std::shared_ptr<sigrok::Option>>
-                       &options,
+               const map<string, shared_ptr<sigrok::Option>> &options,
                QWidget *parent);
 
        /**
         * Gets the map of selected options.
         * @return the options.
         */
-       const std::map<std::string, Glib::VariantBase>& options() const;
+       const map<string, Glib::VariantBase>& options() const;
 
 protected:
        void accept();
index 068d99b3108ead8c35a5c2dce0e1884a096f6d9d..cf4757336e333044b053895ef916332ad05718dd 100644 (file)
@@ -40,6 +40,8 @@
 #include <libsigrokdecode/libsigrokdecode.h>
 #endif
 
+using std::shared_ptr;
+
 namespace pv {
 namespace dialogs {
 
@@ -159,7 +161,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
                QApplication::organizationDomain()));
        version_info->setOpenExternalLinks(true);
 
-       std::shared_ptr<sigrok::Context> context = device_manager_.context();
+       shared_ptr<sigrok::Context> context = device_manager_.context();
 
        QString s;
        s.append("<table>");
index b9c87ee70f49ba433860ab3cfdcda15842d78cf7..4ef3404594ecc1a26100e90add78cd5653fef543 100644 (file)
@@ -26,6 +26,8 @@
 #include "storeprogress.hpp"
 
 using std::map;
+using std::pair;
+using std::shared_ptr;
 using std::string;
 
 using Glib::VariantBase;
@@ -34,9 +36,9 @@ namespace pv {
 namespace dialogs {
 
 StoreProgress::StoreProgress(const QString &file_name,
-       const std::shared_ptr<sigrok::OutputFormat> output_format,
+       const shared_ptr<sigrok::OutputFormat> output_format,
        const map<string, VariantBase> &options,
-       const std::pair<uint64_t, uint64_t> sample_range,
+       const pair<uint64_t, uint64_t> sample_range,
        const Session &session, QWidget *parent) :
        QProgressDialog(tr("Saving..."), tr("Cancel"), 0, 0, parent),
        session_(file_name.toStdString(), output_format, options, sample_range,
@@ -78,7 +80,7 @@ void StoreProgress::closeEvent(QCloseEvent*)
 
 void StoreProgress::on_progress_updated()
 {
-       const std::pair<int, int> p = session_.progress();
+       const pair<int, int> p = session_.progress();
        assert(p.first <= p.second);
 
        if (p.second) {
index e968ce4197c3e0e04da7d5d9050f9a511784251d..b54eb47f10a3a28ff5171ca60d0afe2b3175df50 100644 (file)
 
 #include <pv/storesession.hpp>
 
+using std::map;
+using std::pair;
+using std::shared_ptr;
+using std::string;
+
 namespace pv {
 
 class Session;
@@ -39,9 +44,9 @@ class StoreProgress : public QProgressDialog
 
 public:
        StoreProgress(const QString &file_name,
-               const std::shared_ptr<sigrok::OutputFormat> output_format,
-               const std::map<std::string, Glib::VariantBase> &options,
-               const std::pair<uint64_t, uint64_t> sample_range,
+               const shared_ptr<sigrok::OutputFormat> output_format,
+               const map<string, Glib::VariantBase> &options,
+               const pair<uint64_t, uint64_t> sample_range,
                const Session &session,
                QWidget *parent = 0);
 
index e0b7197b966c4c1f1f1841c0651f4d85823e9cd7..7bd77f69b2ae2ec06ea5157449487efea5ec4ee3 100644 (file)
 
 #include "globalsettings.hpp"
 
+using std::function;
+using std::map;
+using std::multimap;
+
 namespace pv {
 
 const QString GlobalSettings::Key_View_AlwaysZoomToFit = "View_AlwaysZoomToFit";
@@ -26,9 +30,9 @@ const QString GlobalSettings::Key_View_ColouredBG = "View_ColouredBG";
 const QString GlobalSettings::Key_View_StickyScrolling = "View_StickyScrolling";
 const QString GlobalSettings::Key_View_ShowSamplingPoints = "View_ShowSamplingPoints";
 
-std::multimap< QString, std::function<void(QVariant)> > GlobalSettings::callbacks_;
+multimap< QString, function<void(QVariant)> > GlobalSettings::callbacks_;
 bool GlobalSettings::tracking_ = false;
-std::map<QString, QVariant> GlobalSettings::tracked_changes_;
+map<QString, QVariant> GlobalSettings::tracked_changes_;
 
 GlobalSettings::GlobalSettings() :
        QSettings()
@@ -37,7 +41,7 @@ GlobalSettings::GlobalSettings() :
 }
 
 void GlobalSettings::register_change_handler(const QString key,
-       std::function<void(QVariant)> cb)
+       function<void(QVariant)> cb)
 {
        callbacks_.emplace(key, cb);
 }
index 1b6560f99bfa4d1a451ae3e11b01731f4141224c..45247377391267eada5bb5438ce841870022c3ee 100644 (file)
 #include <QString>
 #include <QVariant>
 
+using std::function;
+using std::map;
+using std::multimap;
+
 namespace pv {
 
 class GlobalSettings : public QSettings
@@ -43,7 +47,7 @@ public:
        GlobalSettings();
 
        static void register_change_handler(const QString key,
-               std::function<void(QVariant)> cb);
+               function<void(QVariant)> cb);
 
        void setValue(const QString& key, const QVariant& value);
 
@@ -66,10 +70,10 @@ public:
        void undo_tracked_changes();
 
 private:
-       static std::multimap< QString, std::function<void(QVariant)> > callbacks_;
+       static multimap< QString, function<void(QVariant)> > callbacks_;
 
        static bool tracking_;
-       static std::map<QString, QVariant> tracked_changes_;
+       static map<QString, QVariant> tracked_changes_;
 };
 
 } // namespace pv
index b6cca7b2edadb99d8313b7d92ccbf4313c028386..46f8a123ae8907b7d3793dd0b47eac9d3ba3bf1f 100644 (file)
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
+using std::bind;
 using std::dynamic_pointer_cast;
 using std::list;
 using std::make_shared;
 using std::map;
+using std::placeholders::_1;
 using std::shared_ptr;
 using std::string;
 
@@ -65,9 +67,6 @@ class ViewItem;
 
 using toolbars::MainBar;
 
-using std::bind;
-using std::placeholders::_1;
-
 const QString MainWindow::WindowTitle = tr("PulseView");
 
 MainWindow::MainWindow(DeviceManager &device_manager,
@@ -474,7 +473,7 @@ void MainWindow::restore_ui_settings()
        }
 }
 
-std::shared_ptr<Session> MainWindow::get_tab_session(int index) const
+shared_ptr<Session> MainWindow::get_tab_session(int index) const
 {
        // Find the session that belongs to the tab's main window
        for (auto entry : session_windows_)
@@ -539,7 +538,7 @@ void MainWindow::on_add_view(const QString &title, views::ViewType type,
        Session *session)
 {
        // We get a pointer and need a reference
-       for (std::shared_ptr<Session> s : sessions_)
+       for (shared_ptr<Session> s : sessions_)
                if (s.get() == session)
                        add_view(title, type, *s);
 }
@@ -659,7 +658,7 @@ void MainWindow::on_capture_state_changed(QObject *obj)
 void MainWindow::on_new_view(Session *session)
 {
        // We get a pointer and need a reference
-       for (std::shared_ptr<Session> s : sessions_)
+       for (shared_ptr<Session> s : sessions_)
                if (s.get() == session)
                        add_view(session->name(), views::ViewTypeTrace, *s);
 }
index 90e915033b8bab19490a3614fbc3b5bc513e6fe5..0611e0021c512e4c3fb7b654a5432bae168bc38d 100644 (file)
 #include "session.hpp"
 #include "views/viewbase.hpp"
 
+using std::list;
+using std::map;
+using std::shared_ptr;
+using std::string;
+
 struct srd_decoder;
 
 class QVBoxLayout;
@@ -65,22 +70,22 @@ private:
 
 public:
        explicit MainWindow(DeviceManager &device_manager,
-               std::string open_file_name = std::string(),
-               std::string open_file_format = std::string(),
+               string open_file_name = string(),
+               string open_file_format = string(),
                QWidget *parent = 0);
 
        ~MainWindow();
 
-       std::shared_ptr<views::ViewBase> get_active_view() const;
+       shared_ptr<views::ViewBase> get_active_view() const;
 
-       std::shared_ptr<views::ViewBase> add_view(const QString &title,
+       shared_ptr<views::ViewBase> add_view(const QString &title,
                views::ViewType type, Session &session);
 
-       void remove_view(std::shared_ptr<views::ViewBase> view);
+       void remove_view(shared_ptr<views::ViewBase> view);
 
-       std::shared_ptr<Session> add_session();
+       shared_ptr<Session> add_session();
 
-       void remove_session(std::shared_ptr<Session> session);
+       void remove_session(shared_ptr<Session> session);
 
 private:
        void setup_ui();
@@ -89,7 +94,7 @@ private:
 
        void restore_ui_settings();
 
-       std::shared_ptr<Session> get_tab_session(int index) const;
+       shared_ptr<Session> get_tab_session(int index) const;
 
        void closeEvent(QCloseEvent *event);
 
@@ -106,7 +111,7 @@ private Q_SLOTS:
                Session *session);
 
        void on_focus_changed();
-       void on_focused_session_changed(std::shared_ptr<Session> session);
+       void on_focused_session_changed(shared_ptr<Session> session);
 
        void on_new_session_clicked();
        void on_run_stop_clicked();
@@ -133,12 +138,12 @@ private Q_SLOTS:
 private:
        DeviceManager &device_manager_;
 
-       std::list< std::shared_ptr<Session> > sessions_;
-       std::shared_ptr<Session> last_focused_session_;
+       list< shared_ptr<Session> > sessions_;
+       shared_ptr<Session> last_focused_session_;
 
-       std::map< QDockWidget*, std::shared_ptr<views::ViewBase> > view_docks_;
+       map< QDockWidget*, shared_ptr<views::ViewBase> > view_docks_;
 
-       std::map< std::shared_ptr<Session>, QMainWindow*> session_windows_;
+       map< shared_ptr<Session>, QMainWindow*> session_windows_;
 
        QWidget *static_tab_widget_;
        QToolButton *new_session_button_, *run_stop_button_, *settings_button_;
index 6fe9159d3f854f862b989645fb6b410001a848e8..e525b4baad13e83d30357d60a964dde096625016 100644 (file)
 
 #include <pv/widgets/popup.hpp>
 
+using std::map;
+using std::shared_ptr;
+using std::vector;
+
 class QCheckBox;
 class QGridLayout;
 
@@ -66,11 +70,11 @@ public:
 private:
        void set_all_channels(bool set);
 
-       void populate_group(std::shared_ptr<sigrok::ChannelGroup> group,
-               const std::vector< std::shared_ptr<pv::data::SignalBase> > sigs);
+       void populate_group(shared_ptr<sigrok::ChannelGroup> group,
+               const vector< shared_ptr<pv::data::SignalBase> > sigs);
 
        QGridLayout* create_channel_group_grid(
-               const std::vector< std::shared_ptr<pv::data::SignalBase> > sigs);
+               const vector< shared_ptr<pv::data::SignalBase> > sigs);
 
 private:
        void showEvent(QShowEvent *event);
@@ -88,9 +92,8 @@ private:
 
        bool updating_channels_;
 
-       std::vector< std::shared_ptr<pv::binding::Device> >
-                group_bindings_;
-       std::map< QCheckBox*, std::shared_ptr<pv::data::SignalBase> >
+       vector< shared_ptr<pv::binding::Device> > group_bindings_;
+       map< QCheckBox*, shared_ptr<pv::data::SignalBase> >
                check_box_signal_map_;
 
        QHBoxLayout buttons_bar_;
index 0ad0f5adec09b5a44915fb4aab4eba43384d6749..21f88e90947f038a01f675a7483584ccc90ff776 100644 (file)
@@ -26,6 +26,8 @@
 #include <pv/binding/device.hpp>
 #include <pv/widgets/popup.hpp>
 
+using std::shared_ptr;
+
 namespace sigrok {
        class Device;
 }
@@ -38,13 +40,12 @@ class DeviceOptions : public pv::widgets::Popup
        Q_OBJECT
 
 public:
-       DeviceOptions(std::shared_ptr<sigrok::Device> device,
-               QWidget *parent);
+       DeviceOptions(shared_ptr<sigrok::Device> device, QWidget *parent);
 
        pv::binding::Device& binding();
 
 private:
-       std::shared_ptr<sigrok::Device> device_;
+       shared_ptr<sigrok::Device> device_;
 
        QVBoxLayout layout_;
 
index df4a254fcbaf5a970ad00f97908da8a779adf053..666ece979a30f973969b32097073d856aad1078c 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "property.hpp"
 
+using std::pair;
+
 class QDoubleSpinBox;
 
 namespace pv {
@@ -37,7 +39,7 @@ class Double : public Property
 
 public:
        Double(QString name, int decimals, QString suffix,
-               boost::optional< std::pair<double, double> > range,
+               boost::optional< pair<double, double> > range,
                boost::optional<double> step,
                Getter getter,
                Setter setter);
@@ -54,7 +56,7 @@ private Q_SLOTS:
 private:
        const int decimals_;
        const QString suffix_;
-       const boost::optional< std::pair<double, double> > range_;
+       const boost::optional< pair<double, double> > range_;
        const boost::optional<double> step_;
 
        QDoubleSpinBox *spin_box_;
index 7216508ca75fcf1f3590fa8febea78b681eb498c..b3ce26cc488ad73d99f845c3f5ba57b77697f9d7 100644 (file)
@@ -27,6 +27,9 @@
 
 #include <QMetaType>
 
+using std::pair;
+using std::vector;
+
 Q_DECLARE_METATYPE(Glib::VariantBase);
 
 class QComboBox;
@@ -39,7 +42,7 @@ class Enum : public Property
        Q_OBJECT;
 
 public:
-       Enum(QString name, std::vector<std::pair<Glib::VariantBase, QString> > values,
+       Enum(QString name, vector<pair<Glib::VariantBase, QString> > values,
                Getter getter, Setter setter);
 
        virtual ~Enum() = default;
@@ -52,7 +55,7 @@ private Q_SLOTS:
        void on_current_item_changed(int);
 
 private:
-       const std::vector< std::pair<Glib::VariantBase, QString> > values_;
+       const vector< pair<Glib::VariantBase, QString> > values_;
 
        QComboBox *selector_;
 };
index 92d7c62c93f9748c816b7c00fe5a1ec678f18cee..e94f6cbf7e549039b3c8f4ed435247f29000e861 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "property.hpp"
 
+using std::pair;
+
 class QSpinBox;
 
 namespace pv {
@@ -37,7 +39,7 @@ class Int : public Property
 
 public:
        Int(QString name, QString suffix,
-               boost::optional< std::pair<int64_t, int64_t> > range,
+               boost::optional< pair<int64_t, int64_t> > range,
                Getter getter, Setter setter);
 
        virtual ~Int() = default;
@@ -51,7 +53,7 @@ private Q_SLOTS:
 
 private:
        const QString suffix_;
-       const boost::optional< std::pair<int64_t, int64_t> > range_;
+       const boost::optional< pair<int64_t, int64_t> > range_;
 
        Glib::VariantBase value_;
        QSpinBox *spin_box_;
index 6a4dd9ab2723156171cd04a23283b5f3ffd3434f..1a7b264dfc96429e6e3688bd81614337133c0374 100644 (file)
@@ -30,6 +30,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 #include <QString>
 #include <QWidget>
 
+using std::function;
+
 class QWidget;
 
 namespace pv {
@@ -40,8 +42,8 @@ class Property : public QObject
        Q_OBJECT;
 
 public:
-       typedef std::function<Glib::VariantBase ()> Getter;
-       typedef std::function<void (Glib::VariantBase)> Setter;
+       typedef function<Glib::VariantBase ()> Getter;
+       typedef function<void (Glib::VariantBase)> Setter;
 
 protected:
        Property(QString name, Getter getter, Setter setter);
index 0077ccfd00d0d36d6de0a401d8f71347e24a4d08..e84f78042b89593e9cb96adef18ed187067e5b11 100644 (file)
@@ -66,17 +66,23 @@ using boost::shared_lock;
 using boost::shared_mutex;
 using boost::unique_lock;
 
+using std::bad_alloc;
 using std::dynamic_pointer_cast;
+using std::find_if;
 using std::function;
 using std::lock_guard;
 using std::list;
+using std::make_pair;
+using std::make_shared;
 using std::map;
+using std::max;
+using std::move;
 using std::mutex;
 using std::pair;
 using std::recursive_mutex;
+using std::runtime_error;
 using std::set;
 using std::shared_ptr;
-using std::make_shared;
 using std::string;
 using std::unordered_set;
 using std::vector;
@@ -154,17 +160,17 @@ void Session::set_name(QString name)
        name_changed();
 }
 
-const std::list< std::shared_ptr<views::ViewBase> > Session::views() const
+const list< shared_ptr<views::ViewBase> > Session::views() const
 {
        return views_;
 }
 
-std::shared_ptr<views::ViewBase> Session::main_view() const
+shared_ptr<views::ViewBase> Session::main_view() const
 {
        return main_view_;
 }
 
-void Session::set_main_bar(std::shared_ptr<pv::toolbars::MainBar> main_bar)
+void Session::set_main_bar(shared_ptr<pv::toolbars::MainBar> main_bar)
 {
        main_bar_ = main_bar;
 }
@@ -229,7 +235,7 @@ void Session::save_settings(QSettings &settings) const
                        if (base->is_decode_signal()) {
                                shared_ptr<pv::data::DecoderStack> decoder_stack =
                                                base->decoder_stack();
-                               std::shared_ptr<data::decode::Decoder> top_decoder =
+                               shared_ptr<data::decode::Decoder> top_decoder =
                                                decoder_stack->stack().front();
 
                                settings.beginGroup("decoder_stack" + QString::number(stacks++));
@@ -290,7 +296,7 @@ void Session::restore_settings(QSettings &settings)
 
                        const string value = settings.value(k).toString().toStdString();
                        if (!value.empty())
-                               dev_info.insert(std::make_pair(key, value));
+                               dev_info.insert(make_pair(key, value));
                }
 
                if (dev_info.count("model") > 0)
@@ -389,7 +395,7 @@ void Session::set_device(shared_ptr<devices::Device> device)
        name_changed();
 
        // Remove all stored data
-       for (std::shared_ptr<views::ViewBase> view : views_) {
+       for (shared_ptr<views::ViewBase> view : views_) {
                view->clear_signals();
 #ifdef ENABLE_DECODE
                view->clear_decode_signals();
@@ -410,7 +416,7 @@ void Session::set_device(shared_ptr<devices::Device> device)
 
        signals_changed();
 
-       device_ = std::move(device);
+       device_ = move(device);
 
        try {
                device_->open();
@@ -439,15 +445,13 @@ void Session::set_default_device()
                return;
 
        // Try and find the demo device and select that by default
-       const auto iter = std::find_if(devices.begin(), devices.end(),
+       const auto iter = find_if(devices.begin(), devices.end(),
                [] (const shared_ptr<devices::HardwareDevice> &d) {
-                       return d->hardware_device()->driver()->name() ==
-                       "demo"; });
+                       return d->hardware_device()->driver()->name() == "demo";        });
        set_device((iter == devices.end()) ? devices.front() : *iter);
 }
 
-void Session::load_init_file(const std::string &file_name,
-       const std::string &format)
+void Session::load_init_file(const string &file_name, const string &format)
 {
        shared_ptr<InputFormat> input_format;
 
@@ -470,8 +474,8 @@ void Session::load_init_file(const std::string &file_name,
 }
 
 void Session::load_file(QString file_name,
-       std::shared_ptr<sigrok::InputFormat> format,
-       const std::map<std::string, Glib::VariantBase> &options)
+       shared_ptr<sigrok::InputFormat> format,
+       const map<string, Glib::VariantBase> &options)
 {
        const QString errorMessage(
                QString("Failed to load file %1").arg(file_name));
@@ -522,7 +526,7 @@ void Session::start_capture(function<void (const QString)> error_handler)
        const shared_ptr<sigrok::Device> sr_dev = device_->device();
        if (sr_dev) {
                const auto channels = sr_dev->channels();
-               if (!std::any_of(channels.begin(), channels.end(),
+               if (!any_of(channels.begin(), channels.end(),
                        [](shared_ptr<Channel> channel) {
                                return channel->enabled(); })) {
                        error_handler(tr("No channels enabled."));
@@ -559,7 +563,7 @@ void Session::stop_capture()
                sampling_thread_.join();
 }
 
-void Session::register_view(std::shared_ptr<views::ViewBase> view)
+void Session::register_view(shared_ptr<views::ViewBase> view)
 {
        if (views_.empty()) {
                main_view_ = view;
@@ -570,10 +574,9 @@ void Session::register_view(std::shared_ptr<views::ViewBase> view)
        update_signals();
 }
 
-void Session::deregister_view(std::shared_ptr<views::ViewBase> view)
+void Session::deregister_view(shared_ptr<views::ViewBase> view)
 {
-       views_.remove_if([&](std::shared_ptr<views::ViewBase> v) {
-               return v == view; });
+       views_.remove_if([&](shared_ptr<views::ViewBase> v) { return v == view; });
 
        if (views_.empty()) {
                main_view_.reset();
@@ -583,9 +586,9 @@ void Session::deregister_view(std::shared_ptr<views::ViewBase> view)
        }
 }
 
-bool Session::has_view(std::shared_ptr<views::ViewBase> view)
+bool Session::has_view(shared_ptr<views::ViewBase> view)
 {
-       for (std::shared_ptr<views::ViewBase> v : views_)
+       for (shared_ptr<views::ViewBase> v : views_)
                if (v == view)
                        return true;
 
@@ -601,7 +604,7 @@ double Session::get_samplerate() const
                const vector< shared_ptr<pv::data::Segment> > segments =
                        d->segments();
                for (const shared_ptr<pv::data::Segment> &s : segments)
-                       samplerate = std::max(samplerate, s->samplerate());
+                       samplerate = max(samplerate, s->samplerate());
        }
        // If there is no sample rate given we use samples as unit
        if (samplerate == 0.0)
@@ -610,8 +613,7 @@ double Session::get_samplerate() const
        return samplerate;
 }
 
-const std::unordered_set< std::shared_ptr<data::SignalBase> >
-       Session::signalbases() const
+const unordered_set< shared_ptr<data::SignalBase> > Session::signalbases() const
 {
        return signalbases_;
 }
@@ -627,7 +629,7 @@ bool Session::add_decoder(srd_decoder *const dec)
                decoder_stack = make_shared<data::DecoderStack>(*this, dec);
 
                // Make a list of all the channels
-               std::vector<const srd_channel*> all_channels;
+               vector<const srd_channel*> all_channels;
                for (const GSList *i = dec->channels; i; i = i->next)
                        all_channels.push_back((const srd_channel*)i->data);
                for (const GSList *i = dec->opt_channels; i; i = i->next)
@@ -655,9 +657,9 @@ bool Session::add_decoder(srd_decoder *const dec)
                signalbase->set_decoder_stack(decoder_stack);
                signalbases_.insert(signalbase);
 
-               for (std::shared_ptr<views::ViewBase> view : views_)
+               for (shared_ptr<views::ViewBase> view : views_)
                        view->add_decode_signal(signalbase);
-       } catch (std::runtime_error e) {
+       } catch (runtime_error e) {
                return false;
        }
 
@@ -673,7 +675,7 @@ void Session::remove_decode_signal(shared_ptr<data::SignalBase> signalbase)
 {
        signalbases_.erase(signalbase);
 
-       for (std::shared_ptr<views::ViewBase> view : views_)
+       for (shared_ptr<views::ViewBase> view : views_)
                view->remove_decode_signal(signalbase);
 
        signals_changed();
@@ -699,7 +701,7 @@ void Session::update_signals()
        if (!device_) {
                signalbases_.clear();
                logic_data_.reset();
-               for (std::shared_ptr<views::ViewBase> view : views_) {
+               for (shared_ptr<views::ViewBase> view : views_) {
                        view->clear_signals();
 #ifdef ENABLE_DECODE
                        view->clear_decode_signals();
@@ -714,7 +716,7 @@ void Session::update_signals()
        if (!sr_dev) {
                signalbases_.clear();
                logic_data_.reset();
-               for (std::shared_ptr<views::ViewBase> view : views_) {
+               for (shared_ptr<views::ViewBase> view : views_) {
                        view->clear_signals();
 #ifdef ENABLE_DECODE
                        view->clear_decode_signals();
@@ -725,7 +727,7 @@ void Session::update_signals()
 
        // Detect what data types we will receive
        auto channels = sr_dev->channels();
-       unsigned int logic_channel_count = std::count_if(
+       unsigned int logic_channel_count = count_if(
                channels.begin(), channels.end(),
                [] (shared_ptr<Channel> channel) {
                        return channel->type() == ChannelType::LOGIC; });
@@ -745,7 +747,7 @@ void Session::update_signals()
        }
 
        // Make the signals list
-       for (std::shared_ptr<views::ViewBase> viewbase : views_) {
+       for (shared_ptr<views::ViewBase> viewbase : views_) {
                views::TraceView::View *trace_view =
                        qobject_cast<views::TraceView::View*>(viewbase.get());
 
@@ -759,7 +761,7 @@ void Session::update_signals()
                                shared_ptr<views::TraceView::Signal> signal;
 
                                // Find the channel in the old signals
-                               const auto iter = std::find_if(
+                               const auto iter = find_if(
                                        prev_sigs.cbegin(), prev_sigs.cend(),
                                        [&](const shared_ptr<views::TraceView::Signal> &s) {
                                                return s->base()->channel() == channel;
@@ -1065,7 +1067,7 @@ void Session::data_feed_in(shared_ptr<sigrok::Device> device,
        case SR_DF_LOGIC:
                try {
                        feed_in_logic(dynamic_pointer_cast<Logic>(packet->payload()));
-               } catch (std::bad_alloc) {
+               } catch (bad_alloc) {
                        out_of_memory_ = true;
                        device_->stop();
                }
@@ -1074,7 +1076,7 @@ void Session::data_feed_in(shared_ptr<sigrok::Device> device,
        case SR_DF_ANALOG:
                try {
                        feed_in_analog(dynamic_pointer_cast<Analog>(packet->payload()));
-               } catch (std::bad_alloc) {
+               } catch (bad_alloc) {
                        out_of_memory_ = true;
                        device_->stop();
                }
index bd403605eae33e80b120894419aa6359495f76de..4ac7f509b516dcf18b4738753b1dd5038041f6ec 100644 (file)
 #include "util.hpp"
 #include "views/viewbase.hpp"
 
+using std::function;
+using std::list;
+using std::map;
+using std::mutex;
+using std::recursive_mutex;
+using std::shared_ptr;
+using std::string;
+using std::unordered_set;
+
 struct srd_decoder;
 struct srd_channel;
 
@@ -103,21 +112,21 @@ public:
 
        const DeviceManager& device_manager() const;
 
-       std::shared_ptr<sigrok::Session> session() const;
+       shared_ptr<sigrok::Session> session() const;
 
-       std::shared_ptr<devices::Device> device() const;
+       shared_ptr<devices::Device> device() const;
 
        QString name() const;
 
        void set_name(QString name);
 
-       const std::list< std::shared_ptr<views::ViewBase> > views() const;
+       const list< shared_ptr<views::ViewBase> > views() const;
 
-       std::shared_ptr<views::ViewBase> main_view() const;
+       shared_ptr<views::ViewBase> main_view() const;
 
-       std::shared_ptr<pv::toolbars::MainBar> main_bar() const;
+       shared_ptr<pv::toolbars::MainBar> main_bar() const;
 
-       void set_main_bar(std::shared_ptr<pv::toolbars::MainBar> main_bar);
+       void set_main_bar(shared_ptr<pv::toolbars::MainBar> main_bar);
 
        /**
         * Indicates whether the captured data was saved to disk already or not
@@ -131,44 +140,43 @@ public:
        /**
         * Attempts to set device instance, may fall back to demo if needed
         */
-       void select_device(std::shared_ptr<devices::Device> device);
+       void select_device(shared_ptr<devices::Device> device);
 
        /**
         * Sets device instance that will be used in the next capture session.
         */
-       void set_device(std::shared_ptr<devices::Device> device);
+       void set_device(shared_ptr<devices::Device> device);
 
        void set_default_device();
 
-       void load_init_file(const std::string &file_name,
-               const std::string &format);
+       void load_init_file(const string &file_name, const string &format);
 
        void load_file(QString file_name,
-               std::shared_ptr<sigrok::InputFormat> format = nullptr,
-               const std::map<std::string, Glib::VariantBase> &options =
-                       std::map<std::string, Glib::VariantBase>());
+               shared_ptr<sigrok::InputFormat> format = nullptr,
+               const map<string, Glib::VariantBase> &options =
+                       map<string, Glib::VariantBase>());
 
        capture_state get_capture_state() const;
 
-       void start_capture(std::function<void (const QString)> error_handler);
+       void start_capture(function<void (const QString)> error_handler);
 
        void stop_capture();
 
        double get_samplerate() const;
 
-       void register_view(std::shared_ptr<views::ViewBase> view);
+       void register_view(shared_ptr<views::ViewBase> view);
 
-       void deregister_view(std::shared_ptr<views::ViewBase> view);
+       void deregister_view(shared_ptr<views::ViewBase> view);
 
-       bool has_view(std::shared_ptr<views::ViewBase> view);
+       bool has_view(shared_ptr<views::ViewBase> view);
 
-       const std::unordered_set< std::shared_ptr<data::SignalBase> >
+       const unordered_set< shared_ptr<data::SignalBase> >
                signalbases() const;
 
 #ifdef ENABLE_DECODE
        bool add_decoder(srd_decoder *const dec);
 
-       void remove_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+       void remove_decode_signal(shared_ptr<data::SignalBase> signalbase);
 #endif
 
 private:
@@ -176,50 +184,50 @@ private:
 
        void update_signals();
 
-       std::shared_ptr<data::SignalBase> signalbase_from_channel(
-               std::shared_ptr<sigrok::Channel> channel) const;
+       shared_ptr<data::SignalBase> signalbase_from_channel(
+               shared_ptr<sigrok::Channel> channel) const;
 
 private:
-       void sample_thread_proc(std::function<void (const QString)> error_handler);
+       void sample_thread_proc(function<void (const QString)> error_handler);
 
        void free_unused_memory();
 
        void feed_in_header();
 
-       void feed_in_meta(std::shared_ptr<sigrok::Meta> meta);
+       void feed_in_meta(shared_ptr<sigrok::Meta> meta);
 
        void feed_in_trigger();
 
        void feed_in_frame_begin();
 
-       void feed_in_logic(std::shared_ptr<sigrok::Logic> logic);
+       void feed_in_logic(shared_ptr<sigrok::Logic> logic);
 
-       void feed_in_analog(std::shared_ptr<sigrok::Analog> analog);
+       void feed_in_analog(shared_ptr<sigrok::Analog> analog);
 
-       void data_feed_in(std::shared_ptr<sigrok::Device> device,
-               std::shared_ptr<sigrok::Packet> packet);
+       void data_feed_in(shared_ptr<sigrok::Device> device,
+               shared_ptr<sigrok::Packet> packet);
 
 private:
        DeviceManager &device_manager_;
-       std::shared_ptr<devices::Device> device_;
+       shared_ptr<devices::Device> device_;
        QString default_name_, name_;
 
-       std::list< std::shared_ptr<views::ViewBase> > views_;
-       std::shared_ptr<pv::views::ViewBase> main_view_;
+       list< shared_ptr<views::ViewBase> > views_;
+       shared_ptr<pv::views::ViewBase> main_view_;
 
-       std::shared_ptr<pv::toolbars::MainBar> main_bar_;
+       shared_ptr<pv::toolbars::MainBar> main_bar_;
 
-       mutable std::mutex sampling_mutex_; //!< Protects access to capture_state_.
+       mutable mutex sampling_mutex_; //!< Protects access to capture_state_.
        capture_state capture_state_;
 
-       std::unordered_set< std::shared_ptr<data::SignalBase> > signalbases_;
-       std::unordered_set< std::shared_ptr<data::SignalData> > all_signal_data_;
+       unordered_set< shared_ptr<data::SignalBase> > signalbases_;
+       unordered_set< shared_ptr<data::SignalData> > all_signal_data_;
 
-       mutable std::recursive_mutex data_mutex_;
-       std::shared_ptr<data::Logic> logic_data_;
+       mutable recursive_mutex data_mutex_;
+       shared_ptr<data::Logic> logic_data_;
        uint64_t cur_samplerate_;
-       std::shared_ptr<data::LogicSegment> cur_logic_segment_;
-       std::map< std::shared_ptr<sigrok::Channel>, std::shared_ptr<data::AnalogSegment> >
+       shared_ptr<data::LogicSegment> cur_logic_segment_;
+       map< shared_ptr<sigrok::Channel>, shared_ptr<data::AnalogSegment> >
                cur_analog_segments_;
 
        std::thread sampling_thread_;
index 52a6be34c490fe27cb9bcfb3cf263c5a47b530df..c2135ab3383564b007c70c3484d0d59155b4eaeb 100644 (file)
@@ -55,7 +55,6 @@ using std::pair;
 using std::set;
 using std::shared_ptr;
 using std::string;
-using std::thread;
 using std::unordered_set;
 using std::vector;
 
@@ -71,10 +70,10 @@ namespace pv {
 
 const size_t StoreSession::BlockSize = 10 * 1024 * 1024;
 
-StoreSession::StoreSession(const std::string &file_name,
+StoreSession::StoreSession(const string &file_name,
        const shared_ptr<OutputFormat> &output_format,
        const map<string, VariantBase> &options,
-       const std::pair<uint64_t, uint64_t> sample_range,
+       const pair<uint64_t, uint64_t> sample_range,
        const Session &session) :
        file_name_(file_name),
        output_format_(output_format),
@@ -240,13 +239,13 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_li
        unit_count_ = sample_count_ >> progress_scale;
 
        const unsigned int samples_per_block =
-               std::min(asamples_per_block, lsamples_per_block);
+               min(asamples_per_block, lsamples_per_block);
 
        while (!interrupt_ && sample_count_) {
                progress_updated();
 
                const uint64_t packet_len =
-                       std::min((uint64_t)samples_per_block, sample_count_);
+                       min((uint64_t)samples_per_block, sample_count_);
 
                try {
                        const auto context = session_.device_manager().context();
index e89b3fd209da4e488ae208cd5d47820e0a085692..64913a74d9eb4961baad25fde89ed39b75b963b8 100644 (file)
 
 #include <QObject>
 
+using std::atomic;
+using std::string;
+using std::shared_ptr;
+using std::pair;
+using std::map;
+using std::vector;
+using std::thread;
+using std::mutex;
+using std::ofstream;
+
 namespace sigrok {
 class Output;
 class OutputFormat;
@@ -57,15 +67,15 @@ private:
        static const size_t BlockSize;
 
 public:
-       StoreSession(const std::string &file_name,
-               const std::shared_ptr<sigrok::OutputFormat> &output_format,
-               const std::map<std::string, Glib::VariantBase> &options,
-               const std::pair<uint64_t, uint64_t> sample_range,
+       StoreSession(const string &file_name,
+               const shared_ptr<sigrok::OutputFormat> &output_format,
+               const map<string, Glib::VariantBase> &options,
+               const pair<uint64_t, uint64_t> sample_range,
                const Session &session);
 
        ~StoreSession();
 
-       std::pair<int, int> progress() const;
+       pair<int, int> progress() const;
 
        const QString& error() const;
 
@@ -76,9 +86,9 @@ public:
        void cancel();
 
 private:
-       void store_proc(std::vector< std::shared_ptr<data::SignalBase> > achannel_list,
-               std::vector< std::shared_ptr<pv::data::AnalogSegment> > asegment_list,
-               std::shared_ptr<pv::data::LogicSegment> lsegment);
+       void store_proc(vector< shared_ptr<data::SignalBase> > achannel_list,
+               vector< shared_ptr<pv::data::AnalogSegment> > asegment_list,
+               shared_ptr<pv::data::LogicSegment> lsegment);
 
 Q_SIGNALS:
        void progress_updated();
@@ -86,22 +96,22 @@ Q_SIGNALS:
        void store_successful();
 
 private:
-       const std::string file_name_;
-       const std::shared_ptr<sigrok::OutputFormat> output_format_;
-       const std::map<std::string, Glib::VariantBase> options_;
-       const std::pair<uint64_t, uint64_t> sample_range_;
+       const string file_name_;
+       const shared_ptr<sigrok::OutputFormat> output_format_;
+       const map<string, Glib::VariantBase> options_;
+       const pair<uint64_t, uint64_t> sample_range_;
        const Session &session_;
 
-       std::shared_ptr<sigrok::Output> output_;
-       std::ofstream output_stream_;
+       shared_ptr<sigrok::Output> output_;
+       ofstream output_stream_;
 
        std::thread thread_;
 
-       std::atomic<bool> interrupt_;
+       atomic<bool> interrupt_;
 
-       std::atomic<int> units_stored_, unit_count_;
+       atomic<int> units_stored_, unit_count_;
 
-       mutable std::mutex mutex_;
+       mutable mutex mutex_;
        QString error_;
 
        uint64_t start_sample_, sample_count_;
index 188786f1f1691019499e402a0c2ce425774d1fba..736ef80b1f4ffb9f64ffadbb574cb422eeafa512 100644 (file)
@@ -60,9 +60,12 @@ using std::cerr;
 using std::copy;
 using std::endl;
 using std::list;
+using std::make_pair;
 using std::map;
 using std::max;
 using std::min;
+using std::pair;
+using std::set;
 using std::shared_ptr;
 using std::string;
 using std::vector;
@@ -145,15 +148,15 @@ MainBar::MainBar(Session &session, QWidget *parent,
                session.device_manager().context());
        menu_file_export->setTitle(tr("&Export"));
        connect(menu_file_export,
-               SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
-               this, SLOT(export_file(std::shared_ptr<sigrok::OutputFormat>)));
+               SIGNAL(format_selected(shared_ptr<sigrok::OutputFormat>)),
+               this, SLOT(export_file(shared_ptr<sigrok::OutputFormat>)));
 
        widgets::ImportMenu *menu_file_import = new widgets::ImportMenu(this,
                session.device_manager().context());
        menu_file_import->setTitle(tr("&Import"));
        connect(menu_file_import,
-               SIGNAL(format_selected(std::shared_ptr<sigrok::InputFormat>)),
-               this, SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
+               SIGNAL(format_selected(shared_ptr<sigrok::InputFormat>)),
+               this, SLOT(import_file(shared_ptr<sigrok::InputFormat>)));
 
        action_connect_->setText(tr("&Connect to Device..."));
        connect(action_connect_, SIGNAL(triggered(bool)),
@@ -163,9 +166,9 @@ MainBar::MainBar(Session &session, QWidget *parent,
        widgets::ImportMenu *import_menu = new widgets::ImportMenu(this,
                session.device_manager().context(), action_open_);
        connect(import_menu,
-               SIGNAL(format_selected(std::shared_ptr<sigrok::InputFormat>)),
+               SIGNAL(format_selected(shared_ptr<sigrok::InputFormat>)),
                this,
-               SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
+               SLOT(import_file(shared_ptr<sigrok::InputFormat>)));
 
        open_button_->setMenu(import_menu);
        open_button_->setDefaultAction(action_open_);
@@ -180,9 +183,9 @@ MainBar::MainBar(Session &session, QWidget *parent,
                session.device_manager().context(),
                open_actions);
        connect(export_menu,
-               SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
+               SIGNAL(format_selected(shared_ptr<sigrok::OutputFormat>)),
                this,
-               SLOT(export_file(std::shared_ptr<sigrok::OutputFormat>)));
+               SLOT(export_file(shared_ptr<sigrok::OutputFormat>)));
 
        save_button_->setMenu(export_menu);
        save_button_->setDefaultAction(action_save_as_);
@@ -250,7 +253,6 @@ void MainBar::update_device_list()
        update_device_config_widgets();
 }
 
-
 void MainBar::set_capture_state(pv::Session::capture_state state)
 {
        bool ui_enabled = (state == pv::Session::Stopped) ? true : false;
@@ -293,7 +295,7 @@ void MainBar::update_sample_rate_selector()
        GVariant *gvar_list;
        const uint64_t *elements = nullptr;
        gsize num_elements;
-       map< const ConfigKey*, std::set<Capability> > keys;
+       map< const ConfigKey*, set<Capability> > keys;
 
        if (updating_sample_rate_) {
                sample_rate_.show_none();
@@ -592,7 +594,7 @@ void MainBar::export_file(shared_ptr<OutputFormat> format,
        QSettings settings;
        const QString dir = settings.value(SettingSaveDirectory).toString();
 
-       std::pair<uint64_t, uint64_t> sample_range;
+       pair<uint64_t, uint64_t> sample_range;
 
        // Selection only? Verify that the cursors are active and fetch their values
        if (selection_only) {
@@ -611,14 +613,14 @@ void MainBar::export_file(shared_ptr<OutputFormat> format,
                const pv::util::Timestamp& start_time = trace_view->cursors()->first()->time();
                const pv::util::Timestamp& end_time = trace_view->cursors()->second()->time();
 
-               const uint64_t start_sample = (uint64_t)std::max(
+               const uint64_t start_sample = (uint64_t)max(
                        (double)0, start_time.convert_to<double>() * samplerate);
-               const uint64_t end_sample = (uint64_t)std::max(
+               const uint64_t end_sample = (uint64_t)max(
                        (double)0, end_time.convert_to<double>() * samplerate);
 
-               sample_range = std::make_pair(start_sample, end_sample);
+               sample_range = make_pair(start_sample, end_sample);
        } else {
-               sample_range = std::make_pair(0, 0);
+               sample_range = make_pair(0, 0);
        }
 
        // Construct the filter
index 0242dc9da0ec73f184902b9570c40af6716aaf7c..0e58fbae8163842b0a80a267158a8466ef6d8715 100644 (file)
 #include <pv/widgets/popuptoolbutton.hpp>
 #include <pv/widgets/sweeptimingwidget.hpp>
 
+using std::shared_ptr;
+
 namespace sigrok {
 class Device;
 class InputFormat;
 class OutputFormat;
 }
 
-Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Device>)
+Q_DECLARE_METATYPE(shared_ptr<sigrok::Device>)
 
 class QAction;
 
@@ -126,9 +128,9 @@ private Q_SLOTS:
 
        void add_decoder(srd_decoder *decoder);
 
-       void export_file(std::shared_ptr<sigrok::OutputFormat> format,
+       void export_file(shared_ptr<sigrok::OutputFormat> format,
                bool selection_only = false);
-       void import_file(std::shared_ptr<sigrok::InputFormat> format);
+       void import_file(shared_ptr<sigrok::InputFormat> format);
 
        void on_device_selected();
        void on_device_changed();
index c25c373b3c23e15ff8178f06615087e0659cfd18..c5f9c832ef44be87034826df96fa7d79f42e9e03 100644 (file)
 #include <QTextStream>
 #include <QDebug>
 
+using std::fixed;
+using std::max;
+using std::ostringstream;
+using std::setfill;
+using std::setprecision;
+using std::showpos;
+using std::string;
+
 using namespace Qt;
 
 namespace pv {
@@ -82,18 +90,18 @@ static QTextStream& operator<<(QTextStream& stream, const Timestamp& t)
 
        int precision = stream.realNumberPrecision();
 
-       std::ostringstream ss;
-       ss << std::fixed;
+       ostringstream ss;
+       ss << fixed;
 
        if (stream.numberFlags() & QTextStream::ForceSign)
-               ss << std::showpos;
+               ss << showpos;
 
        if (0 == precision)
-               ss << std::setprecision(1) << round(t);
+               ss << setprecision(1) << round(t);
        else
-               ss << std::setprecision(precision) << t;
+               ss << setprecision(precision) << t;
 
-       std::string str(ss.str());
+       string str(ss.str());
        if (0 == precision) {
                // remove the separator and the unwanted decimal place
                str.resize(str.size() - 2);
@@ -157,7 +165,7 @@ QString format_time_si_adjusted(
 
        const unsigned int relative_prec =
                (prefix >= SIPrefix::none) ? precision :
-               std::max((int)(precision - prefix_order), 0);
+               max((int)(precision - prefix_order), 0);
 
        return format_time_si(t, prefix, relative_prec, unit, sign);
 }
@@ -212,13 +220,9 @@ QString format_time_minutes(const Timestamp& t, signed precision, bool sign)
 
                const Timestamp fraction = fabs(t) - whole_seconds;
 
-               std::ostringstream ss;
-               ss
-                       << std::fixed
-                       << std::setprecision(precision)
-                       << std::setfill('0')
-                       << fraction;
-               std::string fs = ss.str();
+               ostringstream ss;
+               ss << fixed << setprecision(precision) << setfill('0') << fraction;
+               string fs = ss.str();
 
                // Copy all digits, inserting spaces as unit separators
                for (int i = 1; i <= precision; i++) {
index c64d86afdf1fbcfaa45c377f8b762d6b7314ffb6..04f0a7fb84b97207b09a63f9143abe36293f54ae 100644 (file)
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
+using std::deque;
+using std::div;
+using std::div_t;
 using std::max;
 using std::make_pair;
 using std::min;
+using std::numeric_limits;
+using std::pair;
 using std::shared_ptr;
-using std::deque;
 
 namespace pv {
 namespace views {
@@ -125,7 +129,7 @@ void AnalogSignal::restore_settings(QSettings &settings)
                autoranging_ = settings.value("autoranging").toBool();
 }
 
-std::pair<int, int> AnalogSignal::v_extents() const
+pair<int, int> AnalogSignal::v_extents() const
 {
        const int ph = pos_vdivs_ * div_height_;
        const int nh = neg_vdivs_ * div_height_;
@@ -368,9 +372,8 @@ float AnalogSignal::get_resolution(int scale_index)
 {
        const float seq[] = {1.0f, 2.0f, 5.0f};
 
-       const int offset = std::numeric_limits<int>::max() / (2 * countof(seq));
-       const std::div_t d = std::div(
-               (int)(scale_index + countof(seq) * offset),
+       const int offset = numeric_limits<int>::max() / (2 * countof(seq));
+       const div_t d = div((int)(scale_index + countof(seq) * offset),
                countof(seq));
 
        return powf(10.0f, d.quot - offset) * seq[d.rem];
@@ -394,7 +397,7 @@ void AnalogSignal::perform_autoranging(bool force_update)
        double min = 0, max = 0;
 
        for (shared_ptr<pv::data::AnalogSegment> segment : segments) {
-               std::pair<double, double> mm = segment->get_min_max();
+               pair<double, double> mm = segment->get_min_max();
                min = std::min(min, mm.first);
                max = std::max(max, mm.second);
        }
index fa1058311f08a8f1ab906584ba65be2b75769983..a27f669681659f61c84cb7a7c737d00a5b17752a 100644 (file)
@@ -26,6 +26,9 @@
 
 #include <QComboBox>
 
+using std::pair;
+using std::shared_ptr;
+
 namespace pv {
 
 namespace data {
@@ -53,12 +56,11 @@ private:
        static const int InfoTextMarginRight, InfoTextMarginBottom;
 
 public:
-       AnalogSignal(pv::Session &session,
-               std::shared_ptr<data::SignalBase> base);
+       AnalogSignal(pv::Session &session, shared_ptr<data::SignalBase> base);
 
        virtual ~AnalogSignal() = default;
 
-       std::shared_ptr<pv::data::SignalData> data() const;
+       shared_ptr<pv::data::SignalData> data() const;
 
        virtual void save_settings(QSettings &settings) const;
 
@@ -68,7 +70,7 @@ public:
         * Computes the vertical extents of the contents of this row item.
         * @return A pair containing the minimum and maximum y-values.
         */
-       std::pair<int, int> v_extents() const;
+       pair<int, int> v_extents() const;
 
        /**
         * Returns the offset to show the drag handle.
@@ -111,12 +113,12 @@ private:
        void paint_grid(QPainter &p, int y, int left, int right);
 
        void paint_trace(QPainter &p,
-               const std::shared_ptr<pv::data::AnalogSegment> &segment,
+               const shared_ptr<pv::data::AnalogSegment> &segment,
                int y, int left, const int64_t start, const int64_t end,
                const double pixels_offset, const double samples_per_pixel);
 
        void paint_envelope(QPainter &p,
-               const std::shared_ptr<pv::data::AnalogSegment> &segment,
+               const shared_ptr<pv::data::AnalogSegment> &segment,
                int y, int left, const int64_t start, const int64_t end,
                const double pixels_offset, const double samples_per_pixel);
 
index 79a0c7f87167441df62456d1666a883afe3df694..e78920e2c3e8df29572fb1d7cd6e62e5b9033e97 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <QSizeF>
 
+using std::shared_ptr;
+
 class QPainter;
 
 namespace pv {
@@ -66,7 +68,7 @@ public:
        QRectF label_rect(const QRectF &rect) const;
 
 private:
-       std::shared_ptr<Cursor> get_other_cursor() const;
+       shared_ptr<Cursor> get_other_cursor() const;
 };
 
 } // namespace TraceView
index e63113c051b4befab10fda64751e5842bc67b058..458f5cac0af186f08f7c4b3fa47e851bb815a68e 100644 (file)
@@ -26,6 +26,9 @@
 
 #include <QPainter>
 
+using std::pair;
+using std::shared_ptr;
+
 class QPainter;
 
 namespace pv {
@@ -54,12 +57,12 @@ public:
        /**
         * Returns a pointer to the first cursor.
         */
-       std::shared_ptr<Cursor> first() const;
+       shared_ptr<Cursor> first() const;
 
        /**
         * Returns a pointer to the second cursor.
         */
-       std::shared_ptr<Cursor> second() const;
+       shared_ptr<Cursor> second() const;
 
        /**
         * Sets the time of the marker.
@@ -97,10 +100,10 @@ public:
 
        void compute_text_size(QPainter &p);
 
-       std::pair<float, float> get_cursor_offsets() const;
+       pair<float, float> get_cursor_offsets() const;
 
 private:
-       std::shared_ptr<Cursor> first_, second_;
+       shared_ptr<Cursor> first_, second_;
 
        QSizeF text_size_;
 };
index 164c7e5a6075fc719a9cc3e9c117e309ecf37ff8..c650ee1421d3dd5732887ff7a92a4bbf94d34615 100644 (file)
@@ -56,6 +56,8 @@ extern "C" {
 
 using boost::shared_lock;
 using boost::shared_mutex;
+
+using std::all_of;
 using std::dynamic_pointer_cast;
 using std::list;
 using std::lock_guard;
@@ -64,6 +66,7 @@ using std::max;
 using std::make_pair;
 using std::map;
 using std::min;
+using std::out_of_range;
 using std::pair;
 using std::shared_ptr;
 using std::make_shared;
@@ -137,8 +140,7 @@ DecodeTrace::DecodeTrace(pv::Session &session,
        delete_mapper_(this),
        show_hide_mapper_(this)
 {
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        // Determine shortest string we want to see displayed in full
        QFontMetrics m(QApplication::font());
@@ -160,7 +162,7 @@ bool DecodeTrace::enabled() const
        return true;
 }
 
-std::shared_ptr<data::SignalBase> DecodeTrace::base() const
+shared_ptr<data::SignalBase> DecodeTrace::base() const
 {
        return base_;
 }
@@ -185,8 +187,7 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
 {
        using namespace pv::data::decode;
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        const int text_height = ViewItemPaintParams::text_height();
        row_height_ = (text_height * 6) / 4;
@@ -217,7 +218,7 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
                int row_title_width;
                try {
                        row_title_width = row_title_widths_.at(row);
-               } catch (std::out_of_range) {
+               } catch (out_of_range) {
                        const int w = p.boundingRect(QRectF(), 0, row.title()).width() +
                                RowTitleMargin;
                        row_title_widths_[row] = w;
@@ -251,7 +252,7 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
                owner_->extents_changed(false, true);
 
        // Update the maximum row count if needed
-       max_visible_rows_ = std::max(max_visible_rows_, (int)visible_rows_.size());
+       max_visible_rows_ = max(max_visible_rows_, (int)visible_rows_.size());
 }
 
 void DecodeTrace::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
@@ -298,8 +299,7 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form)
 {
        using pv::data::decode::Decoder;
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        assert(form);
        assert(parent);
@@ -488,7 +488,7 @@ void DecodeTrace::draw_annotation_block(
        // Check if all annotations are of the same type (i.e. we can use one color)
        // or if we should use a neutral color (i.e. gray)
        const int format = annotations.front().format();
-       const bool single_format = std::all_of(
+       const bool single_format = all_of(
                annotations.begin(), annotations.end(),
                [&](const Annotation &a) { return a.format() == format; });
 
@@ -547,8 +547,8 @@ void DecodeTrace::draw_range(const pv::data::decode::Annotation &a, QPainter &p,
        const int ann_start = start + cap_width;
        const int ann_end = end - cap_width;
 
-       const int real_start = std::max(ann_start, pp.left() + row_title_width);
-       const int real_end = std::min(ann_end, pp.right());
+       const int real_start = max(ann_start, pp.left() + row_title_width);
+       const int real_end = min(ann_end, pp.right());
        const int real_width = real_end - real_start;
 
        QRectF rect(real_start, y - h / 2, real_width, h);
@@ -604,8 +604,7 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left,
 
        double samples_per_pixel, pixels_offset;
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        assert(decoder_stack);
 
@@ -659,8 +658,7 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left,
 
 pair<double, double> DecodeTrace::get_pixels_offset_samples_per_pixel() const
 {
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        assert(owner_);
        assert(decoder_stack);
@@ -732,8 +730,7 @@ const QString DecodeTrace::get_annotation_at_point(const QPoint &point)
 
        vector<pv::data::decode::Annotation> annotations;
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        assert(decoder_stack);
        decoder_stack->get_annotation_subset(annotations, visible_rows_[row],
@@ -841,8 +838,7 @@ void DecodeTrace::create_decoder_form(int index,
                channel_selectors_.push_back(s);
        }
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        // Add the options
        shared_ptr<binding::Decoder> binding(
@@ -864,7 +860,7 @@ QComboBox* DecodeTrace::create_channel_selector(
        const auto sigs(session_.signalbases());
 
        vector< shared_ptr<data::SignalBase> > sig_list(sigs.begin(), sigs.end());
-       std::sort(sig_list.begin(), sig_list.end(),
+       sort(sig_list.begin(), sig_list.end(),
                [](const shared_ptr<data::SignalBase> &a,
                const shared_ptr<data::SignalBase> &b) {
                        return strnatcasecmp(a->name().toStdString(),
@@ -924,8 +920,7 @@ void DecodeTrace::commit_decoder_channels(shared_ptr<data::decode::Decoder> &dec
 
 void DecodeTrace::commit_channels()
 {
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        assert(decoder_stack);
        for (shared_ptr<data::decode::Decoder> dec : decoder_stack->stack())
@@ -957,8 +952,7 @@ void DecodeTrace::on_channel_selected(int)
 
 void DecodeTrace::on_stack_decoder(srd_decoder *decoder)
 {
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        assert(decoder);
        assert(decoder_stack);
@@ -970,8 +964,7 @@ void DecodeTrace::on_stack_decoder(srd_decoder *decoder)
 
 void DecodeTrace::on_delete_decoder(int index)
 {
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        decoder_stack->remove(index);
 
@@ -985,8 +978,7 @@ void DecodeTrace::on_show_hide_decoder(int index)
 {
        using pv::data::decode::Decoder;
 
-       std::shared_ptr<pv::data::DecoderStack> decoder_stack =
-               base_->decoder_stack();
+       shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
 
        const list< shared_ptr<Decoder> > stack(decoder_stack->stack());
 
index 6d703ec5fe66906ebe69aebed1c575464a447436..3103a3c02ce4910556a68c1d28c96b976d797b47 100644 (file)
 #include <pv/data/signalbase.hpp>
 #include <pv/data/decode/row.hpp>
 
+using std::list;
+using std::map;
+using std::pair;
+using std::shared_ptr;
+using std::vector;
+
 struct srd_channel;
 struct srd_decoder;
 
@@ -68,7 +74,7 @@ private:
        struct ChannelSelector
        {
                const QComboBox *combo_;
-               const std::shared_ptr<pv::data::decode::Decoder> decoder_;
+               const shared_ptr<pv::data::decode::Decoder> decoder_;
                const srd_channel *pdch_;
        };
 
@@ -86,20 +92,20 @@ private:
        static const QColor OutlineColours[16];
 
 public:
-       DecodeTrace(pv::Session &session, std::shared_ptr<data::SignalBase> signalbase,
+       DecodeTrace(pv::Session &session, shared_ptr<data::SignalBase> signalbase,
                int index);
 
        bool enabled() const;
 
-       const std::shared_ptr<pv::data::DecoderStack>& decoder() const;
+       const shared_ptr<pv::data::DecoderStack>& decoder() const;
 
-       std::shared_ptr<data::SignalBase> base() const;
+       shared_ptr<data::SignalBase> base() const;
 
        /**
         * Computes the vertical extents of the contents of this row item.
         * @return A pair containing the minimum and maximum y-values.
         */
-       std::pair<int, int> v_extents() const;
+       pair<int, int> v_extents() const;
 
        /**
         * Paints the background layer of the trace with a QPainter
@@ -129,7 +135,7 @@ public:
        void delete_pressed();
 
 private:
-       void draw_annotations(std::vector<pv::data::decode::Annotation> annotations,
+       void draw_annotations(vector<pv::data::decode::Annotation> annotations,
                QPainter &p, int h, const ViewItemPaintParams &pp, int y,
                size_t base_colour, int row_title_width);
 
@@ -137,7 +143,7 @@ private:
                int h, const ViewItemPaintParams &pp, int y,
                size_t base_colour, int row_title_width) const;
 
-       void draw_annotation_block(std::vector<pv::data::decode::Annotation> annotations,
+       void draw_annotation_block(vector<pv::data::decode::Annotation> annotations,
                QPainter &p, int h, int y, size_t base_colour) const;
 
        void draw_instant(const pv::data::decode::Annotation &a, QPainter &p,
@@ -153,7 +159,7 @@ private:
        void draw_unresolved_period(QPainter &p, int h, int left,
                int right) const;
 
-       std::pair<double, double> get_pixels_offset_samples_per_pixel() const;
+       pair<double, double> get_pixels_offset_samples_per_pixel() const;
 
        /**
         * Determines the start and end sample for a given pixel range.
@@ -162,22 +168,22 @@ private:
         * @return Returns a pair containing the start sample and the end
         *      sample that correspond to the start and end coordinates.
         */
-       std::pair<uint64_t, uint64_t> get_sample_range(int x_start, int x_end) const;
+       pair<uint64_t, uint64_t> get_sample_range(int x_start, int x_end) const;
 
        int get_row_at_point(const QPoint &point);
 
        const QString get_annotation_at_point(const QPoint &point);
 
        void create_decoder_form(int index,
-               std::shared_ptr<pv::data::decode::Decoder> &dec,
+               shared_ptr<pv::data::decode::Decoder> &dec,
                QWidget *parent, QFormLayout *form);
 
        QComboBox* create_channel_selector(QWidget *parent,
-               const std::shared_ptr<pv::data::decode::Decoder> &dec,
+               const shared_ptr<pv::data::decode::Decoder> &dec,
                const srd_channel *const pdch);
 
        void commit_decoder_channels(
-               std::shared_ptr<data::decode::Decoder> &dec);
+               shared_ptr<data::decode::Decoder> &dec);
 
        void commit_channels();
 
@@ -200,16 +206,15 @@ private Q_SLOTS:
 private:
        pv::Session &session_;
 
-       std::vector<data::decode::Row> visible_rows_;
+       vector<data::decode::Row> visible_rows_;
        uint64_t decode_start_, decode_end_;
 
-       std::list< std::shared_ptr<pv::binding::Decoder> >
-               bindings_;
+       list< shared_ptr<pv::binding::Decoder> > bindings_;
 
-       std::list<ChannelSelector> channel_selectors_;
-       std::vector<pv::widgets::DecoderGroupBox*> decoder_forms_;
+       list<ChannelSelector> channel_selectors_;
+       vector<pv::widgets::DecoderGroupBox*> decoder_forms_;
 
-       std::map<data::decode::Row, int> row_title_widths_;
+       map<data::decode::Row, int> row_title_widths_;
        int row_height_, max_visible_rows_;
 
        int min_useful_label_width_;
index 95cee716de453e6e288a4b1a2b1cce807b52ee88..662a6d02d56df89ada5671e4d4b62fe61c8da967 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <pv/widgets/popup.hpp>
 
+using std::enable_shared_from_this;
 using std::shared_ptr;
 
 namespace pv {
@@ -45,7 +46,7 @@ Flag::Flag(View &view, const pv::util::Timestamp& time, const QString &text) :
 
 Flag::Flag(const Flag &flag) :
        TimeMarker(flag.view_, FillColour, flag.time_),
-       std::enable_shared_from_this<Flag>(flag)
+       enable_shared_from_this<Flag>(flag)
 {
 }
 
index 092a4b5a05966e7ec30126cd278fac9e99617d14..5dec187c4efa3035c1a36f0926d7225604b8a782 100644 (file)
 
 #include "timemarker.hpp"
 
+using std::enable_shared_from_this;
+
 class QMenu;
 
 namespace pv {
 namespace views {
 namespace TraceView {
 
-class Flag : public TimeMarker,
-       public std::enable_shared_from_this<Flag>
+class Flag : public TimeMarker, public enable_shared_from_this<Flag>
 {
        Q_OBJECT
 
index 8849ee3fed2beb4b7fe8e9ba1fcfd445412c41df..ad91cd12f8c5df760058f121e0c2c30302efd43e 100644 (file)
@@ -38,6 +38,8 @@
 #include <pv/widgets/popup.hpp>
 
 using boost::make_filter_iterator;
+
+using std::count_if;
 using std::dynamic_pointer_cast;
 using std::max;
 using std::make_pair;
@@ -138,8 +140,7 @@ void Header::contextMenuEvent(QContextMenuEvent *event)
 
        const vector< shared_ptr<TraceTreeItem> > items(
                view_.list_by_type<TraceTreeItem>());
-       if (std::count_if(items.begin(), items.end(), item_selected) > 1)
-       {
+       if (count_if(items.begin(), items.end(), item_selected) > 1) {
                menu->addSeparator();
 
                QAction *const group = new QAction(tr("Group"), this);
@@ -178,7 +179,7 @@ void Header::on_group()
 
        shared_ptr<TraceGroup> group(new TraceGroup());
        shared_ptr<TraceTreeItem> mouse_down_item(
-               std::dynamic_pointer_cast<TraceTreeItem>(mouse_down_item_));
+               dynamic_pointer_cast<TraceTreeItem>(mouse_down_item_));
        shared_ptr<TraceTreeItem> focus_item(
                mouse_down_item ? mouse_down_item : selected_items.front());
 
index f8462c288bb9cee53eecff4cbb3c9902105ba907..c6f81ae5e5b96a4fd32bcc56a4835bd20e2bc2ff 100644 (file)
@@ -26,6 +26,9 @@
 
 #include "marginwidget.hpp"
 
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 namespace views {
 namespace TraceView {
@@ -63,7 +66,7 @@ private:
        /**
         * Gets the row items.
         */
-       std::vector< std::shared_ptr<ViewItem> > items();
+       vector< shared_ptr<ViewItem> > items();
 
        /**
         * Gets the first view item which has a label that contains @c pt .
@@ -71,7 +74,7 @@ private:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       std::shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
+       shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
 
 private:
        void paintEvent(QPaintEvent *event);
index 251190ece03b789df3c568c99fdba35fe905affa..f78170b01a30a0028a95befaf7665e7d8a33e649 100644 (file)
@@ -46,6 +46,7 @@ using std::deque;
 using std::max;
 using std::make_pair;
 using std::min;
+using std::none_of;
 using std::pair;
 using std::shared_ptr;
 using std::vector;
@@ -136,7 +137,7 @@ shared_ptr<pv::data::Logic> LogicSignal::logic_data() const
        return base_->logic_data();
 }
 
-std::pair<int, int> LogicSignal::v_extents() const
+pair<int, int> LogicSignal::v_extents() const
 {
        const int signal_margin =
                QFontMetrics(QApplication::font()).height() / 2;
@@ -446,7 +447,7 @@ void LogicSignal::modify_trigger()
        if (trigger) {
                for (auto stage : trigger->stages()) {
                        const auto &matches = stage->matches();
-                       if (std::none_of(matches.begin(), matches.end(),
+                       if (none_of(matches.begin(), matches.end(),
                            [&](shared_ptr<TriggerMatch> match) {
                                        return match->channel() != base_->channel(); }))
                                continue;
index cd4f0e232f9fd5131f40306ad2dedbb94ff99fad..417530cb5e08319db34be176ee614545a8b2daad 100644 (file)
 
 #include <memory>
 
+using std::pair;
+using std::shared_ptr;
+using std::vector;
+
 class QIcon;
 class QToolBar;
 
@@ -66,20 +70,20 @@ private:
 
 public:
        LogicSignal(pv::Session &session,
-               std::shared_ptr<devices::Device> device,
-               std::shared_ptr<data::SignalBase> base);
+               shared_ptr<devices::Device> device,
+               shared_ptr<data::SignalBase> base);
 
        virtual ~LogicSignal() = default;
 
-       std::shared_ptr<pv::data::SignalData> data() const;
+       shared_ptr<pv::data::SignalData> data() const;
 
-       std::shared_ptr<pv::data::Logic> logic_data() const;
+       shared_ptr<pv::data::Logic> logic_data() const;
 
        /**
         * Computes the vertical extents of the contents of this row item.
         * @return A pair containing the minimum and maximum y-values.
         */
-       std::pair<int, int> v_extents() const;
+       pair<int, int> v_extents() const;
 
        /**
         * Returns the offset to show the drag handle.
@@ -108,13 +112,13 @@ public:
 
 private:
        void paint_caps(QPainter &p, QLineF *const lines,
-               std::vector< std::pair<int64_t, bool> > &edges,
+               vector< pair<int64_t, bool> > &edges,
                bool level, double samples_per_pixel, double pixels_offset,
                float x_offset, float y_offset);
 
        void init_trigger_actions(QWidget *parent);
 
-       const std::vector<int32_t> get_trigger_types() const;
+       const vector<int32_t> get_trigger_types() const;
        QAction* action_from_trigger_type(
                const sigrok::TriggerMatchType *type);
        const sigrok::TriggerMatchType* trigger_type_from_action(
@@ -131,7 +135,7 @@ private Q_SLOTS:
 private:
        int signal_height_;
 
-       std::shared_ptr<pv::devices::Device> device_;
+       shared_ptr<pv::devices::Device> device_;
 
        const sigrok::TriggerMatchType *trigger_match_;
        QToolBar *trigger_bar_;
index 1f87776197e61bd52f2248d1befe6b7294b06d21..ebe8cfc08b780ce06f3d4697d1ef277f6d2100c7 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "viewwidget.hpp"
 
+using std::shared_ptr;
+
 namespace pv {
 namespace views {
 namespace TraceView {
@@ -51,14 +53,13 @@ protected:
         * Indicates the event an a view item has been clicked.
         * @param item the view item that has been clicked.
         */
-       virtual void item_clicked(
-               const std::shared_ptr<ViewItem> &item);
+       virtual void item_clicked(const shared_ptr<ViewItem> &item);
 
        /**
         * Shows the popup of a the specified @c ViewItem .
         * @param item The item to show the popup for.
         */
-       void show_popup(const std::shared_ptr<ViewItem> &item);
+       void show_popup(const shared_ptr<ViewItem> &item);
 
 protected:
        virtual void contextMenuEvent(QContextMenuEvent *event);
index be715ec104385576b3c66042325e51ddc14d982a..712244a9df8cc9a4399d80217ac413467abd0f5d 100644 (file)
@@ -28,6 +28,7 @@
 
 using namespace Qt;
 
+using std::function;
 using std::shared_ptr;
 using std::vector;
 
@@ -70,7 +71,7 @@ QSize Ruler::sizeHint() const
 QSize Ruler::extended_size_hint() const
 {
        QRectF max_rect;
-       std::vector< std::shared_ptr<TimeItem> > items(view_.time_items());
+       vector< shared_ptr<TimeItem> > items(view_.time_items());
        for (auto &i : items)
                max_rect = max_rect.united(i->label_rect(QRect()));
        return QSize(0, sizeHint().height() - max_rect.top() / 2 +
@@ -193,7 +194,7 @@ Ruler::TickPositions Ruler::calculate_tick_positions(
        const pv::util::Timestamp& offset,
        const double scale,
        const int width,
-       std::function<QString(const pv::util::Timestamp&)> format_function)
+       function<QString(const pv::util::Timestamp&)> format_function)
 {
        TickPositions tp;
 
index c8cb0e5f66fc364e7ab1f1acd8bd58b623fc0d9b..192de791fcb79ad86c9a37eb09b3f48128eeec89 100644 (file)
 #include "marginwidget.hpp"
 #include <pv/util.hpp>
 
+using std::function;
+using std::pair;
+using std::shared_ptr;
+using std::vector;
+
 namespace RulerTest {
 struct tick_position_test_0;
 struct tick_position_test_1;
@@ -109,7 +114,7 @@ private:
        /**
         * Gets the time items.
         */
-       std::vector< std::shared_ptr<ViewItem> > items() override;
+       vector< shared_ptr<ViewItem> > items() override;
 
        /**
         * Gets the first view item which has a label that contains @c pt .
@@ -117,8 +122,7 @@ private:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       std::shared_ptr<ViewItem> get_mouse_over_item(
-               const QPoint &pt) override;
+       shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt) override;
 
        void paintEvent(QPaintEvent *event) override;
 
@@ -135,8 +139,8 @@ private:
 
        struct TickPositions
        {
-               std::vector<std::pair<double, QString>> major;
-               std::vector<double> minor;
+               vector<pair<double, QString>> major;
+               vector<double> minor;
        };
 
        /**
@@ -162,7 +166,7 @@ private:
                const pv::util::Timestamp& offset,
                const double scale,
                const int width,
-               std::function<QString(const pv::util::Timestamp&)> format_function);
+               function<QString(const pv::util::Timestamp&)> format_function);
 
 protected:
        void resizeEvent(QResizeEvent*) override;
index a74831a6b7c2c1e404e21e0b10b4a0788177c71c..065715aa7a996fd0c01f7aaf3763788a95f0658e 100644 (file)
@@ -60,7 +60,7 @@ const char *const ChannelNames[] = {
 };
 
 Signal::Signal(pv::Session &session,
-       std::shared_ptr<data::SignalBase> channel) :
+       shared_ptr<data::SignalBase> channel) :
        Trace(channel),
        session_(session),
        scale_handle_(make_shared<SignalScaleHandle>(*this)),
index 8796660e175fd4ce84d779afbeb660889681ee0f..82d3b51fc4a5209610ca43dbd88069da6b258131 100644 (file)
@@ -31,6 +31,8 @@
 #include "trace.hpp"
 #include "viewitemowner.hpp"
 
+using std::shared_ptr;
+
 namespace pv {
 
 class Session;
@@ -48,8 +50,7 @@ class Signal : public Trace, public ViewItemOwner
        Q_OBJECT
 
 protected:
-       Signal(pv::Session &session,
-               std::shared_ptr<data::SignalBase> channel);
+       Signal(pv::Session &session, shared_ptr<data::SignalBase> channel);
 
 public:
        /**
@@ -57,14 +58,14 @@ public:
         */
        virtual void set_name(QString name);
 
-       virtual std::shared_ptr<pv::data::SignalData> data() const = 0;
+       virtual shared_ptr<pv::data::SignalData> data() const = 0;
 
        /**
         * Returns true if the trace is visible and enabled.
         */
        bool enabled() const;
 
-       std::shared_ptr<data::SignalBase> base() const;
+       shared_ptr<data::SignalBase> base() const;
 
        virtual void save_settings(QSettings &settings) const;
 
@@ -109,7 +110,7 @@ protected Q_SLOTS:
 protected:
        pv::Session &session_;
 
-       const std::shared_ptr<SignalScaleHandle> scale_handle_;
+       const shared_ptr<SignalScaleHandle> scale_handle_;
        const item_list items_;
 
        QComboBox *name_widget_;
index 0ca1359138d89317f4c630f6cda71d242c50bc34..0d4a4536171aacd99082465740deabe66f957793 100644 (file)
@@ -35,6 +35,9 @@
 #include "pv/widgets/colourbutton.hpp"
 #include "pv/widgets/popup.hpp"
 
+using std::pair;
+using std::shared_ptr;
+
 namespace pv {
 namespace views {
 namespace TraceView {
@@ -45,7 +48,7 @@ const int Trace::LabelHitPadding = 2;
 const QColor Trace::BrightGrayBGColour = QColor(0, 0, 0, 10*255/100);
 const QColor Trace::DarkGrayBGColour = QColor(0, 0, 0, 15*255/100);
 
-Trace::Trace(std::shared_ptr<data::SignalBase> channel) :
+Trace::Trace(shared_ptr<data::SignalBase> channel) :
        base_(channel),
        popup_(nullptr),
        popup_form_(nullptr)
@@ -166,7 +169,7 @@ void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
 
        p.setPen(QPen(Qt::NoPen));
 
-       const std::pair<int, int> extents = v_extents();
+       const pair<int, int> extents = v_extents();
 
        const int x = 0;
        const int y = get_visual_y() + extents.first;
index 11f80ccbeb6426b0d163eecd7a2b8f36d20a7a7a..ac4540c91c1c3528aed7d5fa25a93cde30f8acf2 100644 (file)
@@ -32,6 +32,8 @@
 
 #include "pv/data/signalbase.hpp"
 
+using std::shared_ptr;
+
 class QFormLayout;
 
 namespace pv {
@@ -55,7 +57,7 @@ private:
        static const QColor DarkGrayBGColour;
 
 protected:
-       Trace(std::shared_ptr<data::SignalBase> channel);
+       Trace(shared_ptr<data::SignalBase> channel);
 
 public:
        /**
@@ -127,7 +129,7 @@ private Q_SLOTS:
        void on_colouredit_changed(const QColor &colour);
 
 protected:
-       std::shared_ptr<data::SignalBase> base_;
+       shared_ptr<data::SignalBase> base_;
        bool coloured_bg_, coloured_bg_state_;
 
 private:
index 490f39c5457187a0c808cc32684abb25f8fcb3d9..5b59eab94e8d3c3851ebac36f9e01e795d78a707 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "tracegroup.hpp"
 
+using std::any_of;
 using std::pair;
 using std::shared_ptr;
 using std::vector;
@@ -48,7 +49,7 @@ TraceGroup::~TraceGroup()
 
 bool TraceGroup::enabled() const
 {
-       return std::any_of(child_items().begin(), child_items().end(),
+       return any_of(child_items().begin(), child_items().end(),
                [](const shared_ptr<ViewItem> &r) { return r->enabled(); });
 }
 
index 80fc5fc00ccd46ac848e4a18478ddca3034e2a38..b00d5bf5a06faf3ed131ecc2805f3ce13ee07736 100644 (file)
@@ -23,6 +23,8 @@
 #include "tracetreeitem.hpp"
 #include "tracetreeitemowner.hpp"
 
+using std::pair;
+
 namespace pv {
 namespace views {
 namespace TraceView {
@@ -72,7 +74,7 @@ public:
         * Computes the vertical extents of the contents of this row item.
         * @return A pair containing the minimum and maximum y-values.
         */
-       std::pair<int, int> v_extents() const;
+       pair<int, int> v_extents() const;
 
        /**
         * Paints the signal label.
index cc329121ffcebdf842348c1903ad2b3e190b5f8e..d1dd67ccfc7bcbb2ca464f432a770025e1af3af9 100644 (file)
@@ -26,6 +26,9 @@
 
 #include "rowitem.hpp"
 
+using std::enable_shared_from_this;
+using std::pair;
+
 namespace pv {
 namespace views {
 namespace TraceView {
@@ -33,7 +36,7 @@ namespace TraceView {
 class TraceTreeItemOwner;
 
 class TraceTreeItem : public RowItem,
-       public std::enable_shared_from_this<TraceTreeItem>
+       public enable_shared_from_this<TraceTreeItem>
 {
        Q_OBJECT
        Q_PROPERTY(int visual_v_offset
@@ -122,7 +125,7 @@ public:
         * Computes the vertical extents of the contents of this row item.
         * @return A pair containing the minimum and maximum y-values.
         */
-       virtual std::pair<int, int> v_extents() const = 0;
+       virtual pair<int, int> v_extents() const = 0;
 
 protected:
        TraceTreeItemOwner *owner_;
index b570c0386c3ef556e4e9cd41927749e212fcb5b6..c87619524574e02f7039ae60b4d8434a592d74f6 100644 (file)
@@ -24,8 +24,9 @@
 #include "trace.hpp"
 
 using std::dynamic_pointer_cast;
-using std::max;
+using std::find;
 using std::make_pair;
+using std::max;
 using std::min;
 using std::pair;
 using std::set;
@@ -42,7 +43,7 @@ const ViewItemOwner::item_list& TraceTreeItemOwner::child_items() const
        return items_;
 }
 
-vector< std::shared_ptr<TraceTreeItem> >
+vector< shared_ptr<TraceTreeItem> >
 TraceTreeItemOwner::trace_tree_child_items() const
 {
        vector< shared_ptr<TraceTreeItem> > items;
@@ -65,7 +66,7 @@ void TraceTreeItemOwner::clear_child_items()
        items_.clear();
 }
 
-void TraceTreeItemOwner::add_child_item(std::shared_ptr<TraceTreeItem> item)
+void TraceTreeItemOwner::add_child_item(shared_ptr<TraceTreeItem> item)
 {
        assert(!item->owner());
        item->set_owner(this);
@@ -74,11 +75,11 @@ void TraceTreeItemOwner::add_child_item(std::shared_ptr<TraceTreeItem> item)
        extents_changed(true, true);
 }
 
-void TraceTreeItemOwner::remove_child_item(std::shared_ptr<TraceTreeItem> item)
+void TraceTreeItemOwner::remove_child_item(shared_ptr<TraceTreeItem> item)
 {
        assert(item->owner() == this);
        item->set_owner(nullptr);
-       auto iter = std::find(items_.begin(), items_.end(), item);
+       auto iter = find(items_.begin(), items_.end(), item);
        assert(iter != items_.end());
        items_.erase(iter);
 
index 6beae5e9003efc94ce080b0280af807a7f73c585..92aae37f5590b12a5080083c2f3dbba73815106a 100644 (file)
 #include "viewitemowner.hpp"
 #include "tracetreeitem.hpp"
 
+using std::pair;
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 
 class Session;
@@ -71,7 +75,7 @@ public:
        /**
         * Returns a list of row items owned by this object.
         */
-       std::vector< std::shared_ptr<TraceTreeItem> >
+       vector< shared_ptr<TraceTreeItem> >
        trace_tree_child_items() const;
 
        /**
@@ -82,12 +86,12 @@ public:
        /**
         * Adds a child item to this object.
         */
-       void add_child_item(std::shared_ptr<TraceTreeItem> item);
+       void add_child_item(shared_ptr<TraceTreeItem> item);
 
        /**
         * Removes a child item from this object.
         */
-       void remove_child_item(std::shared_ptr<TraceTreeItem> item);
+       void remove_child_item(shared_ptr<TraceTreeItem> item);
 
        virtual void restack_items();
 
@@ -95,7 +99,7 @@ public:
         * Computes the vertical extents of the contents of this row item owner.
         * @return A pair containing the minimum and maximum y-values.
         */
-       std::pair<int, int> v_extents() const;
+       pair<int, int> v_extents() const;
 
        /*
         * Reassigns background color states to all its children, thereby
index 07e97666a2e60e59acd4309b17f294a28df37609..ae37b912ca984c0d13f2ff371bfe53e5baa5fb3c 100644 (file)
@@ -77,6 +77,7 @@ using pv::util::Timestamp;
 
 using std::back_inserter;
 using std::copy_if;
+using std::count_if;
 using std::deque;
 using std::dynamic_pointer_cast;
 using std::inserter;
@@ -90,6 +91,7 @@ using std::pair;
 using std::set;
 using std::set_difference;
 using std::shared_ptr;
+using std::stringstream;
 using std::unordered_map;
 using std::unordered_set;
 using std::vector;
@@ -224,7 +226,7 @@ const Session& View::session() const
        return session_;
 }
 
-std::unordered_set< std::shared_ptr<Signal> > View::signals() const
+unordered_set< shared_ptr<Signal> > View::signals() const
 {
        return signals_;
 }
@@ -289,7 +291,7 @@ void View::save_settings(QSettings &settings) const
        settings.setValue("v_offset",
                scrollarea_.verticalScrollBar()->sliderPosition());
 
-       std::stringstream ss;
+       stringstream ss;
        boost::archive::text_oarchive oa(ss);
        oa << boost::serialization::make_nvp("offset", offset_);
        settings.setValue("offset", QString::fromStdString(ss.str()));
@@ -311,7 +313,7 @@ void View::restore_settings(QSettings &settings)
 
        if (settings.contains("offset")) {
                util::Timestamp offset;
-               std::stringstream ss;
+               stringstream ss;
                ss << settings.value("offset").toString().toStdString();
 
                boost::archive::text_iarchive ia(ss);
@@ -617,7 +619,7 @@ void View::centre_cursors()
        viewport_->update();
 }
 
-std::shared_ptr<CursorPair> View::cursors() const
+shared_ptr<CursorPair> View::cursors() const
 {
        return cursors_;
 }
@@ -633,15 +635,15 @@ void View::add_flag(const Timestamp& time)
        time_item_appearance_changed(true, true);
 }
 
-void View::remove_flag(std::shared_ptr<Flag> flag)
+void View::remove_flag(shared_ptr<Flag> flag)
 {
        flags_.remove(flag);
        time_item_appearance_changed(true, true);
 }
 
-vector< std::shared_ptr<Flag> > View::flags() const
+vector< shared_ptr<Flag> > View::flags() const
 {
-       vector< std::shared_ptr<Flag> > flags(flags_.begin(), flags_.end());
+       vector< shared_ptr<Flag> > flags(flags_.begin(), flags_.end());
        stable_sort(flags.begin(), flags.end(),
                [](const shared_ptr<Flag> &a, const shared_ptr<Flag> &b) {
                        return a->time() < b->time();
@@ -755,7 +757,7 @@ void View::calculate_tick_spacing()
 
                // Precision is the number of fractional digits required, not
                // taking the prefix into account (and it must never be negative)
-               tick_precision = std::max(ceil(log10(1 / tick_period)).convert_to<int>(), 0);
+               tick_precision = max(ceil(log10(1 / tick_period)).convert_to<int>(), 0);
 
                tick_period_width = (tick_period / scale_).convert_to<double>();
 
@@ -887,7 +889,7 @@ TraceTreeItemOwner* View::find_prevalent_trace_group(
        size_t max_prevalence = 0;
        TraceTreeItemOwner *prevalent_owner = nullptr;
        for (TraceTreeItemOwner *owner : owners) {
-               const size_t prevalence = std::count_if(
+               const size_t prevalence = count_if(
                        owner_list.begin(), owner_list.end(),
                        [&](TraceTreeItemOwner *o) { return o == owner; });
                if (prevalence > max_prevalence) {
index 2ba157d8c5ea9cedecca3338c86908855ca215c0..e083fa13fdc1899d31da1ad6fe5978ebc2bb5483 100644 (file)
 #include "flag.hpp"
 #include "tracetreeitemowner.hpp"
 
+using std::list;
+using std::unordered_map;
+using std::unordered_set;
+using std::set;
+using std::shared_ptr;
+using std::vector;
+
 namespace sigrok {
 class ChannelGroup;
 }
@@ -97,18 +104,18 @@ public:
        /**
         * Returns the signals contained in this view.
         */
-       std::unordered_set< std::shared_ptr<Signal> > signals() const;
+       unordered_set< shared_ptr<Signal> > signals() const;
 
        virtual void clear_signals();
 
-       virtual void add_signal(const std::shared_ptr<Signal> signal);
+       virtual void add_signal(const shared_ptr<Signal> signal);
 
 #ifdef ENABLE_DECODE
        virtual void clear_decode_signals();
 
-       virtual void add_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+       virtual void add_decode_signal(shared_ptr<data::SignalBase> signalbase);
 
-       virtual void remove_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+       virtual void remove_decode_signal(shared_ptr<data::SignalBase> signalbase);
 #endif
 
        /**
@@ -132,7 +139,7 @@ public:
        /**
         * Gets a list of time markers.
         */
-       std::vector< std::shared_ptr<TimeItem> > time_items() const;
+       vector< shared_ptr<TimeItem> > time_items() const;
 
        /**
         * Returns the view time scale in seconds per pixel.
@@ -194,10 +201,9 @@ public:
         */
        void set_scale_offset(double scale, const pv::util::Timestamp& offset);
 
-       std::set< std::shared_ptr<pv::data::SignalData> >
-               get_visible_data() const;
+       set< shared_ptr<pv::data::SignalData> > get_visible_data() const;
 
-       std::pair<pv::util::Timestamp, pv::util::Timestamp> get_time_extents() const;
+       pair<pv::util::Timestamp, pv::util::Timestamp> get_time_extents() const;
 
        /**
         * Enables or disables coloured trace backgrounds. If they're not
@@ -228,7 +234,7 @@ public:
        /**
         * Returns a reference to the pair of cursors.
         */
-       std::shared_ptr<CursorPair> cursors() const;
+       shared_ptr<CursorPair> cursors() const;
 
        /**
         * Adds a new flag at a specified time.
@@ -238,12 +244,12 @@ public:
        /**
         * Removes a flag from the list.
         */
-       void remove_flag(std::shared_ptr<Flag> flag);
+       void remove_flag(shared_ptr<Flag> flag);
 
        /**
         * Gets the list of flags.
         */
-       std::vector< std::shared_ptr<Flag> > flags() const;
+       vector< shared_ptr<Flag> > flags() const;
 
        const QPoint& hover_point() const;
 
@@ -305,16 +311,16 @@ private:
        void update_layout();
 
        TraceTreeItemOwner* find_prevalent_trace_group(
-               const std::shared_ptr<sigrok::ChannelGroup> &group,
-               const std::unordered_map<std::shared_ptr<data::SignalBase>,
-                       std::shared_ptr<Signal> > &signal_map);
+               const shared_ptr<sigrok::ChannelGroup> &group,
+               const unordered_map<shared_ptr<data::SignalBase>,
+                       shared_ptr<Signal> > &signal_map);
 
-       static std::vector< std::shared_ptr<Trace> >
+       static vector< shared_ptr<Trace> >
                extract_new_traces_for_channels(
-               const std::vector< std::shared_ptr<sigrok::Channel> > &channels,
-               const std::unordered_map<std::shared_ptr<data::SignalBase>,
-                       std::shared_ptr<Signal> > &signal_map,
-               std::set< std::shared_ptr<Trace> > &add_list);
+               const vector< shared_ptr<sigrok::Channel> > &channels,
+               const unordered_map<shared_ptr<data::SignalBase>,
+                       shared_ptr<Signal> > &signal_map,
+               set< shared_ptr<Trace> > &add_list);
 
        void determine_time_unit();
 
@@ -384,10 +390,10 @@ private:
        Ruler *ruler_;
        Header *header_;
 
-       std::unordered_set< std::shared_ptr<Signal> > signals_;
+       unordered_set< shared_ptr<Signal> > signals_;
 
 #ifdef ENABLE_DECODE
-       std::vector< std::shared_ptr<DecodeTrace> > decode_traces_;
+       vector< shared_ptr<DecodeTrace> > decode_traces_;
 #endif
 
        CustomAbstractScrollArea scrollarea_;
@@ -410,12 +416,12 @@ private:
        util::TimeUnit time_unit_;
 
        bool show_cursors_;
-       std::shared_ptr<CursorPair> cursors_;
+       shared_ptr<CursorPair> cursors_;
 
-       std::list< std::shared_ptr<Flag> > flags_;
+       list< shared_ptr<Flag> > flags_;
        char next_flag_text_;
 
-       std::vector< std::shared_ptr<TriggerMarker> > trigger_markers_;
+       vector< shared_ptr<TriggerMarker> > trigger_markers_;
 
        QPoint hover_point_;
 
index c4c6f2afd7923c60e0948a02af4a1128458a8d60..91ace4e90d9c710e84219572650d2f8e045f8ab8 100644 (file)
 
 #include <pv/session.hpp>
 
+using std::dynamic_pointer_cast;
+using std::forward_iterator_tag;
+using std::shared_ptr;
+using std::stack;
+
 namespace pv {
 namespace views {
 namespace TraceView {
@@ -38,11 +43,11 @@ template<class Owner, class Item> class ViewItemIterator
 {
 public:
        typedef typename Owner::item_list::const_iterator child_iterator;
-       typedef std::shared_ptr<Item> value_type;
+       typedef shared_ptr<Item> value_type;
        typedef ptrdiff_t difference_type;
        typedef value_type pointer;
        typedef const value_type& reference;
-       typedef std::forward_iterator_tag iterator_category;
+       typedef forward_iterator_tag iterator_category;
 
 public:
        ViewItemIterator(Owner *owner) :
@@ -68,9 +73,6 @@ public:
        }
 
        ViewItemIterator<Owner, Item>& operator++() {
-               using std::dynamic_pointer_cast;
-               using std::shared_ptr;
-
                assert(!owner_stack_.empty());
                assert(!iter_stack_.empty());
 
@@ -113,8 +115,8 @@ public:
        }
 
 private:
-       std::stack<Owner*> owner_stack_;
-       std::stack<child_iterator> iter_stack_;
+       stack<Owner*> owner_stack_;
+       stack<child_iterator> iter_stack_;
 };
 
 template<class Owner, class Item>
index 877c96813ff2464fc5191b1e141df29ff601333f..dcec370f3fcd18afabfceba48dbc49dbe9fd10a5 100644 (file)
 
 #include "viewitemiterator.hpp"
 
+using std::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 
 class Session;
@@ -38,7 +42,7 @@ class View;
 class ViewItemOwner
 {
 public:
-       typedef std::vector< std::shared_ptr<ViewItem> > item_list;
+       typedef vector< shared_ptr<ViewItem> > item_list;
        typedef ViewItemIterator<ViewItemOwner, ViewItem> iterator;
        typedef ViewItemIterator<const ViewItemOwner, ViewItem> const_iterator;
 
@@ -75,10 +79,10 @@ public:
         * Creates a list of descendant signals filtered by type.
         */
        template<class T>
-       std::vector< std::shared_ptr<T> > list_by_type() {
-               std::vector< std::shared_ptr<T> > items;
+       vector< shared_ptr<T> > list_by_type() {
+               vector< shared_ptr<T> > items;
                for (const auto &r : *this) {
-                       std::shared_ptr<T> p = std::dynamic_pointer_cast<T>(r);
+                       shared_ptr<T> p = dynamic_pointer_cast<T>(r);
                        if (p)
                                items.push_back(p);
                }
index 1504f482ca3915d605ff9a09d66e6c1584ab7362..2d10f2a054fadb31dc47783d3395460c54fb2c0a 100644 (file)
@@ -102,7 +102,7 @@ void Viewport::drag_release()
 vector< shared_ptr<ViewItem> > Viewport::items()
 {
        vector< shared_ptr<ViewItem> > items;
-       const std::vector< shared_ptr<ViewItem> > view_items(
+       const vector< shared_ptr<ViewItem> > view_items(
                view_.list_by_type<ViewItem>());
        copy(view_items.begin(), view_items.end(), back_inserter(items));
        const vector< shared_ptr<TimeItem> > time_items(view_.time_items());
index 555d8f5505d5cb485d829bd245928578c4708e15..de3e681dcf60a38cfa9e22a070e31e5e6a9e9f32 100644 (file)
@@ -28,6 +28,9 @@
 #include "pv/util.hpp"
 #include "viewwidget.hpp"
 
+using std::shared_ptr;
+using std::vector;
+
 class QPainter;
 class QPaintEvent;
 class Session;
@@ -51,7 +54,7 @@ private:
         * @param item The item that is being hovered over, or @c nullptr
         * if no view item is being hovered over.
         */
-       void item_hover(const std::shared_ptr<ViewItem> &item);
+       void item_hover(const shared_ptr<ViewItem> &item);
 
        /**
         * Gets the first view item which has a hit-box that contains @c pt .
@@ -59,7 +62,7 @@ private:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       std::shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
+       shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
 
        /**
         * Sets this item into the dragged state.
@@ -80,7 +83,7 @@ private:
        /**
         * Gets the items in the view widget.
         */
-       std::vector< std::shared_ptr<ViewItem> > items();
+       vector< shared_ptr<ViewItem> > items();
 
        /**
         * Handles touch begin update and end events.
index 364ed02a111240f169f44bded63cabc1b742f57d..02c842a84b8f592cdbb340b66e012df568468b85 100644 (file)
@@ -24,6 +24,9 @@
 
 #include <QWidget>
 
+using std::shared_ptr;
+using std::vector;
+
 class QTouchEvent;
 
 namespace pv {
@@ -46,16 +49,14 @@ protected:
         * if no view item is being hovered over.
         * @remarks the default implementation does nothing.
         */
-       virtual void item_hover(
-               const std::shared_ptr<ViewItem> &item);
+       virtual void item_hover(const shared_ptr<ViewItem> &item);
 
        /**
         * Indicates the event an a view item has been clicked.
         * @param item the view item that has been clicked.
         * @remarks the default implementation does nothing.
         */
-       virtual void item_clicked(
-               const std::shared_ptr<ViewItem> &item);
+       virtual void item_clicked(const shared_ptr<ViewItem> &item);
 
        /**
         * Returns true if the selection of row items allows dragging.
@@ -94,7 +95,7 @@ protected:
        /**
         * Gets the items in the view widget.
         */
-       virtual std::vector< std::shared_ptr<ViewItem> > items() = 0;
+       virtual vector< shared_ptr<ViewItem> > items() = 0;
 
        /**
         * Gets the first view item which has a hit-box that contains @c pt .
@@ -102,8 +103,7 @@ protected:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       virtual std::shared_ptr<ViewItem> get_mouse_over_item(
-               const QPoint &pt) = 0;
+       virtual shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt) = 0;
 
        /**
         * Handles left mouse button press events.
@@ -142,7 +142,7 @@ protected:
        pv::views::TraceView::View &view_;
        QPoint mouse_point_;
        QPoint mouse_down_point_;
-       std::shared_ptr<ViewItem> mouse_down_item_;
+       shared_ptr<ViewItem> mouse_down_item_;
        bool item_dragging_;
 };
 
index 3e180830f897574de522b460cf775f43a264361e..f83187e56e73eaf514d2ef2073f85f6d963efdcd 100644 (file)
@@ -32,6 +32,8 @@
 #include <pv/data/signalbase.hpp>
 #include <pv/util.hpp>
 
+using std::shared_ptr;
+
 namespace pv {
 
 class Session;
@@ -62,9 +64,9 @@ public:
 #ifdef ENABLE_DECODE
        virtual void clear_decode_signals();
 
-       virtual void add_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+       virtual void add_decode_signal(shared_ptr<data::SignalBase> signalbase);
 
-       virtual void remove_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+       virtual void remove_decode_signal(shared_ptr<data::SignalBase> signalbase);
 #endif
 
        virtual void save_settings(QSettings &settings) const;
index cedf49e78386d58482e42b6ac98c439ab89c5b98..46b2240a0fc90c60c919f3c74053a6fd24ed522b 100644 (file)
 #include <QSignalMapper>
 #include <QToolButton>
 
+using std::list;
+using std::shared_ptr;
+using std::vector;
+using std::weak_ptr;
+
 struct srd_decoder;
 
 namespace pv {
@@ -58,7 +63,7 @@ public:
        /**
         * Returns a reference to the selected device.
         */
-       std::shared_ptr<devices::Device> selected_device();
+       shared_ptr<devices::Device> selected_device();
 
        /**
         * Sets the current list of devices.
@@ -66,8 +71,8 @@ public:
         * @param selected_device the currently active device.
         */
        void set_device_list(
-               const std::list< std::shared_ptr<devices::Device> > &devices,
-               std::shared_ptr<devices::Device> selected);
+               const list< shared_ptr<devices::Device> > &devices,
+               shared_ptr<devices::Device> selected);
 
        /**
         * Sets the current device to "no device". Useful for when a selected
@@ -98,8 +103,8 @@ private:
        QMenu menu_;
        QSignalMapper mapper_;
 
-       std::shared_ptr<devices::Device> selected_device_;
-       std::vector< std::weak_ptr<devices::Device> > devices_;
+       shared_ptr<devices::Device> selected_device_;
+       vector< weak_ptr<devices::Device> > devices_;
 
        QString device_tooltip_;
 };
index 47fb3ec20c1b5f8664ead429e561e789aa560a79..13c977d50cda7cedc8f72dd19f9e2599ca2cc56f 100644 (file)
@@ -31,6 +31,7 @@ using std::map;
 using std::pair;
 using std::string;
 using std::shared_ptr;
+using std::vector;
 
 using sigrok::Context;
 using sigrok::OutputFormat;
@@ -39,7 +40,7 @@ namespace pv {
 namespace widgets {
 
 ExportMenu::ExportMenu(QWidget *parent, shared_ptr<Context> context,
-       std::vector<QAction *>open_actions) :
+       vector<QAction *>open_actions) :
        QMenu(parent),
        context_(context),
        mapper_(this)
index 3416c7b3b5411917613620b63265ddb62cddab09..0980ffd54757c0eeb1f1694372c4c47a4e31ec4d 100644 (file)
@@ -25,6 +25,9 @@
 #include <QMenu>
 #include <QSignalMapper>
 
+using std::shared_ptr;
+using std::vector;
+
 namespace sigrok {
 class Context;
 class OutputFormat;
@@ -38,17 +41,17 @@ class ExportMenu : public QMenu
        Q_OBJECT;
 
 public:
-       ExportMenu(QWidget *parent, std::shared_ptr<sigrok::Context> context,
-               std::vector<QAction *>open_actions = std::vector<QAction *>());
+       ExportMenu(QWidget *parent, shared_ptr<sigrok::Context> context,
+               vector<QAction *>open_actions = vector<QAction *>());
 
 private Q_SLOTS:
        void on_action(QObject *action);
 
 Q_SIGNALS:
-       void format_selected(std::shared_ptr<sigrok::OutputFormat> format);
+       void format_selected(shared_ptr<sigrok::OutputFormat> format);
 
 private:
-       std::shared_ptr<sigrok::Context> context_;
+       shared_ptr<sigrok::Context> context_;
        QSignalMapper mapper_;
 };
 
index ad2a6e7966ee0224300512d7cd519959c0e42353..cb33af9808d36733a337b0f12e3e55e62967f141 100644 (file)
@@ -25,6 +25,8 @@
 #include <QMenu>
 #include <QSignalMapper>
 
+using std::shared_ptr;
+
 namespace sigrok {
 class Context;
 class InputFormat;
@@ -38,17 +40,17 @@ class ImportMenu : public QMenu
        Q_OBJECT;
 
 public:
-       ImportMenu(QWidget *parent, std::shared_ptr<sigrok::Context> context,
+       ImportMenu(QWidget *parent, shared_ptr<sigrok::Context> context,
                QAction *open_action = nullptr);
 
 private Q_SLOTS:
        void on_action(QObject *action);
 
 Q_SIGNALS:
-       void format_selected(std::shared_ptr<sigrok::InputFormat> format);
+       void format_selected(shared_ptr<sigrok::InputFormat> format);
 
 private:
-       std::shared_ptr<sigrok::Context> context_;
+       shared_ptr<sigrok::Context> context_;
        QSignalMapper mapper_;
 };
 
index 8fd2e65fad420a0fcccc1ee7414b5c46aad03a1e..c2a50313ef4d7ab920fa72dc44b772fe7a288146 100644 (file)
@@ -21,7 +21,9 @@
 #include <boost/test/unit_test.hpp>
 #include "test/test.hpp"
 
-std::ostream& operator<<(std::ostream& stream, const QString& str)
+using std::ostream;
+
+ostream& operator<<(ostream& stream, const QString& str)
 {
        return stream << str.toUtf8().data();
 }
index 119f5ab88a83001fabef311a6ba86614ae2cad77..62e6cf0da4bddbaaa44f75c36770b76e33a97d4b 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <QString>
 
-std::ostream& operator<<(std::ostream& stream, const QString& str);
+using std::ostream;
+
+ostream& operator<<(ostream& stream, const QString& str);
 
 #endif
index 7ff2a31649ac4003a8aa0ffa1372489725ad5444..0ac6f5fc08ea9363845f77f71daaa0e53a0c13a7 100644 (file)
@@ -25,6 +25,8 @@
 using namespace pv::util;
 using ts = pv::util::Timestamp;
 
+using std::bind;
+
 namespace {
        QChar mu = QChar(0x03BC);
 
@@ -202,7 +204,7 @@ BOOST_AUTO_TEST_CASE(format_time_minutes_test)
 {
        using namespace std::placeholders;
 
-       auto fmt = std::bind(format_time_minutes, _1, _2, true);
+       auto fmt = bind(format_time_minutes, _1, _2, true);
 
        BOOST_CHECK_EQUAL(fmt(ts(    0), 0),    "+0:00");
        BOOST_CHECK_EQUAL(fmt(ts(    1), 0),    "+0:01");