Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: compiled/CommentFilter.cpp

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Left Patch Set: Using embind Created Jan. 15, 2016, 8:44 p.m.
Right Patch Set: Addressed comments from Patch Set 28 Created March 21, 2017, 10:04 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/CommentFilter.h ('k') | compiled/ElemHideBase.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include <emscripten/bind.h>
2
3 #include "CommentFilter.h" 1 #include "CommentFilter.h"
4 2
5 CommentFilter::CommentFilter(const std::wstring& text) 3 CommentFilter::CommentFilter(const String& text)
6 : Filter(text) 4 : Filter(Type::COMMENT, text)
7 { 5 {
8 } 6 }
9 7
10 Filter::Type CommentFilter::Parse(const std::wstring& text) 8 Filter::Type CommentFilter::Parse(const String& text)
11 { 9 {
12 if (text.length() && text[0] == L'!') 10 if (text.length() && text[0] == u'!')
13 return Type::COMMENT; 11 return Type::COMMENT;
14 else 12 else
15 return Type::UNKNOWN; 13 return Type::UNKNOWN;
16 } 14 }
17 15
18 CommentFilter* CommentFilter::Create(const std::wstring& text) 16 CommentFilter* CommentFilter::Create(const String& text)
19 { 17 {
20 Type type = Parse(text); 18 Type type = Parse(text);
21 if (type == Type::COMMENT) 19 if (type == Type::COMMENT)
22 return new CommentFilter(text); 20 return new CommentFilter(text);
23 else 21 else
24 return nullptr; 22 return nullptr;
25 } 23 }
26
27 Filter::Type CommentFilter::GetType() const
28 {
29 return Type::COMMENT;
30 }
31
32 EMSCRIPTEN_BINDINGS(commentfilter)
33 {
34 using namespace emscripten;
35 class_<CommentFilter,base<Filter>>("CommentFilter");
36 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld