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/body_field.h"
18
19 const std::string BodyField::kFieldType = "BodyField";
20
BodyField(ParseLocation loc)21 BodyField::BodyField(ParseLocation loc) : PacketField("body", loc) {}
22
GetFieldType() const23 const std::string& BodyField::GetFieldType() const {
24 return BodyField::kFieldType;
25 }
26
GetSize() const27 Size BodyField::GetSize() const {
28 return Size(0);
29 }
30
GetDataType() const31 std::string BodyField::GetDataType() const {
32 ERROR(this) << "No need to know the type of a body field.";
33 return "BodyType";
34 }
35
GenExtractor(std::ostream &,int,bool) const36 void BodyField::GenExtractor(std::ostream&, int, bool) const {}
37
GetGetterFunctionName() const38 std::string BodyField::GetGetterFunctionName() const {
39 return "";
40 }
41
GenGetter(std::ostream &,Size,Size) const42 void BodyField::GenGetter(std::ostream&, Size, Size) const {}
43
GetBuilderParameterType() const44 std::string BodyField::GetBuilderParameterType() const {
45 return "";
46 }
47
HasParameterValidator() const48 bool BodyField::HasParameterValidator() const {
49 return false;
50 }
51
GenParameterValidator(std::ostream &) const52 void BodyField::GenParameterValidator(std::ostream&) const {
53 // There is no validation needed for a payload
54 }
55
GenInserter(std::ostream &) const56 void BodyField::GenInserter(std::ostream&) const {
57 // Do nothing
58 }
59
GenValidator(std::ostream &) const60 void BodyField::GenValidator(std::ostream&) const {
61 // Do nothing
62 }
63