Map : add member-by-member comparison op

This commit is contained in:
artemp 2014-05-27 11:34:39 +01:00
parent 68300b92b5
commit 9972680020
2 changed files with 25 additions and 6 deletions

View file

@ -121,14 +121,12 @@ public:
// let compiler generate move ctor
Map(Map && other) = default;
/*! \brief Assignment operator
*
* TODO: to be documented
*
*/
// assignment operator
Map& operator=(Map rhs);
// comparison op
bool operator==(Map const& other) const;
/*! \brief Get all styles
* @return Const reference to styles
*/

View file

@ -130,6 +130,27 @@ void swap (Map & lhs, Map & rhs)
std::swap(lhs.extra_params_, rhs.extra_params_);
}
bool Map::operator==(Map const& rhs) const
{
return (width_ = rhs.width_) &&
(height_ == rhs.height_) &&
(srs_ == rhs.srs_) &&
(buffer_size_ == rhs.buffer_size_) &&
(background_ == rhs.background_) &&
(background_image_ == rhs.background_image_) &&
(background_image_comp_op_ == rhs.background_image_comp_op_) &&
(background_image_opacity_ == rhs.background_image_opacity_) &&
(styles_ == rhs.styles_) &&
(fontsets_ == rhs.fontsets_) &&
(layers_ == rhs.layers_) &&
(aspectFixMode_ == rhs.aspectFixMode_) &&
(current_extent_ == rhs.current_extent_) &&
(maximum_extent_ == rhs.maximum_extent_) &&
(base_path_ == rhs.base_path_) &&
(extra_params_ == rhs.extra_params_);
}
std::map<std::string,feature_type_style> const& Map::styles() const
{
return styles_;