specialize std::hash for border::side and get rid of border::default

This commit is contained in:
Thomas Fussell 2016-08-01 18:47:17 -04:00
parent 4234a62b8b
commit 69bd89da63
2 changed files with 29 additions and 18 deletions

View File

@ -36,22 +36,41 @@
namespace xlnt {
enum class XLNT_CLASS border_side
{
start,
end,
top,
bottom,
diagonal,
vertical,
horizontal
};
} // namespace xlnt
namespace std {
template<>
struct hash<xlnt::border_side>
{
size_t operator()(const xlnt::border_side &k) const
{
return static_cast<std::size_t>(k);
}
};
} // namepsace std
namespace xlnt {
/// <summary>
/// Describes the border style of a particular cell.
/// </summary>
class XLNT_CLASS border : public hashable
{
public:
enum class XLNT_CLASS side
{
start,
end,
top,
bottom,
diagonal,
vertical,
horizontal
};
using side = border_side;
class XLNT_CLASS border_property
{
@ -72,14 +91,11 @@ public:
border_style style_;
};
static border default();
static const std::unordered_map<side, std::string> &get_side_names();
border();
bool has_side(side s) const;
border_property &get_side(side s);
const border_property &get_side(side s) const;
void set_side(side s, const border_property &prop);

View File

@ -69,11 +69,6 @@ void border::border_property::set_style(border_style s)
style_ = s;
}
border border::default()
{
return border();
}
border::border()
{
sides_ =