First cut at minibind classes.
[minibind.git] / jni / minibind / parcel.h
1 // Copyright 2015 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 MINIBIND_PARCEL_H_
6 #define MINIBIND_PARCEL_H_
7
8 #include <stdint.h>
9 #include <sys/types.h>
10
11 #include <linux/binder.h>
12
13 #include <string>
14 #include <vector>
15
16 namespace minibind {
17
18 class Parcel {
19 public:
20 Parcel();
21 ~Parcel();
22
23 void WriteInterfaceToken(const std::string& str);
24 void WriteUTF8(const std::string& str);
25 void WriteUInt32(uint32_t ui32);
26
27 binder_uintptr_t DataPointer() const;
28 size_t DataSize() const;
29 void SetDataSize(size_t size);
30
31 void Print() const;
32
33 private:
34 std::vector<uint8_t> data_;
35 std::vector<struct flat_binder_object> objects_;
36 };
37
38 } // namespace minibind
39
40 #endif // MINIBIND_PARCEL_H_