Chromium Code Reviews| 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. |
|
Alexei Svitkine (slow)
2013/12/19 19:47:02
Nit: Move this comment above the class decl.
Steven Holte
2013/12/20 03:03:55
Changed class to typedef and moved+updated comment
|
| + |
| +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); |
|
Alexei Svitkine (slow)
2013/12/19 19:47:02
Document these ctor's.
Steven Holte
2013/12/20 03:03:55
N/A
|
| + |
| + // Computes a bitwise AND of this and another byte vector. Both byte vectors |
| + // must be the same size. |
| + ByteVector And(ByteVector rhs) const; |
|
Alexei Svitkine (slow)
2013/12/19 19:47:02
I'm not convinced we need a ByteVector class. Can
Steven Holte
2013/12/20 03:03:55
Changed ByteVector to a typedef and these to free-
|
| + |
| + // 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_ |