Skip to content
Snippets Groups Projects
Commit 78456b44 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

BoundaryDescriptor now compares to RefId

parent 77e6ceeb
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,11 @@ class BoundaryDescriptor ...@@ -23,6 +23,11 @@ class BoundaryDescriptor
return bd._write(os); return bd._write(os);
} }
virtual bool operator==(const RefId& ref_id) const =0;
friend bool operator==(const RefId& ref_id, const BoundaryDescriptor& bcd)
{
return bcd == ref_id;
}
virtual Type type() const = 0; virtual Type type() const = 0;
BoundaryDescriptor(const BoundaryDescriptor&) = default; BoundaryDescriptor(const BoundaryDescriptor&) = default;
BoundaryDescriptor() = default; BoundaryDescriptor() = default;
...@@ -42,6 +47,11 @@ class NamedBoundaryDescriptor ...@@ -42,6 +47,11 @@ class NamedBoundaryDescriptor
} }
public: public:
bool operator==(const RefId& ref_id) const final
{
return m_name == ref_id.tagName();
}
Type type() const final Type type() const final
{ {
return Type::named; return Type::named;
...@@ -60,7 +70,7 @@ class NumberedBoundaryDescriptor ...@@ -60,7 +70,7 @@ class NumberedBoundaryDescriptor
: public BoundaryDescriptor : public BoundaryDescriptor
{ {
private: private:
int m_number; unsigned int m_number;
std::ostream& _write(std::ostream& os) const final std::ostream& _write(std::ostream& os) const final
{ {
...@@ -68,6 +78,11 @@ class NumberedBoundaryDescriptor ...@@ -68,6 +78,11 @@ class NumberedBoundaryDescriptor
return os; return os;
} }
bool operator==(const RefId& ref_id) const final
{
return m_number == ref_id.tagNumber();
}
public: public:
Type type() const final Type type() const final
{ {
...@@ -75,7 +90,7 @@ class NumberedBoundaryDescriptor ...@@ -75,7 +90,7 @@ class NumberedBoundaryDescriptor
} }
NumberedBoundaryDescriptor(const NumberedBoundaryDescriptor&) = default; NumberedBoundaryDescriptor(const NumberedBoundaryDescriptor&) = default;
NumberedBoundaryDescriptor(const int& number) NumberedBoundaryDescriptor(const unsigned int& number)
: m_number(number) : m_number(number)
{ {
; ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment