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 
19 #include "util.h"
20 
21 const std::string PaddingField::kFieldType = "PaddingField";
22 
PaddingField(int size,ParseLocation loc)23 PaddingField::PaddingField(int size, ParseLocation loc)
24     : PacketField("padding_" + std::to_string(size * 8), loc), size_(size * 8) {}
25 
GetFieldType() const26 const std::string& PaddingField::GetFieldType() const { return PaddingField::kFieldType; }
27 
GetSize() const28 Size PaddingField::GetSize() const { return size_; }
29 
GetBuilderSize() const30 Size PaddingField::GetBuilderSize() const { return 0; }
31 
GetDataType() const32 std::string PaddingField::GetDataType() const { return "There's no type for Padding fields"; }
33 
GenExtractor(std::ostream &,int,bool) const34 void PaddingField::GenExtractor(std::ostream&, int, bool) const {}
35 
GetGetterFunctionName() const36 std::string PaddingField::GetGetterFunctionName() const { return ""; }
37 
GenGetter(std::ostream &,Size,Size) const38 void PaddingField::GenGetter(std::ostream&, Size, Size) const {}
39 
GetBuilderParameterType() const40 std::string PaddingField::GetBuilderParameterType() const { return ""; }
41 
HasParameterValidator() const42 bool PaddingField::HasParameterValidator() const { return false; }
43 
GenParameterValidator(std::ostream &) const44 void PaddingField::GenParameterValidator(std::ostream&) const {}
45 
GenInserter(std::ostream &) const46 void PaddingField::GenInserter(std::ostream&) const {
47   ERROR(this) << __func__ << ": This should not be called for padding fields";
48 }
49 
GenValidator(std::ostream &) const50 void PaddingField::GenValidator(std::ostream&) const {}
51