diff options
author | Robin Gareus <robin@gareus.org> | 2020-02-23 16:03:59 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-02-23 16:21:55 +0100 |
commit | 5e3480ba8f3dfd5368f323322de7eb79fcf8f97a (patch) | |
tree | 71a75edc24ebce9a6a6f9827f05a57488c43a2b9 /libs/surfaces/websockets/state.cc | |
parent | 224be912112941199fc8c2ff79518d2d2a2262d0 (diff) |
NO-OP: Re-indent websockets code
"Always use Tabstops for block-indent (the code must be
formatted correctly with "[TAB] = N spaces" for any value of N).
Use space only for alignment." - https://ardour.org/styleguide.html
Diffstat (limited to 'libs/surfaces/websockets/state.cc')
-rw-r--r-- | libs/surfaces/websockets/state.cc | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/libs/surfaces/websockets/state.cc b/libs/surfaces/websockets/state.cc index f0074db8fa..18bf289951 100644 --- a/libs/surfaces/websockets/state.cc +++ b/libs/surfaces/websockets/state.cc @@ -16,98 +16,105 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include <sstream> #include <boost/unordered_set.hpp> +#include <sstream> #include "state.h" -NodeState::NodeState () { } +NodeState::NodeState () {} NodeState::NodeState (std::string node) - : _node (node) { } + : _node (node) +{ +} NodeState::NodeState (std::string node, AddressVector addr, ValueVector val) : _node (node) , _addr (addr) - , _val (val) { } + , _val (val) +{ +} -std::string +std::string NodeState::debug_str () const { - std::stringstream s; - s << "node = " << _node; - - if (!_addr.empty ()) { - s << std::endl << " addr = "; - - for (AddressVector::const_iterator it = _addr.begin (); it != _addr.end (); ++it) { - s << *it << ";"; - } - } - - for (ValueVector::const_iterator it = _val.begin (); it != _val.end (); ++it) { - s << std::endl << " val " << it->debug_str (); - } - - return s.str (); + std::stringstream s; + s << "node = " << _node; + + if (!_addr.empty ()) { + s << std::endl + << " addr = "; + + for (AddressVector::const_iterator it = _addr.begin (); it != _addr.end (); ++it) { + s << *it << ";"; + } + } + + for (ValueVector::const_iterator it = _val.begin (); it != _val.end (); ++it) { + s << std::endl + << " val " << it->debug_str (); + } + + return s.str (); } int NodeState::n_addr () const { - return static_cast<int>(_addr.size ()); + return static_cast<int> (_addr.size ()); } uint32_t NodeState::nth_addr (int n) const { - return _addr[n]; + return _addr[n]; } void NodeState::add_addr (uint32_t addr) { - _addr.push_back (addr); + _addr.push_back (addr); } int NodeState::n_val () const { - return static_cast<int>(_val.size ()); + return static_cast<int> (_val.size ()); } TypedValue NodeState::nth_val (int n) const { - if (n_val () < n) { - return TypedValue (); - } + if (n_val () < n) { + return TypedValue (); + } - return _val[n]; + return _val[n]; } void NodeState::add_val (TypedValue val) { - _val.push_back (val); + _val.push_back (val); } std::size_t NodeState::node_addr_hash () const { - std::size_t seed = 0; - boost::hash_combine (seed, _node); - boost::hash_combine (seed, _addr); - return seed; + std::size_t seed = 0; + boost::hash_combine (seed, _node); + boost::hash_combine (seed, _addr); + return seed; } bool NodeState::operator== (const NodeState& other) const { - return node_addr_hash () == other.node_addr_hash (); + return node_addr_hash () == other.node_addr_hash (); } -std::size_t hash_value (const NodeState &state) +std::size_t +hash_value (const NodeState& state) { - return state.node_addr_hash (); + return state.node_addr_hash (); } |