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

Side by Side Diff: compiled/bindings.cpp

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Patch Set: Split up String class into two, cleaned up RegExpFilter methods Created Feb. 4, 2016, 7:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/bindings.h ('k') | compiled/debug.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "bindings.h"
2 #include "Filter.h"
3 #include "InvalidFilter.h"
4 #include "CommentFilter.h"
5 #include "ActiveFilter.h"
6 #include "RegExpFilter.h"
7 #include "WhitelistFilter.h"
8 #include "ElemHideBase.h"
9 #include "ElemHideFilter.h"
10 #include "ElemHideException.h"
11 #include "CSSPropertyFilter.h"
12
13 EMSCRIPTEN_BINDINGS
14 {
15 class_<Filter>("Filter")
16 .property("text", &Filter::GetText)
17 .function("serialize", &Filter::Serialize)
18 .class_function("fromText", &Filter::FromText)
19 .class_function("getKnownFilter", &Filter::GetKnownFilter)
20 .subclass_differentiator(&Filter::GetType, {
21 {Filter::Type::INVALID, "InvalidFilter"},
22 {Filter::Type::COMMENT, "CommentFilter"},
23 {Filter::Type::BLOCKING, "RegExpFilter"},
24 {Filter::Type::WHITELIST, "WhitelistFilter"},
25 {Filter::Type::ELEMHIDE, "ElemHideFilter"},
26 {Filter::Type::ELEMHIDEEXCEPTION, "ElemHideException"},
27 {Filter::Type::CSSPROPERTY, "CSSPropertyFilter"},
28 });
29
30 class_<InvalidFilter,Filter>("InvalidFilter")
31 .class_property("type", "'invalid'")
32 .property("reason", &InvalidFilter::GetReason);
33
34 class_<CommentFilter,Filter>("CommentFilter")
35 .class_property("type", "'comment'");
36
37 class_<ActiveFilter,Filter>("ActiveFilter")
38 .property("disabled", &ActiveFilter::GetDisabled, &ActiveFilter::SetDisabl ed)
39 .property("hitCount", &ActiveFilter::GetHitCount, &ActiveFilter::SetHitCou nt)
40 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHit)
41 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain)
42 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain)
43 .function("isGeneric", &ActiveFilter::IsGeneric)
44 .function("serialize", &ActiveFilter::Serialize);
45
46 class_<RegExpFilter,ActiveFilter>("RegExpFilter")
47 .class_property("type", "'blocking'")
48 .function("matches", &RegExpFilter::Matches)
49 .class_initializer(&RegExpFilter::InitJSTypes);
50
51 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter")
52 .class_property("type", "'whitelist'");
53
54 class_<ElemHideBase,ActiveFilter>("ElemHideBase")
55 .property("selector", &ElemHideBase::GetSelector)
56 .property("selectorDomain", &ElemHideBase::GetSelectorDomain);
57
58 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter")
59 .class_property("type", "'elemhide'");
60
61 class_<ElemHideException,ElemHideBase>("ElemHideException")
62 .class_property("type", "'elemhideexception'");
63
64 class_<CSSPropertyFilter,ElemHideBase>("CSSPropertyFilter")
65 .class_property("type", "'cssproperty'")
66 .property("regexpString", &CSSPropertyFilter::GetRegExpString)
67 .property("selectorPrefix", &CSSPropertyFilter::GetSelectorPrefix)
68 .property("selectorSuffix", &CSSPropertyFilter::GetSelectorSuffix);
69 }
OLDNEW
« no previous file with comments | « compiled/bindings.h ('k') | compiled/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld