Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #include "CommentFilter.h" | 1 #include "CommentFilter.h" |
2 | 2 |
3 CommentFilter::CommentFilter(const std::u16string& text) | 3 CommentFilter::CommentFilter(const String& text) |
4 : Filter(text) | 4 : Filter(Type::COMMENT, text) |
5 { | 5 { |
6 } | 6 } |
7 | 7 |
8 Filter::Type CommentFilter::Parse(const std::u16string& text) | 8 Filter::Type CommentFilter::Parse(const String& text) |
9 { | 9 { |
10 if (text.length() && text[0] == u'!') | 10 if (text.length() && text[0] == u'!') |
11 return Type::COMMENT; | 11 return Type::COMMENT; |
12 else | 12 else |
13 return Type::UNKNOWN; | 13 return Type::UNKNOWN; |
14 } | 14 } |
15 | 15 |
16 CommentFilter* CommentFilter::Create(const std::u16string& text) | 16 CommentFilter* CommentFilter::Create(const String& text) |
17 { | 17 { |
18 Type type = Parse(text); | 18 Type type = Parse(text); |
19 if (type == Type::UNKNOWN) | 19 if (type == Type::COMMENT) |
Felix Dahlke
2016/01/15 17:00:35
IMHO it'd make more sense to check for type != Typ
Wladimir Palant
2016/01/15 20:36:15
Done.
| |
20 return new CommentFilter(text); | |
21 else | |
20 return nullptr; | 22 return nullptr; |
21 else | |
22 return new CommentFilter(text); | |
23 } | 23 } |
24 | |
25 Filter::Type CommentFilter::get_type() | |
26 { | |
27 return Type::COMMENT; | |
28 } | |
LEFT | RIGHT |