Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: components/rappor/bytevector.h

Issue 49753002: RAPPOR implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/rappor/bytevector.h
diff --git a/components/rappor/bytevector.h b/components/rappor/bytevector.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c712695575ea1ffe89f409194e76f43061c031d
--- /dev/null
+++ b/components/rappor/bytevector.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_RAPPOR_BYTEVECTOR_H_
+#define COMPONENTS_RAPPOR_BYTEVECTOR_H_
+
+#include <stddef.h>
+#include <stdint.h>
+#include <vector>
+
+// ByteVector is a class that extends a vector of one byte integers with
+// methods for manipulating it's content as a set of binary bits.
+
+namespace rappor {
+
+class ByteVector : public std::vector<uint8_t> {
+ public:
+ explicit ByteVector(size_t bytes_size);
+ explicit ByteVector(const std::vector<uint8_t>& v);
+ ByteVector(const char* bytes, int bytes_size);
+
+ // Computes a bitwise AND of this and another byte vector. Both byte vectors
+ // must be the same size.
+ ByteVector And(ByteVector rhs) const;
+
+ // Computes a bitwise OR of this and another byte vector. Both byte vectors
+ // must be the same size.
+ ByteVector Or(ByteVector rhs) const;
+
+ // Computes a bitwise inversion of this byte vector.
+ ByteVector Not() const;
+};
+
+} // namespace rappor
+
+#endif // COMPONENTS_RAPPOR_BYTEVECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698