]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/hub.cpp
Update .gitignore to include build products on Windows
[libs/gui.git] / source / input / hub.cpp
index e45cd6576b3bd02b890f2ab96606fc125fee63dc..1916126c9ff3f3be420de975bb3b93ea03ad9f55 100644 (file)
@@ -1,9 +1,9 @@
+#include "hub.h"
 #include <stdexcept>
 #include <sigc++/bind.h>
 #include <sigc++/bind_return.h>
 #include <msp/core/hash.h>
 #include <msp/core/maputils.h>
-#include "hub.h"
 
 using namespace std;
 
@@ -27,27 +27,27 @@ void Hub::attach(Device &dev)
 
 Device *Hub::find_subdevice(DeviceType t, unsigned n)
 {
-       for(vector<Device *>::const_iterator i=devices.begin(); i!=devices.end(); ++i)
-               if(Device *dev = (*i)->find_subdevice(t, 0))
+       for(Device *d: devices)
+               if(Device *dev = d->find_subdevice(t, 0))
                {
                        if(!n)
                                return dev;
                        --n;
                }
-       return 0;
+       return nullptr;
 }
 
 Device *Hub::find_subdevice(const string &n)
 {
        if(n==name)
                return this;
-       for(vector<Device *>::const_iterator i=devices.begin(); i!=devices.end(); ++i)
-               if(Device *dev = (*i)->find_subdevice(n))
+       for(Device *d: devices)
+               if(Device *dev = d->find_subdevice(n))
                        return dev;
-       return 0;
+       return nullptr;
 }
 
-std::string Hub::get_button_name(unsigned btn) const
+string Hub::get_button_name(unsigned btn) const
 {
        unsigned dev_index = btn>>8;
        if(dev_index>=devices.size())
@@ -57,7 +57,7 @@ std::string Hub::get_button_name(unsigned btn) const
        return dev.get_name()+": "+dev.get_button_name(btn&0xFF);
 }
 
-std::string Hub::get_axis_name(unsigned axis) const
+string Hub::get_axis_name(unsigned axis) const
 {
        unsigned dev_index = axis>>8;
        if(dev_index>=devices.size())