• 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 WriteString(const std::string &) = 0;
36 
37     virtual bool ReadUint32(uint32_t &) = 0;
38 
39     virtual bool ReadString(const std::string &) = 0;
40 
41     virtual bool ReadUint16(uint16_t) = 0;
42 
43     virtual bool ReadBool(bool) = 0;
44 };
45 
46 class Parcelable {
47 public:
48     Parcelable() = default;
49     virtual ~Parcelable() = default;
50     virtual bool Marshalling(Parcel &parcel) const = 0;
51 };
52 }  // namespace OHOS::NetsysNative
53 
54 namespace OHOS::NetManagerStandard {
55 class Parcelable;
56 class Parcel {
57 public:
Parcel()58     Parcel() {}
59     virtual ~Parcel() = default;
60 
61     virtual bool WriteUint32(uint32_t) = 0;
62 
63     virtual bool WriteUint16(uint16_t) = 0;
64 
65     virtual bool WriteBool(bool) = 0;
66 
67     virtual bool WriteString(const std::string &) = 0;
68 
69     virtual bool ReadUint32(uint32_t) = 0;
70 
71     virtual bool ReadString(const std::string &) = 0;
72 
73     virtual bool ReadUint16(uint16_t) = 0;
74 
75     virtual bool ReadBool(bool) = 0;
76 };
77 
78 class Parcelable {
79 public:
80     Parcelable() = default;
81     virtual ~Parcelable() = default;
82     virtual bool Marshalling(Parcel &parcel) const = 0;
83 };
84 }  // namespace OHOS::NetManagerStandard
85 #endif
86