diff options
Diffstat (limited to 'src/components/rpc_base/include/rpc_base/rpc_base_inl.h')
-rw-r--r-- | src/components/rpc_base/include/rpc_base/rpc_base_inl.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h index 985e244235..a7b477c009 100644 --- a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h +++ b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h @@ -138,6 +138,10 @@ inline Boolean::Boolean() : PrimitiveType(kUninitialized), value_(false) {} inline Boolean::Boolean(bool value) : PrimitiveType(kValid), value_(value) {} +inline bool Boolean::operator==(const Boolean& that) { + return value_ == that.value_; +} + inline Boolean& Boolean::operator=(bool new_val) { value_ = new_val; value_state_ = kValid; @@ -280,6 +284,21 @@ bool String<minlen, maxlen>::operator==(const String& rhs) const { } template <size_t minlen, size_t maxlen> +bool String<minlen, maxlen>::operator==(const std::string& rhs) const { + return value_ == rhs; +} + +template <size_t minlen, size_t maxlen> +bool String<minlen, maxlen>::operator!=(const String& rhs) const { + return value_ != rhs.value_; +} + +template <size_t minlen, size_t maxlen> +bool String<minlen, maxlen>::operator!=(const std::string& rhs) const { + return value_ != rhs; +} + +template <size_t minlen, size_t maxlen> String<minlen, maxlen>::operator const std::string&() const { return value_; } @@ -365,6 +384,20 @@ bool Array<T, minsize, maxsize>::is_initialized() const { } template <typename T, size_t minsize, size_t maxsize> +bool Array<T, minsize, maxsize>::operator==(const Array& that) { + if (this->size() != that.size()) + return false; + + for (auto i = std::begin(*this), j = std::begin(that); i != std::end(*this); + ++i, ++j) { + if (!(*i == *j)) { + return false; + } + } + return true; +} + +template <typename T, size_t minsize, size_t maxsize> void Array<T, minsize, maxsize>::ReportErrors(ValidationReport* report) const { if (this->empty()) { CompositeType::ReportErrors(report); @@ -571,6 +604,11 @@ const T* Optional<T>::operator->() const { } template <typename T> +bool Optional<T>::operator==(const Optional<T>& that) { + return value_ == that.value_; +} + +template <typename T> void Optional<T>::assign_if_valid(const Optional<T>& value) { if (value.is_initialized()) { value_ = value.value_; |