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_ |