Skip to content
Snippets Groups Projects
Commit 3b7feb88 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix character label

parent b9d69a8b
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
 
#include "StringLabel.h"
#include "IntegerLabel.h"
#include "CharacterLabel.h"
 
namespace label {
 
......@@ -25,6 +26,10 @@ bool LabelBase::operator<(const IntegerLabel& other) const {
return typeid(*this).before(typeid(other));
}
 
bool LabelBase::operator<(const CharacterLabel& other) const {
return typeid(*this).before(typeid(other));
}
bool LabelBase::operator>=(const LabelBase& other) const {
return !(*this < other);
}
......@@ -45,6 +50,10 @@ bool LabelBase::operator==(const IntegerLabel&) const {
return false;
}
 
bool LabelBase::operator==(const CharacterLabel&) const {
return false;
}
std::ostream& operator<<(std::ostream& os, const LabelBase& label) {
label >> os;
return os;
......
......@@ -34,6 +34,8 @@ public:
virtual bool operator<(const IntegerLabel& other) const;
virtual bool operator<(const CharacterLabel& other) const;
virtual bool operator>(const LabelBase& other) const = 0;
 
......@@ -50,6 +52,8 @@ public:
 
virtual bool operator==(const IntegerLabel& other) const;
 
virtual bool operator==(const CharacterLabel& other) const;
friend std::ostream& operator<<(std::ostream& os, const LabelBase& label);
 
virtual void operator>>(std::ostream&) const = 0;
......
......@@ -26,7 +26,7 @@ void LabelToStringComposer::Visit(void* userData, const label::StringLabel& labe
std::string tmp = label.getData();
replace(tmp, "'", "\\'" );
out << tmp;
out << '\'' << tmp << '\'';
}
 
void LabelToStringComposer::Visit(void* userData, const CharacterLabel& symbol) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment