OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_RAPPOR_BYTEVECTOR_H_ |
| 6 #define COMPONENTS_RAPPOR_BYTEVECTOR_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 #include <vector> |
| 11 |
| 12 // ByteVector is a class that extends a vector of one byte integers with |
| 13 // methods for manipulating it's content as a set of binary bits. |
| 14 |
| 15 namespace rappor { |
| 16 |
| 17 class ByteVector : public std::vector<uint8_t> { |
| 18 public: |
| 19 explicit ByteVector(size_t bytes_size); |
| 20 explicit ByteVector(const std::vector<uint8_t>& v); |
| 21 ByteVector(const char* bytes, int bytes_size); |
| 22 |
| 23 // Computes a bitwise AND of this and another byte vector. Both byte vectors |
| 24 // must be the same size. |
| 25 ByteVector And(ByteVector rhs) const; |
| 26 |
| 27 // Computes a bitwise OR of this and another byte vector. Both byte vectors |
| 28 // must be the same size. |
| 29 ByteVector Or(ByteVector rhs) const; |
| 30 |
| 31 // Computes a bitwise inversion of this byte vector. |
| 32 ByteVector Not() const; |
| 33 }; |
| 34 |
| 35 } // namespace rappor |
| 36 |
| 37 #endif // COMPONENTS_RAPPOR_BYTEVECTOR_H_ |
OLD | NEW |