1 /*
2 * Copyright 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "fields/padding_field.h"
18 #include "util.h"
19
20 const std::string PaddingField::kFieldType = "PaddingField";
21
PaddingField(int size,ParseLocation loc)22 PaddingField::PaddingField(int size, ParseLocation loc)
23 : PacketField("padding_" + std::to_string(size * 8), loc), size_(size * 8) {}
24
GetFieldType() const25 const std::string& PaddingField::GetFieldType() const {
26 return PaddingField::kFieldType;
27 }
28
GetSize() const29 Size PaddingField::GetSize() const {
30 return size_;
31 }
32
GetBuilderSize() const33 Size PaddingField::GetBuilderSize() const {
34 return 0;
35 }
36
GetDataType() const37 std::string PaddingField::GetDataType() const {
38 return "There's no type for Padding fields";
39 }
40
GenExtractor(std::ostream &,int,bool) const41 void PaddingField::GenExtractor(std::ostream&, int, bool) const {}
42
GetGetterFunctionName() const43 std::string PaddingField::GetGetterFunctionName() const {
44 return "";
45 }
46
GenGetter(std::ostream &,Size,Size) const47 void PaddingField::GenGetter(std::ostream&, Size, Size) const {}
48
GetBuilderParameterType() const49 std::string PaddingField::GetBuilderParameterType() const {
50 return "";
51 }
52
HasParameterValidator() const53 bool PaddingField::HasParameterValidator() const {
54 return false;
55 }
56
GenParameterValidator(std::ostream &) const57 void PaddingField::GenParameterValidator(std::ostream&) const {}
58
GenInserter(std::ostream &) const59 void PaddingField::GenInserter(std::ostream&) const {
60 ERROR(this) << __func__ << ": This should not be called for padding fields";
61 }
62
GenValidator(std::ostream &) const63 void PaddingField::GenValidator(std::ostream&) const {}
64
GetRustDataType() const65 std::string PaddingField::GetRustDataType() const {
66 return "There's no type for Padding fields";
67 }
68
GenRustGetter(std::ostream &,Size,Size) const69 void PaddingField::GenRustGetter(std::ostream&, Size, Size) const {
70 }
71
GenRustWriter(std::ostream &,Size,Size) const72 void PaddingField::GenRustWriter(std::ostream&, Size, Size) const {}
73