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

Side by Side Diff: src/FilterEngine.cpp

Issue 29421562: Noissue - add copy and move constructors and assign operators for Filter (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created April 25, 2017, 8:32 a.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 | « include/AdblockPlus/FilterEngine.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 19 matching lines...) Expand all
30 30
31 extern std::string jsSources[]; 31 extern std::string jsSources[];
32 32
33 Filter::Filter(JsValue&& value) 33 Filter::Filter(JsValue&& value)
34 : JsValue(std::move(value)) 34 : JsValue(std::move(value))
35 { 35 {
36 if (!IsObject()) 36 if (!IsObject())
37 throw std::runtime_error("JavaScript value is not an object"); 37 throw std::runtime_error("JavaScript value is not an object");
38 } 38 }
39 39
40 Filter::Filter(const Filter& src)
41 : JsValue(src)
42 {
43 }
44
45 Filter::Filter(Filter&& src)
46 : JsValue(std::move(src))
47 {
48 }
49
50 Filter& Filter::operator=(const Filter& src)
51 {
52 static_cast<JsValue&>(*this) = src;
53 return *this;
54 }
55
56 Filter& Filter::operator=(Filter&& src)
57 {
58 static_cast<JsValue&>(*this) = std::move(src);
59 return *this;
60 }
61
40 Filter::Type Filter::GetType() const 62 Filter::Type Filter::GetType() const
41 { 63 {
42 std::string className = GetClass(); 64 std::string className = GetClass();
43 if (className == "BlockingFilter") 65 if (className == "BlockingFilter")
44 return TYPE_BLOCKING; 66 return TYPE_BLOCKING;
45 else if (className == "WhitelistFilter") 67 else if (className == "WhitelistFilter")
46 return TYPE_EXCEPTION; 68 return TYPE_EXCEPTION;
47 else if (className == "ElemHideFilter") 69 else if (className == "ElemHideFilter")
48 return TYPE_ELEMHIDE; 70 return TYPE_ELEMHIDE;
49 else if (className == "ElemHideException") 71 else if (className == "ElemHideException")
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); 595 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url);
574 if (filter) 596 if (filter)
575 { 597 {
576 return filter; 598 return filter;
577 } 599 }
578 currentUrl = parentUrl; 600 currentUrl = parentUrl;
579 } 601 }
580 while (urlIterator != documentUrls.end()); 602 while (urlIterator != documentUrls.end());
581 return FilterPtr(); 603 return FilterPtr();
582 } 604 }
OLDNEW
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld