forked from brave-experiments/ad-block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
context_domain.h
64 lines (50 loc) · 1.34 KB
/
context_domain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Copyright (c) 2015 Brian R. Bondy. Distributed under the MPL2 license.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CONTEXT_DOMAIN_H_
#define CONTEXT_DOMAIN_H_
#include <string.h>
#include "./base.h"
// This class must operate off of borrowed memory
// Serialization and deserialization is not supported intentionally.
class ContextDomain {
public:
uint64_t GetHash() const;
~ContextDomain() {
}
ContextDomain(const char* start, int len) {
start_ = start;
len_ = len;
}
ContextDomain(const ContextDomain &rhs) {
start_ = rhs.start_;
len_ = rhs.len_;
}
ContextDomain() : start_(nullptr), len_(0) {
}
bool operator==(const ContextDomain&rhs) const {
if (!start_ || !rhs.start_) {
return false;
}
if (len_ != rhs.len_) {
return false;
}
return !memcmp(start_, rhs.start_, len_);
}
bool operator!=(const ContextDomain &rhs) const {
return !(*this == rhs);
}
void Update(const ContextDomain &other) {
}
uint32_t Serialize(char* buffer) {
return 0;
}
uint32_t Deserialize(char* buffer, uint32_t buffer_size) {
return 0;
}
private:
const char* start_;
int len_;
};
#endif // CONTEXT_DOMAIN_H_