• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef MOCK_NETMANAGERNATIVE_PARCEL
17 #define MOCK_NETMANAGERNATIVE_PARCEL
18 
19 #include <string>
20 #include "refbase.h"
21 
22 namespace OHOS::NetsysNative {
23 class Parcelable;
24 class Parcel {
25 public:
Parcel()26     Parcel() {}
27     virtual ~Parcel() = default;
28 
29     virtual bool WriteUint32(uint32_t) = 0;
30 
31     virtual bool WriteUint16(uint16_t) = 0;
32 
33     virtual bool WriteBool(bool) = 0;
34 
35     virtual bool WriteUint8(uint8_t) = 0;
36 
37     virtual bool WriteUint64(uint64_t) = 0;
38 
39     virtual bool WriteInt32(int32_t) = 0;
40 
41     virtual bool WriteString(const std::string &) = 0;
42 
43     virtual bool ReadUint32(uint32_t &) = 0;
44 
45     virtual bool ReadString(const std::string &) = 0;
46 
47     virtual bool ReadUint16(uint16_t) = 0;
48 
49     virtual bool ReadBool(bool) = 0;
50 
51     virtual bool ReadUint8(uint8_t) = 0;
52 
53     virtual bool ReadUint64(uint64_t) = 0;
54 
55     virtual bool ReadInt32(int32_t) = 0;
56 };
57 
58 class Parcelable {
59 public:
60     Parcelable() = default;
61     virtual ~Parcelable() = default;
62     virtual bool Marshalling(Parcel &parcel) const = 0;
63 };
64 }  // namespace OHOS::NetsysNative
65 
66 namespace OHOS::NetManagerStandard {
67 class Parcelable;
68 class Parcel {
69 public:
Parcel()70     Parcel() {}
71     virtual ~Parcel() = default;
72 
73     virtual bool WriteUint32(uint32_t) = 0;
74 
75     virtual bool WriteUint16(uint16_t) = 0;
76 
77     virtual bool WriteBool(bool) = 0;
78 
79     virtual bool WriteUint8(uint8_t) = 0;
80 
81     virtual bool WriteUint64(uint64_t) = 0;
82 
83     virtual bool WriteInt32(int32_t) = 0;
84 
85     virtual bool WriteString(const std::string &) = 0;
86 
87     virtual bool ReadUint32(uint32_t) = 0;
88 
89     virtual bool ReadString(const std::string &) = 0;
90 
91     virtual bool ReadUint16(uint16_t) = 0;
92 
93     virtual bool ReadBool(bool) = 0;
94 
95     virtual bool ReadUint8(uint8_t) = 0;
96 
97     virtual bool ReadUint64(uint64_t) = 0;
98 
99     virtual bool ReadInt32(int32_t) = 0;
100 };
101 
102 class Parcelable {
103 public:
104     Parcelable() = default;
105     virtual ~Parcelable() = default;
106     virtual bool Marshalling(Parcel &parcel) const = 0;
107 };
108 }  // namespace OHOS::NetManagerStandard
109 #endif
110