mesos: Removed whitespace padding in overloaded operators. Review: https://reviews.apache.org/r/37013
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dffa167f Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dffa167f Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dffa167f Branch: refs/heads/master Commit: dffa167f74ed731d1884802b4b5ed820416e9d7f Parents: 5af9fb4 Author: Artem Harutyunyan <[email protected]> Authored: Sun Aug 9 18:27:30 2015 -0400 Committer: Michael Park <[email protected]> Committed: Sun Aug 9 19:21:13 2015 -0400 ---------------------------------------------------------------------- docs/clang-format.md | 2 - docs/mesos-c++-style-guide.md | 1 - include/mesos/resources.hpp | 40 +++--- include/mesos/type_utils.hpp | 137 ++++++++----------- include/mesos/values.hpp | 50 ++++--- src/common/attributes.cpp | 5 +- src/common/attributes.hpp | 12 +- src/common/resources.cpp | 50 +++---- src/common/type_utils.cpp | 48 +++---- src/common/values.cpp | 46 +++---- src/jvm/jvm.hpp | 12 +- src/linux/cgroups.cpp | 2 +- src/linux/cgroups.hpp | 2 +- src/linux/routing/filter/basic.hpp | 2 +- src/linux/routing/filter/icmp.hpp | 2 +- src/linux/routing/filter/ip.hpp | 6 +- src/linux/routing/handle.hpp | 6 +- src/log/log.hpp | 10 +- src/log/network.hpp | 6 +- src/master/allocator/sorter/drf/sorter.cpp | 2 +- src/master/allocator/sorter/drf/sorter.hpp | 2 +- src/master/master.hpp | 12 +- src/master/registrar.hpp | 2 +- src/messages/flags.hpp | 2 +- src/messages/log.hpp | 4 +- src/messages/messages.hpp | 6 +- src/slave/gc.hpp | 2 +- src/slave/slave.cpp | 6 +- src/slave/slave.hpp | 12 +- src/state/log.cpp | 2 +- src/tests/cluster.hpp | 6 +- .../docker_containerizer_tests.cpp | 2 +- src/zookeeper/authentication.hpp | 2 +- src/zookeeper/group.hpp | 12 +- src/zookeeper/url.hpp | 2 +- src/zookeeper/zookeeper.hpp | 2 +- 36 files changed, 243 insertions(+), 274 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/docs/clang-format.md ---------------------------------------------------------------------- diff --git a/docs/clang-format.md b/docs/clang-format.md index 3824ec0..ce51a61 100644 --- a/docs/clang-format.md +++ b/docs/clang-format.md @@ -91,7 +91,5 @@ This binds the function `clang-format-region` to `C-M-tab`, which then formats t * The braces after `namespace`s should not be wrapped. * The braces after `struct`s and `union`s should be wrapped. * Parameters and arguments should be indented by 4 spaces rather than 2. -* Overloaded operators should be padded with spaces. - (e.g. `Foo operator + (...);`) * Should not follow Google's style of wrapping on open parentheses, we should try to reduce "jaggedness" in the code. http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/docs/mesos-c++-style-guide.md ---------------------------------------------------------------------- diff --git a/docs/mesos-c++-style-guide.md b/docs/mesos-c++-style-guide.md index d8ad0ac..857f3dc 100644 --- a/docs/mesos-c++-style-guide.md +++ b/docs/mesos-c++-style-guide.md @@ -37,7 +37,6 @@ void Slave::statusUpdate(StatusUpdate update, const UPID& pid) ### Function Names * We use [lowerCamelCase](http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms) for function names (Google uses mixed case for regular functions; and their accessors and mutators match the name of the variable). -* Leave spaces around overloaded operators, e.g. `operator + (...);` rather than `operator+(...);` ### Namespace Names * We do not use namespace aliases. http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/include/mesos/resources.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/resources.hpp b/include/mesos/resources.hpp index d4d5caf..6c3a065 100644 --- a/include/mesos/resources.hpp +++ b/include/mesos/resources.hpp @@ -158,7 +158,7 @@ public: Resources(const Resources& that) : resources(that.resources) {} - Resources& operator = (const Resources& that) + Resources& operator=(const Resources& that) { if (this != &that) { resources = that.resources; @@ -287,25 +287,25 @@ public: // Using this operator makes it easy to copy a resources object into // a protocol buffer field. - operator const google::protobuf::RepeatedPtrField<Resource>& () const; + operator const google::protobuf::RepeatedPtrField<Resource>&() const; - bool operator == (const Resources& that) const; - bool operator != (const Resources& that) const; + bool operator==(const Resources& that) const; + bool operator!=(const Resources& that) const; // NOTE: If any error occurs (e.g., input Resource is not valid or // the first operand is not a superset of the second oprand while // doing subtraction), the semantics is as though the second operand // was actually just an empty resource (as though you didn't do the // operation at all). - Resources operator + (const Resource& that) const; - Resources operator + (const Resources& that) const; - Resources& operator += (const Resource& that); - Resources& operator += (const Resources& that); + Resources operator+(const Resource& that) const; + Resources operator+(const Resources& that) const; + Resources& operator+=(const Resource& that); + Resources& operator+=(const Resources& that); - Resources operator - (const Resource& that) const; - Resources operator - (const Resources& that) const; - Resources& operator -= (const Resource& that); - Resources& operator -= (const Resources& that); + Resources operator-(const Resource& that) const; + Resources operator-(const Resources& that) const; + Resources& operator-=(const Resource& that); + Resources& operator-=(const Resources& that); private: // Similar to 'contains(const Resource&)' but skips the validity @@ -326,11 +326,11 @@ private: }; -std::ostream& operator << (std::ostream& stream, const Resource& resource); -std::ostream& operator << (std::ostream& stream, const Resources& resources); +std::ostream& operator<<(std::ostream& stream, const Resource& resource); +std::ostream& operator<<(std::ostream& stream, const Resources& resources); -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const google::protobuf::RepeatedPtrField<Resource>& resources) { @@ -338,7 +338,7 @@ inline std::ostream& operator << ( } -inline Resources operator + ( +inline Resources operator+( const google::protobuf::RepeatedPtrField<Resource>& left, const Resources& right) { @@ -346,7 +346,7 @@ inline Resources operator + ( } -inline Resources operator - ( +inline Resources operator-( const google::protobuf::RepeatedPtrField<Resource>& left, const Resources& right) { @@ -354,7 +354,7 @@ inline Resources operator - ( } -inline bool operator == ( +inline bool operator==( const google::protobuf::RepeatedPtrField<Resource>& left, const Resources& right) { @@ -363,7 +363,7 @@ inline bool operator == ( template <typename Key> -hashmap<Key, Resources>& operator += ( +hashmap<Key, Resources>& operator+=( hashmap<Key, Resources>& left, const hashmap<Key, Resources>& right) { @@ -375,7 +375,7 @@ hashmap<Key, Resources>& operator += ( template <typename Key> -hashmap<Key, Resources> operator + ( +hashmap<Key, Resources> operator+( const hashmap<Key, Resources>& left, const hashmap<Key, Resources>& right) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/include/mesos/type_utils.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp index f1cb5e2..6ff061c 100644 --- a/include/mesos/type_utils.hpp +++ b/include/mesos/type_utils.hpp @@ -46,158 +46,158 @@ namespace mesos { -bool operator == (const CommandInfo& left, const CommandInfo& right); -bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right); -bool operator == (const Credential& left, const Credential& right); -bool operator == (const Environment& left, const Environment& right); -bool operator == (const ExecutorInfo& left, const ExecutorInfo& right); -bool operator == (const MasterInfo& left, const MasterInfo& right); - -bool operator == ( +bool operator==(const CommandInfo& left, const CommandInfo& right); +bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right); +bool operator==(const Credential& left, const Credential& right); +bool operator==(const Environment& left, const Environment& right); +bool operator==(const ExecutorInfo& left, const ExecutorInfo& right); +bool operator==(const MasterInfo& left, const MasterInfo& right); + +bool operator==( const ResourceStatistics& left, const ResourceStatistics& right); -bool operator == (const SlaveInfo& left, const SlaveInfo& right); -bool operator == (const Volume& left, const Volume& right); +bool operator==(const SlaveInfo& left, const SlaveInfo& right); +bool operator==(const Volume& left, const Volume& right); -bool operator == (const URL& left, const URL& right); +bool operator==(const URL& left, const URL& right); -bool operator == (const TaskStatus& left, const TaskStatus& right); -bool operator != (const TaskStatus& left, const TaskStatus& right); +bool operator==(const TaskStatus& left, const TaskStatus& right); +bool operator!=(const TaskStatus& left, const TaskStatus& right); -inline bool operator == (const ContainerID& left, const ContainerID& right) +inline bool operator==(const ContainerID& left, const ContainerID& right) { return left.value() == right.value(); } -inline bool operator == (const ExecutorID& left, const ExecutorID& right) +inline bool operator==(const ExecutorID& left, const ExecutorID& right) { return left.value() == right.value(); } -inline bool operator == (const FrameworkID& left, const FrameworkID& right) +inline bool operator==(const FrameworkID& left, const FrameworkID& right) { return left.value() == right.value(); } -inline bool operator == (const FrameworkInfo& left, const FrameworkInfo& right) +inline bool operator==(const FrameworkInfo& left, const FrameworkInfo& right) { return (left.name() == right.name()) && (left.user() == right.user()); } -inline bool operator == (const OfferID& left, const OfferID& right) +inline bool operator==(const OfferID& left, const OfferID& right) { return left.value() == right.value(); } -inline bool operator == (const SlaveID& left, const SlaveID& right) +inline bool operator==(const SlaveID& left, const SlaveID& right) { return left.value() == right.value(); } -inline bool operator == (const TaskID& left, const TaskID& right) +inline bool operator==(const TaskID& left, const TaskID& right) { return left.value() == right.value(); } -inline bool operator == (const ContainerID& left, const std::string& right) +inline bool operator==(const ContainerID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const ExecutorID& left, const std::string& right) +inline bool operator==(const ExecutorID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const FrameworkID& left, const std::string& right) +inline bool operator==(const FrameworkID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const OfferID& left, const std::string& right) +inline bool operator==(const OfferID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const SlaveID& left, const std::string& right) +inline bool operator==(const SlaveID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const TaskID& left, const std::string& right) +inline bool operator==(const TaskID& left, const std::string& right) { return left.value() == right; } -inline bool operator != (const ContainerID& left, const ContainerID& right) +inline bool operator!=(const ContainerID& left, const ContainerID& right) { return left.value() != right.value(); } -inline bool operator != (const ExecutorID& left, const ExecutorID& right) +inline bool operator!=(const ExecutorID& left, const ExecutorID& right) { return left.value() != right.value(); } -inline bool operator != (const FrameworkID& left, const FrameworkID& right) +inline bool operator!=(const FrameworkID& left, const FrameworkID& right) { return left.value() != right.value(); } -inline bool operator != (const SlaveID& left, const SlaveID& right) +inline bool operator!=(const SlaveID& left, const SlaveID& right) { return left.value() != right.value(); } -inline bool operator < (const ContainerID& left, const ContainerID& right) +inline bool operator<(const ContainerID& left, const ContainerID& right) { return left.value() < right.value(); } -inline bool operator < (const ExecutorID& left, const ExecutorID& right) +inline bool operator<(const ExecutorID& left, const ExecutorID& right) { return left.value() < right.value(); } -inline bool operator < (const FrameworkID& left, const FrameworkID& right) +inline bool operator<(const FrameworkID& left, const FrameworkID& right) { return left.value() < right.value(); } -inline bool operator < (const OfferID& left, const OfferID& right) +inline bool operator<(const OfferID& left, const OfferID& right) { return left.value() < right.value(); } -inline bool operator < (const SlaveID& left, const SlaveID& right) +inline bool operator<(const SlaveID& left, const SlaveID& right) { return left.value() < right.value(); } -inline bool operator < (const TaskID& left, const TaskID& right) +inline bool operator<(const TaskID& left, const TaskID& right) { return left.value() < right.value(); } @@ -268,15 +268,13 @@ inline std::size_t hash_value(const TaskID& taskId) } -inline std::ostream& operator << ( - std::ostream& stream, - const ACLs& acls) +inline std::ostream& operator<<(std::ostream& stream, const ACLs& acls) { return stream << acls.DebugString(); } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ContainerID& containerId) { @@ -284,7 +282,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ContainerInfo& containerInfo) { @@ -292,7 +290,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ExecutorID& executorId) { @@ -300,7 +298,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ExecutorInfo& executor) { @@ -308,7 +306,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const FrameworkID& frameworkId) { @@ -316,79 +314,62 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( - std::ostream& stream, - const MasterInfo& master) +inline std::ostream& operator<<(std::ostream& stream, const MasterInfo& master) { return stream << master.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const OfferID& offerId) +inline std::ostream& operator<<(std::ostream& stream, const OfferID& offerId) { return stream << offerId.value(); } -inline std::ostream& operator << ( - std::ostream& stream, - const RateLimits& limits) +inline std::ostream& operator<<(std::ostream& stream, const RateLimits& limits) { return stream << limits.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const SlaveID& slaveId) +inline std::ostream& operator<<(std::ostream& stream, const SlaveID& slaveId) { return stream << slaveId.value(); } -inline std::ostream& operator << ( - std::ostream& stream, - const SlaveInfo& slave) +inline std::ostream& operator<<(std::ostream& stream, const SlaveInfo& slave) { return stream << slave.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const TaskID& taskId) +inline std::ostream& operator<<(std::ostream& stream, const TaskID& taskId) { return stream << taskId.value(); } -inline std::ostream& operator << ( - std::ostream& stream, - const TaskInfo& task) +inline std::ostream& operator<<(std::ostream& stream, const TaskInfo& task) { return stream << task.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const TaskState& state) +inline std::ostream& operator<<(std::ostream& stream, const TaskState& state) { return stream << TaskState_Name(state); } -inline std::ostream& operator << ( - std::ostream& stream, - const scheduler::Call::Type& type) +inline std::ostream& operator<<(std::ostream& stream, + const scheduler::Call::Type& type) { return stream << scheduler::Call_Type_Name(type); } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const scheduler::Event::Type& type) { @@ -396,7 +377,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const std::vector<TaskID>& taskIds) { @@ -412,7 +393,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const FrameworkInfo::Capability& capability) { @@ -421,7 +402,7 @@ inline std::ostream& operator << ( template <typename T> -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const google::protobuf::RepeatedPtrField<T>& messages) { @@ -437,15 +418,13 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( - std::ostream& stream, - const Modules& modules) +inline std::ostream& operator<<(std::ostream& stream, const Modules& modules) { return stream << modules.DebugString(); } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const hashmap<std::string, std::string>& map) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/include/mesos/values.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/values.hpp b/include/mesos/values.hpp index c61f9e8..e300580 100644 --- a/include/mesos/values.hpp +++ b/include/mesos/values.hpp @@ -25,36 +25,32 @@ namespace mesos { -std::ostream& operator << (std::ostream& stream, const Value::Scalar& scalar); -bool operator == (const Value::Scalar& left, const Value::Scalar& right); -bool operator <= (const Value::Scalar& left, const Value::Scalar& right); -Value::Scalar operator + (const Value::Scalar& left, - const Value::Scalar& right); -Value::Scalar operator - (const Value::Scalar& left, - const Value::Scalar& right); -Value::Scalar& operator += (Value::Scalar& left, const Value::Scalar& right); -Value::Scalar& operator -= (Value::Scalar& left, const Value::Scalar& right); +std::ostream& operator<<(std::ostream& stream, const Value::Scalar& scalar); +bool operator==(const Value::Scalar& left, const Value::Scalar& right); +bool operator<=(const Value::Scalar& left, const Value::Scalar& right); +Value::Scalar operator+(const Value::Scalar& left, const Value::Scalar& right); +Value::Scalar operator-(const Value::Scalar& left, const Value::Scalar& right); +Value::Scalar& operator+=(Value::Scalar& left, const Value::Scalar& right); +Value::Scalar& operator-=(Value::Scalar& left, const Value::Scalar& right); -std::ostream& operator << (std::ostream& stream, const Value::Ranges& ranges); -bool operator == (const Value::Ranges& left, const Value::Ranges& right); -bool operator <= (const Value::Ranges& left, const Value::Ranges& right); -Value::Ranges operator + (const Value::Ranges& left, - const Value::Ranges& right); -Value::Ranges operator - (const Value::Ranges& left, - const Value::Ranges& right); -Value::Ranges& operator += (Value::Ranges& left, const Value::Ranges& right); -Value::Ranges& operator -= (Value::Ranges& left, const Value::Ranges& right); +std::ostream& operator<<(std::ostream& stream, const Value::Ranges& ranges); +bool operator==(const Value::Ranges& left, const Value::Ranges& right); +bool operator<=(const Value::Ranges& left, const Value::Ranges& right); +Value::Ranges operator+(const Value::Ranges& left, const Value::Ranges& right); +Value::Ranges operator-(const Value::Ranges& left, const Value::Ranges& right); +Value::Ranges& operator+=(Value::Ranges& left, const Value::Ranges& right); +Value::Ranges& operator-=(Value::Ranges& left, const Value::Ranges& right); -std::ostream& operator << (std::ostream& stream, const Value::Set& set); -bool operator == (const Value::Set& left, const Value::Set& right); -bool operator <= (const Value::Set& left, const Value::Set& right); -Value::Set operator + (const Value::Set& left, const Value::Set& right); -Value::Set operator - (const Value::Set& left, const Value::Set& right); -Value::Set& operator += (Value::Set& left, const Value::Set& right); -Value::Set& operator -= (Value::Set& left, const Value::Set& right); +std::ostream& operator<<(std::ostream& stream, const Value::Set& set); +bool operator==(const Value::Set& left, const Value::Set& right); +bool operator<=(const Value::Set& left, const Value::Set& right); +Value::Set operator+(const Value::Set& left, const Value::Set& right); +Value::Set operator-(const Value::Set& left, const Value::Set& right); +Value::Set& operator+=(Value::Set& left, const Value::Set& right); +Value::Set& operator-=(Value::Set& left, const Value::Set& right); -std::ostream& operator << (std::ostream& stream, const Value::Text& value); -bool operator == (const Value::Text& left, const Value::Text& right); +std::ostream& operator<<(std::ostream& stream, const Value::Text& value); +bool operator==(const Value::Text& left, const Value::Text& right); namespace internal { namespace values { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/common/attributes.cpp ---------------------------------------------------------------------- diff --git a/src/common/attributes.cpp b/src/common/attributes.cpp index a8a621e..f713bb5 100644 --- a/src/common/attributes.cpp +++ b/src/common/attributes.cpp @@ -35,8 +35,7 @@ using std::vector; namespace mesos { - -std::ostream& operator << (std::ostream& stream, const Attribute& attribute) +std::ostream& operator<<(std::ostream& stream, const Attribute& attribute) { stream << attribute.name() << "="; switch (attribute.type()) { @@ -56,7 +55,7 @@ std::ostream& operator << (std::ostream& stream, const Attribute& attribute) namespace internal { -bool Attributes::operator == (const Attributes& that) const +bool Attributes::operator==(const Attributes& that) const { if (size() != that.size()) { return false; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/common/attributes.hpp ---------------------------------------------------------------------- diff --git a/src/common/attributes.hpp b/src/common/attributes.hpp index 0a043d5..2a7efbd 100644 --- a/src/common/attributes.hpp +++ b/src/common/attributes.hpp @@ -28,9 +28,7 @@ namespace mesos { - -std::ostream& operator << (std::ostream& stream, const Attribute& attribute); - +std::ostream& operator<<(std::ostream& stream, const Attribute& attribute); namespace internal { @@ -51,7 +49,7 @@ public: attributes.MergeFrom(that.attributes); } - Attributes& operator = (const Attributes& that) + Attributes& operator=(const Attributes& that) { if (this != &that) { attributes.Clear(); @@ -61,10 +59,10 @@ public: return *this; } - bool operator == (const Attributes& that) const; + bool operator==(const Attributes& that) const; - bool operator != (const Attributes& that) const + bool operator!=(const Attributes& that) const { return !(*this == that); } @@ -76,7 +74,7 @@ public: // Using this operator makes it easy to copy a attributes object into // a protocol buffer field. - operator const google::protobuf::RepeatedPtrField<Attribute>& () const + operator const google::protobuf::RepeatedPtrField<Attribute>&() const { return attributes; } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/common/resources.cpp ---------------------------------------------------------------------- diff --git a/src/common/resources.cpp b/src/common/resources.cpp index eb5476a..9cf9ec9 100644 --- a/src/common/resources.cpp +++ b/src/common/resources.cpp @@ -46,7 +46,7 @@ namespace mesos { // Helper functions. ///////////////////////////////////////////////// -bool operator == ( +bool operator==( const Resource::ReservationInfo& left, const Resource::ReservationInfo& right) { @@ -54,7 +54,7 @@ bool operator == ( } -bool operator != ( +bool operator!=( const Resource::ReservationInfo& left, const Resource::ReservationInfo& right) { @@ -62,7 +62,7 @@ bool operator != ( } -bool operator == ( +bool operator==( const Resource::DiskInfo& left, const Resource::DiskInfo& right) { @@ -83,7 +83,7 @@ bool operator == ( } -bool operator != ( +bool operator!=( const Resource::DiskInfo& left, const Resource::DiskInfo& right) { @@ -91,7 +91,7 @@ bool operator != ( } -bool operator == (const Resource& left, const Resource& right) +bool operator==(const Resource& left, const Resource& right) { if (left.name() != right.name() || left.type() != right.type() || @@ -134,7 +134,7 @@ bool operator == (const Resource& left, const Resource& right) } -bool operator != (const Resource& left, const Resource& right) +bool operator!=(const Resource& left, const Resource& right) { return !(left == right); } @@ -257,7 +257,7 @@ static bool contains(const Resource& left, const Resource& right) } -Resource& operator += (Resource& left, const Resource& right) +Resource& operator+=(Resource& left, const Resource& right) { if (left.type() == Value::SCALAR) { *left.mutable_scalar() += right.scalar(); @@ -271,7 +271,7 @@ Resource& operator += (Resource& left, const Resource& right) } -Resource operator + (const Resource& left, const Resource& right) +Resource operator+(const Resource& left, const Resource& right) { Resource result = left; result += right; @@ -279,7 +279,7 @@ Resource operator + (const Resource& left, const Resource& right) } -Resource& operator -= (Resource& left, const Resource& right) +Resource& operator-=(Resource& left, const Resource& right) { if (left.type() == Value::SCALAR) { *left.mutable_scalar() -= right.scalar(); @@ -293,7 +293,7 @@ Resource& operator -= (Resource& left, const Resource& right) } -Resource operator - (const Resource& left, const Resource& right) +Resource operator-(const Resource& left, const Resource& right) { Resource result = left; result -= right; @@ -1051,25 +1051,25 @@ bool Resources::_contains(const Resource& that) const ///////////////////////////////////////////////// -Resources::operator const google::protobuf::RepeatedPtrField<Resource>& () const +Resources::operator const google::protobuf::RepeatedPtrField<Resource>&() const { return resources; } -bool Resources::operator == (const Resources& that) const +bool Resources::operator==(const Resources& that) const { return this->contains(that) && that.contains(*this); } -bool Resources::operator != (const Resources& that) const +bool Resources::operator!=(const Resources& that) const { return !(*this == that); } -Resources Resources::operator + (const Resource& that) const +Resources Resources::operator+(const Resource& that) const { Resources result = *this; result += that; @@ -1077,7 +1077,7 @@ Resources Resources::operator + (const Resource& that) const } -Resources Resources::operator + (const Resources& that) const +Resources Resources::operator+(const Resources& that) const { Resources result = *this; result += that; @@ -1085,7 +1085,7 @@ Resources Resources::operator + (const Resources& that) const } -Resources& Resources::operator += (const Resource& that) +Resources& Resources::operator+=(const Resource& that) { if (validate(that).isNone() && !isEmpty(that)) { bool found = false; @@ -1107,7 +1107,7 @@ Resources& Resources::operator += (const Resource& that) } -Resources& Resources::operator += (const Resources& that) +Resources& Resources::operator+=(const Resources& that) { foreach (const Resource& resource, that.resources) { *this += resource; @@ -1117,7 +1117,7 @@ Resources& Resources::operator += (const Resources& that) } -Resources Resources::operator - (const Resource& that) const +Resources Resources::operator-(const Resource& that) const { Resources result = *this; result -= that; @@ -1125,7 +1125,7 @@ Resources Resources::operator - (const Resource& that) const } -Resources Resources::operator - (const Resources& that) const +Resources Resources::operator-(const Resources& that) const { Resources result = *this; result -= that; @@ -1133,7 +1133,7 @@ Resources Resources::operator - (const Resources& that) const } -Resources& Resources::operator -= (const Resource& that) +Resources& Resources::operator-=(const Resource& that) { if (validate(that).isNone() && !isEmpty(that)) { for (int i = 0; i < resources.size(); i++) { @@ -1158,7 +1158,7 @@ Resources& Resources::operator -= (const Resource& that) } -Resources& Resources::operator -= (const Resources& that) +Resources& Resources::operator-=(const Resources& that) { foreach (const Resource& resource, that.resources) { *this -= resource; @@ -1168,7 +1168,7 @@ Resources& Resources::operator -= (const Resources& that) } -ostream& operator << (ostream& stream, const Volume& volume) { +ostream& operator<<(ostream& stream, const Volume& volume) { string volumeConfig = volume.container_path(); if (volume.has_host_path()) { @@ -1191,7 +1191,7 @@ ostream& operator << (ostream& stream, const Volume& volume) { } -ostream& operator << (ostream& stream, const Resource::DiskInfo& disk) { +ostream& operator<<(ostream& stream, const Resource::DiskInfo& disk) { if (disk.has_persistence()) { stream << disk.persistence().id(); } @@ -1204,7 +1204,7 @@ ostream& operator << (ostream& stream, const Resource::DiskInfo& disk) { } -ostream& operator << (ostream& stream, const Resource& resource) +ostream& operator<<(ostream& stream, const Resource& resource) { stream << resource.name(); @@ -1241,7 +1241,7 @@ ostream& operator << (ostream& stream, const Resource& resource) } -ostream& operator << (ostream& stream, const Resources& resources) +ostream& operator<<(ostream& stream, const Resources& resources) { mesos::Resources::const_iterator it = resources.begin(); http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/common/type_utils.cpp ---------------------------------------------------------------------- diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp index 36a2469..22118b4 100644 --- a/src/common/type_utils.cpp +++ b/src/common/type_utils.cpp @@ -29,7 +29,7 @@ namespace mesos { // TODO(vinod): Ensure that these operators do not go out of sync // when new fields are added to the protobufs (MESOS-2487). -bool operator == (const CommandInfo& left, const CommandInfo& right) +bool operator==(const CommandInfo& left, const CommandInfo& right) { if (left.uris().size() != right.uris().size()) { return false; @@ -71,7 +71,7 @@ bool operator == (const CommandInfo& left, const CommandInfo& right) } -bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right) +bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right) { return left.value() == right.value() && left.executable() == right.executable() && @@ -79,14 +79,14 @@ bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right) } -bool operator == (const Credential& left, const Credential& right) +bool operator==(const Credential& left, const Credential& right) { return left.principal() == right.principal() && left.secret() == right.secret(); } -bool operator == ( +bool operator==( const Environment::Variable& left, const Environment::Variable& right) { @@ -94,7 +94,7 @@ bool operator == ( } -bool operator == (const Environment& left, const Environment& right) +bool operator==(const Environment& left, const Environment& right) { // Order of variables is not important. if (left.variables().size() != right.variables().size()) { @@ -118,7 +118,7 @@ bool operator == (const Environment& left, const Environment& right) } -bool operator == (const Volume& left, const Volume& right) +bool operator==(const Volume& left, const Volume& right) { return left.container_path() == right.container_path() && left.host_path() == right.host_path() && @@ -127,13 +127,13 @@ bool operator == (const Volume& left, const Volume& right) // TODO(bmahler): Leverage process::http::URL for equality. -bool operator == (const URL& left, const URL& right) +bool operator==(const URL& left, const URL& right) { return left.SerializeAsString() == right.SerializeAsString(); } -bool operator == ( +bool operator==( const ContainerInfo::DockerInfo::PortMapping& left, const ContainerInfo::DockerInfo::PortMapping& right) { @@ -143,13 +143,13 @@ bool operator == ( } -bool operator == (const Parameter& left, const Parameter& right) +bool operator==(const Parameter& left, const Parameter& right) { return left.key() == right.key() && left.value() == right.value(); } -bool operator == ( +bool operator==( const ContainerInfo::DockerInfo& left, const ContainerInfo::DockerInfo& right) { @@ -196,7 +196,7 @@ bool operator == ( } -bool operator == (const ContainerInfo& left, const ContainerInfo& right) +bool operator==(const ContainerInfo& left, const ContainerInfo& right) { // Order of volumes is not important. if (left.volumes().size() != right.volumes().size()) { @@ -222,7 +222,7 @@ bool operator == (const ContainerInfo& left, const ContainerInfo& right) } -bool operator == (const Port& left, const Port& right) +bool operator==(const Port& left, const Port& right) { return left.number() == right.number() && left.name() == right.name() && @@ -230,7 +230,7 @@ bool operator == (const Port& left, const Port& right) } -bool operator == (const Ports& left, const Ports& right) +bool operator==(const Ports& left, const Ports& right) { // Order of ports is not important. if (left.ports().size() != right.ports().size()) { @@ -254,13 +254,13 @@ bool operator == (const Ports& left, const Ports& right) } -bool operator == (const Label& left, const Label& right) +bool operator==(const Label& left, const Label& right) { return left.key() == right.key() && left.value() == right.value(); } -bool operator == (const Labels& left, const Labels& right) +bool operator==(const Labels& left, const Labels& right) { // Order of labels is not important. if (left.labels().size() != right.labels().size()) { @@ -284,7 +284,7 @@ bool operator == (const Labels& left, const Labels& right) } -bool operator == (const DiscoveryInfo& left, const DiscoveryInfo& right) +bool operator==(const DiscoveryInfo& left, const DiscoveryInfo& right) { return left.visibility() == right.visibility() && left.name() == right.name() && @@ -296,7 +296,7 @@ bool operator == (const DiscoveryInfo& left, const DiscoveryInfo& right) } -bool operator == (const ExecutorInfo& left, const ExecutorInfo& right) +bool operator==(const ExecutorInfo& left, const ExecutorInfo& right) { return left.executor_id() == right.executor_id() && left.data() == right.data() && @@ -310,7 +310,7 @@ bool operator == (const ExecutorInfo& left, const ExecutorInfo& right) } -bool operator == (const MasterInfo& left, const MasterInfo& right) +bool operator==(const MasterInfo& left, const MasterInfo& right) { return left.id() == right.id() && left.ip() == right.ip() && @@ -321,7 +321,7 @@ bool operator == (const MasterInfo& left, const MasterInfo& right) } -bool operator == ( +bool operator==( const ResourceStatistics& left, const ResourceStatistics& right) { @@ -329,7 +329,7 @@ bool operator == ( } -bool operator == (const SlaveInfo& left, const SlaveInfo& right) +bool operator==(const SlaveInfo& left, const SlaveInfo& right) { return left.hostname() == right.hostname() && Resources(left.resources()) == Resources(right.resources()) && @@ -342,7 +342,7 @@ bool operator == (const SlaveInfo& left, const SlaveInfo& right) // TODO(bmahler): Use SerializeToString here? -bool operator == (const TaskStatus& left, const TaskStatus& right) +bool operator==(const TaskStatus& left, const TaskStatus& right) { return left.task_id() == right.task_id() && left.state() == right.state() && @@ -358,7 +358,7 @@ bool operator == (const TaskStatus& left, const TaskStatus& right) } -bool operator != (const TaskStatus& left, const TaskStatus& right) +bool operator!=(const TaskStatus& left, const TaskStatus& right) { return !(left == right); } @@ -366,7 +366,7 @@ bool operator != (const TaskStatus& left, const TaskStatus& right) namespace internal { -bool operator == (const Task& left, const Task& right) +bool operator==(const Task& left, const Task& right) { // Order of task statuses is important. if (left.statuses().size() != right.statuses().size()) { @@ -393,7 +393,7 @@ bool operator == (const Task& left, const Task& right) } -std::ostream& operator << ( +std::ostream& operator<<( std::ostream& stream, const StatusUpdate& update) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/common/values.cpp ---------------------------------------------------------------------- diff --git a/src/common/values.cpp b/src/common/values.cpp index 2431d9e..750264e 100644 --- a/src/common/values.cpp +++ b/src/common/values.cpp @@ -132,25 +132,25 @@ Try<Value> parse(const std::string& text) } // namespace internal { -ostream& operator << (ostream& stream, const Value::Scalar& scalar) +ostream& operator<<(ostream& stream, const Value::Scalar& scalar) { return stream << scalar.value(); } -bool operator == (const Value::Scalar& left, const Value::Scalar& right) +bool operator==(const Value::Scalar& left, const Value::Scalar& right) { return left.value() == right.value(); } -bool operator <= (const Value::Scalar& left, const Value::Scalar& right) +bool operator<=(const Value::Scalar& left, const Value::Scalar& right) { return left.value() <= right.value(); } -Value::Scalar operator + (const Value::Scalar& left, const Value::Scalar& right) +Value::Scalar operator+(const Value::Scalar& left, const Value::Scalar& right) { Value::Scalar result; result.set_value(left.value() + right.value()); @@ -158,7 +158,7 @@ Value::Scalar operator + (const Value::Scalar& left, const Value::Scalar& right) } -Value::Scalar operator - (const Value::Scalar& left, const Value::Scalar& right) +Value::Scalar operator-(const Value::Scalar& left, const Value::Scalar& right) { Value::Scalar result; result.set_value(left.value() - right.value()); @@ -166,14 +166,14 @@ Value::Scalar operator - (const Value::Scalar& left, const Value::Scalar& right) } -Value::Scalar& operator += (Value::Scalar& left, const Value::Scalar& right) +Value::Scalar& operator+=(Value::Scalar& left, const Value::Scalar& right) { left.set_value(left.value() + right.value()); return left; } -Value::Scalar& operator -= (Value::Scalar& left, const Value::Scalar& right) +Value::Scalar& operator-=(Value::Scalar& left, const Value::Scalar& right) { left.set_value(left.value() - right.value()); return left; @@ -291,7 +291,7 @@ static void remove(Value::Ranges* ranges, const Value::Range& range) } -ostream& operator << (ostream& stream, const Value::Ranges& ranges) +ostream& operator<<(ostream& stream, const Value::Ranges& ranges) { stream << "["; for (int i = 0; i < ranges.range_size(); i++) { @@ -305,7 +305,7 @@ ostream& operator << (ostream& stream, const Value::Ranges& ranges) } -bool operator == (const Value::Ranges& _left, const Value::Ranges& _right) +bool operator==(const Value::Ranges& _left, const Value::Ranges& _right) { Value::Ranges left; coalesce(&left, _left); @@ -337,7 +337,7 @@ bool operator == (const Value::Ranges& _left, const Value::Ranges& _right) } -bool operator <= (const Value::Ranges& _left, const Value::Ranges& _right) +bool operator<=(const Value::Ranges& _left, const Value::Ranges& _right) { Value::Ranges left; coalesce(&left, _left); @@ -364,7 +364,7 @@ bool operator <= (const Value::Ranges& _left, const Value::Ranges& _right) } -Value::Ranges operator + (const Value::Ranges& left, const Value::Ranges& right) +Value::Ranges operator+(const Value::Ranges& left, const Value::Ranges& right) { Value::Ranges result; @@ -375,7 +375,7 @@ Value::Ranges operator + (const Value::Ranges& left, const Value::Ranges& right) } -Value::Ranges operator - (const Value::Ranges& left, const Value::Ranges& right) +Value::Ranges operator-(const Value::Ranges& left, const Value::Ranges& right) { Value::Ranges result; @@ -390,7 +390,7 @@ Value::Ranges operator - (const Value::Ranges& left, const Value::Ranges& right) } -Value::Ranges& operator += (Value::Ranges& left, const Value::Ranges& right) +Value::Ranges& operator+=(Value::Ranges& left, const Value::Ranges& right) { Value::Ranges temp; @@ -404,7 +404,7 @@ Value::Ranges& operator += (Value::Ranges& left, const Value::Ranges& right) } -Value::Ranges& operator -= (Value::Ranges& left, const Value::Ranges& right) +Value::Ranges& operator-=(Value::Ranges& left, const Value::Ranges& right) { Value::Ranges temp; @@ -421,7 +421,7 @@ Value::Ranges& operator -= (Value::Ranges& left, const Value::Ranges& right) } -ostream& operator << (ostream& stream, const Value::Set& set) +ostream& operator<<(ostream& stream, const Value::Set& set) { stream << "{"; for (int i = 0; i < set.item_size(); i++) { @@ -435,7 +435,7 @@ ostream& operator << (ostream& stream, const Value::Set& set) } -bool operator == (const Value::Set& left, const Value::Set& right) +bool operator==(const Value::Set& left, const Value::Set& right) { if (left.item_size() == right.item_size()) { for (int i = 0; i < left.item_size(); i++) { @@ -460,7 +460,7 @@ bool operator == (const Value::Set& left, const Value::Set& right) } -bool operator <= (const Value::Set& left, const Value::Set& right) +bool operator<=(const Value::Set& left, const Value::Set& right) { if (left.item_size() <= right.item_size()) { for (int i = 0; i < left.item_size(); i++) { @@ -485,7 +485,7 @@ bool operator <= (const Value::Set& left, const Value::Set& right) } -Value::Set operator + (const Value::Set& left, const Value::Set& right) +Value::Set operator+(const Value::Set& left, const Value::Set& right) { Value::Set result; @@ -512,7 +512,7 @@ Value::Set operator + (const Value::Set& left, const Value::Set& right) } -Value::Set operator - (const Value::Set& left, const Value::Set& right) +Value::Set operator-(const Value::Set& left, const Value::Set& right) { Value::Set result; @@ -535,7 +535,7 @@ Value::Set operator - (const Value::Set& left, const Value::Set& right) } -Value::Set& operator += (Value::Set& left, const Value::Set& right) +Value::Set& operator+=(Value::Set& left, const Value::Set& right) { // A little bit of extra logic to avoid adding duplicates from right. for (int i = 0; i < right.item_size(); i++) { @@ -556,7 +556,7 @@ Value::Set& operator += (Value::Set& left, const Value::Set& right) } -Value::Set& operator -= (Value::Set& left, const Value::Set& right) +Value::Set& operator-=(Value::Set& left, const Value::Set& right) { // For each item in right, remove it if it's in left. for (int i = 0; i < right.item_size(); i++) { @@ -572,13 +572,13 @@ Value::Set& operator -= (Value::Set& left, const Value::Set& right) } -ostream& operator << (ostream& stream, const Value::Text& value) +ostream& operator<<(ostream& stream, const Value::Text& value) { return stream << value.value(); } -bool operator == (const Value::Text& left, const Value::Text& right) +bool operator==(const Value::Text& left, const Value::Text& right) { return left.value() == right.value(); } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/jvm/jvm.hpp ---------------------------------------------------------------------- diff --git a/src/jvm/jvm.hpp b/src/jvm/jvm.hpp index 90febda..3b1bdee 100644 --- a/src/jvm/jvm.hpp +++ b/src/jvm/jvm.hpp @@ -266,7 +266,7 @@ public: } } - Object& operator = (const Object& that) + Object& operator=(const Object& that) { if (object != NULL) { Jvm::get()->deleteGlobalRef(object); @@ -278,7 +278,7 @@ public: return *this; } - operator jobject () const + operator jobject() const { return object; } @@ -315,7 +315,7 @@ public: // This requires implementing Jvm::getField too. template <typename U> - Variable& operator = (const U& u) + Variable& operator=(const U& u) { // Check that U extends Object (but not necessarily T since U // might be 'Null'). @@ -356,7 +356,7 @@ public: { T* t = NULL; Object* o = t; (void) o; } } - operator T () const + operator T() const { // Note that we actually look up the field lazily (upon first // invocation operator) so that we don't possibly create the JVM @@ -386,9 +386,9 @@ public: explicit Env(bool daemon = true); ~Env(); - JNIEnv* operator -> () const { return env; } + JNIEnv* operator->() const { return env; } - operator JNIEnv* () const { return env; } + operator JNIEnv*() const { return env; } private: JNIEnv* env; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/linux/cgroups.cpp ---------------------------------------------------------------------- diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp index e062fcb..6ef42ed 100644 --- a/src/linux/cgroups.cpp +++ b/src/linux/cgroups.cpp @@ -2297,7 +2297,7 @@ Try<Nothing> disable(const string& hierarchy, const string& cgroup) namespace pressure { -ostream& operator << (ostream& stream, Level level) +ostream& operator<<(ostream& stream, Level level) { switch (level) { case LOW: http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/linux/cgroups.hpp ---------------------------------------------------------------------- diff --git a/src/linux/cgroups.hpp b/src/linux/cgroups.hpp index a651f34..a4a2cae 100644 --- a/src/linux/cgroups.hpp +++ b/src/linux/cgroups.hpp @@ -580,7 +580,7 @@ enum Level { }; -std::ostream& operator << (std::ostream& stream, Level level); +std::ostream& operator<<(std::ostream& stream, Level level); // Forward declaration. http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/linux/routing/filter/basic.hpp ---------------------------------------------------------------------- diff --git a/src/linux/routing/filter/basic.hpp b/src/linux/routing/filter/basic.hpp index fea8976..38bc8f5 100644 --- a/src/linux/routing/filter/basic.hpp +++ b/src/linux/routing/filter/basic.hpp @@ -51,7 +51,7 @@ struct Classifier explicit Classifier(uint16_t _protocol) : protocol(_protocol) {} - bool operator == (const Classifier& that) const + bool operator==(const Classifier& that) const { return protocol == that.protocol; } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/linux/routing/filter/icmp.hpp ---------------------------------------------------------------------- diff --git a/src/linux/routing/filter/icmp.hpp b/src/linux/routing/filter/icmp.hpp index b732193..68ecde5 100644 --- a/src/linux/routing/filter/icmp.hpp +++ b/src/linux/routing/filter/icmp.hpp @@ -42,7 +42,7 @@ struct Classifier explicit Classifier(const Option<net::IP>& _destinationIP) : destinationIP(_destinationIP) {} - bool operator == (const Classifier& that) const + bool operator==(const Classifier& that) const { return destinationIP == that.destinationIP; } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/linux/routing/filter/ip.hpp ---------------------------------------------------------------------- diff --git a/src/linux/routing/filter/ip.hpp b/src/linux/routing/filter/ip.hpp index ec6f643..0a77861 100644 --- a/src/linux/routing/filter/ip.hpp +++ b/src/linux/routing/filter/ip.hpp @@ -70,7 +70,7 @@ public: // Returns the mask (in host order) of this port range. uint16_t mask() const { return ~(end_ - begin_); } - bool operator == (const PortRange& that) const + bool operator==(const PortRange& that) const { return begin_ == that.begin_ && end_ == that.end_; } @@ -84,7 +84,7 @@ private: }; -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const PortRange& range) { @@ -113,7 +113,7 @@ struct Classifier sourcePorts(_sourcePorts), destinationPorts(_destinationPorts) {} - bool operator == (const Classifier& that) const + bool operator==(const Classifier& that) const { return (destinationMAC == that.destinationMAC && destinationIP == that.destinationIP && http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/linux/routing/handle.hpp ---------------------------------------------------------------------- diff --git a/src/linux/routing/handle.hpp b/src/linux/routing/handle.hpp index 052c7cc..53903f6 100644 --- a/src/linux/routing/handle.hpp +++ b/src/linux/routing/handle.hpp @@ -49,12 +49,12 @@ public: constexpr Handle(const Handle& parent, uint16_t id) : handle((((uint32_t) parent.primary()) << 16) + id) {} - constexpr bool operator == (const Handle& that) const + constexpr bool operator==(const Handle& that) const { return handle == that.handle; } - constexpr bool operator != (const Handle& that) const + constexpr bool operator!=(const Handle& that) const { return handle != that.handle; } @@ -68,7 +68,7 @@ protected: }; -inline std::ostream& operator << (std::ostream& out, const Handle& handle) +inline std::ostream& operator<<(std::ostream& out, const Handle& handle) { out << std::hex << handle.primary() << ":" << handle.secondary() << std::dec; return out; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/log/log.hpp ---------------------------------------------------------------------- diff --git a/src/log/log.hpp b/src/log/log.hpp index 7c905c7..040e4b8 100644 --- a/src/log/log.hpp +++ b/src/log/log.hpp @@ -57,27 +57,27 @@ public: class Position { public: - bool operator == (const Position& that) const + bool operator==(const Position& that) const { return value == that.value; } - bool operator < (const Position& that) const + bool operator<(const Position& that) const { return value < that.value; } - bool operator <= (const Position& that) const + bool operator<=(const Position& that) const { return value <= that.value; } - bool operator > (const Position& that) const + bool operator>(const Position& that) const { return value > that.value; } - bool operator >= (const Position& that) const + bool operator>=(const Position& that) const { return value >= that.value; } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/log/network.hpp ---------------------------------------------------------------------- diff --git a/src/log/network.hpp b/src/log/network.hpp index ff3496b..4ea097b 100644 --- a/src/log/network.hpp +++ b/src/log/network.hpp @@ -100,7 +100,7 @@ public: private: // Not copyable, not assignable. Network(const Network&); - Network& operator = (const Network&); + Network& operator=(const Network&); NetworkProcess* process; }; @@ -121,7 +121,7 @@ private: // Not copyable, not assignable. ZooKeeperNetwork(const ZooKeeperNetwork&); - ZooKeeperNetwork& operator = (const ZooKeeperNetwork&); + ZooKeeperNetwork& operator=(const ZooKeeperNetwork&); // Helper that sets up a watch on the group. void watch(const std::set<zookeeper::Group::Membership>& expected); @@ -256,7 +256,7 @@ private: // Not copyable, not assignable. NetworkProcess(const NetworkProcess&); - NetworkProcess& operator = (const NetworkProcess&); + NetworkProcess& operator=(const NetworkProcess&); // Notifies the change of the network. void update() http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/master/allocator/sorter/drf/sorter.cpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/sorter/drf/sorter.cpp b/src/master/allocator/sorter/drf/sorter.cpp index 85eef6b..bfc2734 100644 --- a/src/master/allocator/sorter/drf/sorter.cpp +++ b/src/master/allocator/sorter/drf/sorter.cpp @@ -29,7 +29,7 @@ namespace internal { namespace master { namespace allocator { -bool DRFComparator::operator () (const Client& client1, const Client& client2) +bool DRFComparator::operator()(const Client& client1, const Client& client2) { if (client1.share == client2.share) { if (client1.allocations == client2.allocations) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/master/allocator/sorter/drf/sorter.hpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/sorter/drf/sorter.hpp b/src/master/allocator/sorter/drf/sorter.hpp index 6aec14f..f66ade0 100644 --- a/src/master/allocator/sorter/drf/sorter.hpp +++ b/src/master/allocator/sorter/drf/sorter.hpp @@ -56,7 +56,7 @@ struct Client struct DRFComparator { virtual ~DRFComparator() {} - virtual bool operator () (const Client& client1, const Client& client2); + virtual bool operator()(const Client& client1, const Client& client2); }; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index 28356e4..10cc100 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -327,11 +327,11 @@ struct Slave private: Slave(const Slave&); // No copying. - Slave& operator = (const Slave&); // No assigning. + Slave& operator=(const Slave&); // No assigning. }; -inline std::ostream& operator << (std::ostream& stream, const Slave& slave) +inline std::ostream& operator<<(std::ostream& stream, const Slave& slave) { return stream << slave.id << " at " << slave.pid << " (" << slave.info.hostname() << ")"; @@ -854,7 +854,7 @@ private: }; Master(const Master&); // No copying. - Master& operator = (const Master&); // No assigning. + Master& operator=(const Master&); // No assigning. friend struct Framework; friend struct Metrics; @@ -1238,7 +1238,7 @@ private: }; -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const Framework& framework); @@ -1630,11 +1630,11 @@ struct Framework private: Framework(const Framework&); // No copying. - Framework& operator = (const Framework&); // No assigning. + Framework& operator=(const Framework&); // No assigning. }; -inline std::ostream& operator << ( + inline std::ostream& operator<<( std::ostream& stream, const Framework& framework) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/master/registrar.hpp ---------------------------------------------------------------------- diff --git a/src/master/registrar.hpp b/src/master/registrar.hpp index c1463c5..c6a0655 100644 --- a/src/master/registrar.hpp +++ b/src/master/registrar.hpp @@ -53,7 +53,7 @@ public: // accumulators, in this case 'slaveIDs'). // Returns whether the operation mutates 'registry', or an error if // the operation cannot be applied successfully. - Try<bool> operator () ( + Try<bool> operator()( Registry* registry, hashset<SlaveID>* slaveIDs, bool strict) http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/messages/flags.hpp ---------------------------------------------------------------------- diff --git a/src/messages/flags.hpp b/src/messages/flags.hpp index 17f8bf3..53afddc 100644 --- a/src/messages/flags.hpp +++ b/src/messages/flags.hpp @@ -52,7 +52,7 @@ inline Try<mesos::internal::Firewall> parse(const std::string& value) namespace mesos { namespace internal { -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const Firewall& rules) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/messages/log.hpp ---------------------------------------------------------------------- diff --git a/src/messages/log.hpp b/src/messages/log.hpp index 4ddf35f..94e38c1 100644 --- a/src/messages/log.hpp +++ b/src/messages/log.hpp @@ -31,7 +31,7 @@ namespace mesos { namespace internal { namespace log { -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const Action::Type& type) { @@ -39,7 +39,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const Metadata::Status& status) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/messages/messages.hpp ---------------------------------------------------------------------- diff --git a/src/messages/messages.hpp b/src/messages/messages.hpp index f7afcf7..275090e 100644 --- a/src/messages/messages.hpp +++ b/src/messages/messages.hpp @@ -68,14 +68,14 @@ Try<std::string> serialize(const T& t) namespace mesos { namespace internal { -bool operator == (const Task& left, const Task& right); +bool operator==(const Task& left, const Task& right); -std::ostream& operator << ( +std::ostream& operator<<( std::ostream& stream, const StatusUpdate& update); -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const StatusUpdateRecord::Type& type) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/slave/gc.hpp ---------------------------------------------------------------------- diff --git a/src/slave/gc.hpp b/src/slave/gc.hpp index 780f9c9..0e83c47 100644 --- a/src/slave/gc.hpp +++ b/src/slave/gc.hpp @@ -109,7 +109,7 @@ private: process::Owned<process::Promise<Nothing> > _promise) : path(_path), promise(_promise) {} - bool operator == (const PathInfo& that) const + bool operator==(const PathInfo& that) const { return path == that.path && promise == that.promise; } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 9061e67..6adb488 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -5252,7 +5252,7 @@ bool Executor::isCommandExecutor() const } -std::ostream& operator << (std::ostream& stream, Slave::State state) +std::ostream& operator<<(std::ostream& stream, Slave::State state) { switch (state) { case Slave::RECOVERING: return stream << "RECOVERING"; @@ -5264,7 +5264,7 @@ std::ostream& operator << (std::ostream& stream, Slave::State state) } -std::ostream& operator << (std::ostream& stream, Framework::State state) +std::ostream& operator<<(std::ostream& stream, Framework::State state) { switch (state) { case Framework::RUNNING: return stream << "RUNNING"; @@ -5274,7 +5274,7 @@ std::ostream& operator << (std::ostream& stream, Framework::State state) } -std::ostream& operator << (std::ostream& stream, Executor::State state) +std::ostream& operator<<(std::ostream& stream, Executor::State state) { switch (state) { case Executor::REGISTERING: return stream << "REGISTERING"; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/slave/slave.hpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp index 41d0949..02b7115 100644 --- a/src/slave/slave.hpp +++ b/src/slave/slave.hpp @@ -418,7 +418,7 @@ private: friend struct Metrics; Slave(const Slave&); // No copying. - Slave& operator = (const Slave&); // No assigning. + Slave& operator=(const Slave&); // No assigning. // Gauge methods. double _frameworks_active() @@ -623,7 +623,7 @@ struct Executor private: Executor(const Executor&); // No copying. - Executor& operator = (const Executor&); // No assigning. + Executor& operator=(const Executor&); // No assigning. bool commandExecutor; }; @@ -678,13 +678,13 @@ struct Framework boost::circular_buffer<process::Owned<Executor>> completedExecutors; private: Framework(const Framework&); // No copying. - Framework& operator = (const Framework&); // No assigning. + Framework& operator=(const Framework&); // No assigning. }; -std::ostream& operator << (std::ostream& stream, Slave::State state); -std::ostream& operator << (std::ostream& stream, Framework::State state); -std::ostream& operator << (std::ostream& stream, Executor::State state); +std::ostream& operator<<(std::ostream& stream, Slave::State state); +std::ostream& operator<<(std::ostream& stream, Framework::State state); +std::ostream& operator<<(std::ostream& stream, Executor::State state); } // namespace slave { } // namespace internal { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/state/log.cpp ---------------------------------------------------------------------- diff --git a/src/state/log.cpp b/src/state/log.cpp index 7b58b93..a75a605 100644 --- a/src/state/log.cpp +++ b/src/state/log.cpp @@ -194,7 +194,7 @@ private: }; // All known snapshots indexed by name. Note that 'hashmap::get' - // must be used instead of 'operator []' since Snapshot doesn't have + // must be used instead of 'operator[]' since Snapshot doesn't have // a default/empty constructor. hashmap<string, Snapshot> snapshots; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/tests/cluster.hpp ---------------------------------------------------------------------- diff --git a/src/tests/cluster.hpp b/src/tests/cluster.hpp index ba17c0c..422ebd1 100644 --- a/src/tests/cluster.hpp +++ b/src/tests/cluster.hpp @@ -122,7 +122,7 @@ public: private: // Not copyable, not assignable. Masters(const Masters&); - Masters& operator = (const Masters&); + Masters& operator=(const Masters&); Cluster* cluster; // Enclosing class. Option<zookeeper::URL> url; @@ -187,7 +187,7 @@ public: private: // Not copyable, not assignable. Slaves(const Slaves&); - Slaves& operator = (const Slaves&); + Slaves& operator=(const Slaves&); Cluster* cluster; // Enclosing class. Masters* masters; // Used to create MasterDetector instances. @@ -232,7 +232,7 @@ public: private: // Not copyable, not assignable. Cluster(const Cluster&); - Cluster& operator = (const Cluster&); + Cluster& operator=(const Cluster&); }; http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/tests/containerizer/docker_containerizer_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/containerizer/docker_containerizer_tests.cpp b/src/tests/containerizer/docker_containerizer_tests.cpp index 80ed60e..fb86cfe 100644 --- a/src/tests/containerizer/docker_containerizer_tests.cpp +++ b/src/tests/containerizer/docker_containerizer_tests.cpp @@ -1931,7 +1931,7 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_SlaveRecoveryTaskContainer) // slave recovers it can't reconnect and instead destroys that // container. In particular, it uses '0' for it's IP which we properly // parse and can even properly use for sending other messages, but the -// current implementation of 'UPID::operator bool ()' fails if the IP +// current implementation of 'UPID::operator bool()' fails if the IP // component of a PID is '0'. TEST_F(DockerContainerizerTest, DISABLED_ROOT_DOCKER_SlaveRecoveryExecutorContainer) http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/zookeeper/authentication.hpp ---------------------------------------------------------------------- diff --git a/src/zookeeper/authentication.hpp b/src/zookeeper/authentication.hpp index 1c50307..5919ec0 100644 --- a/src/zookeeper/authentication.hpp +++ b/src/zookeeper/authentication.hpp @@ -53,7 +53,7 @@ extern const ACL_vector EVERYONE_READ_CREATOR_ALL; extern const ACL_vector EVERYONE_CREATE_AND_READ_CREATOR_ALL; -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const Authentication& authentication) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/zookeeper/group.hpp ---------------------------------------------------------------------- diff --git a/src/zookeeper/group.hpp b/src/zookeeper/group.hpp index 9e0ed32..8021e3b 100644 --- a/src/zookeeper/group.hpp +++ b/src/zookeeper/group.hpp @@ -58,32 +58,32 @@ public: // from different Group instances will still be considered the same. struct Membership { - bool operator == (const Membership& that) const + bool operator==(const Membership& that) const { return sequence == that.sequence; } - bool operator != (const Membership& that) const + bool operator!=(const Membership& that) const { return sequence != that.sequence; } - bool operator < (const Membership& that) const + bool operator<(const Membership& that) const { return sequence < that.sequence; } - bool operator <= (const Membership& that) const + bool operator<=(const Membership& that) const { return sequence <= that.sequence; } - bool operator > (const Membership& that) const + bool operator>(const Membership& that) const { return sequence > that.sequence; } - bool operator >= (const Membership& that) const + bool operator>=(const Membership& that) const { return sequence >= that.sequence; } http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/zookeeper/url.hpp ---------------------------------------------------------------------- diff --git a/src/zookeeper/url.hpp b/src/zookeeper/url.hpp index b4253e8..eadde8e 100644 --- a/src/zookeeper/url.hpp +++ b/src/zookeeper/url.hpp @@ -110,7 +110,7 @@ inline Try<URL> URL::parse(const std::string& url) } } -inline std::ostream& operator << (std::ostream& stream, const URL& url) +inline std::ostream& operator<<(std::ostream& stream, const URL& url) { stream << URL::scheme(); if (url.authentication.isSome()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/dffa167f/src/zookeeper/zookeeper.hpp ---------------------------------------------------------------------- diff --git a/src/zookeeper/zookeeper.hpp b/src/zookeeper/zookeeper.hpp index 6d21ed8..c799506 100644 --- a/src/zookeeper/zookeeper.hpp +++ b/src/zookeeper/zookeeper.hpp @@ -328,7 +328,7 @@ protected: private: /* ZooKeeper instances are not copyable. */ ZooKeeper(const ZooKeeper& that); - ZooKeeper& operator = (const ZooKeeper& that); + ZooKeeper& operator=(const ZooKeeper& that); };
