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/group_field.h"
18
GroupField(ParseLocation loc,std::list<PacketField * > * fields)19 GroupField::GroupField(ParseLocation loc, std::list<PacketField*>* fields)
20 : PacketField("Groups have no name", loc), fields_(fields) {}
21
~GroupField()22 GroupField::~GroupField() {
23 delete fields_;
24 }
25
26 const std::string GroupField::kFieldType = "GroupField";
27
GetName() const28 std::string GroupField::GetName() const {
29 ERROR(this) << "GetName should never be called.";
30 return "";
31 }
32
GetFieldType() const33 const std::string& GroupField::GetFieldType() const {
34 return GroupField::kFieldType;
35 }
36
GetSize() const37 Size GroupField::GetSize() const {
38 ERROR(this) << "GetSize should never be called.";
39 return Size();
40 }
41
GetDataType() const42 std::string GroupField::GetDataType() const {
43 ERROR(this) << "GetType should never be called.";
44 return "";
45 }
46
GenExtractor(std::ostream &,int,bool) const47 void GroupField::GenExtractor(std::ostream&, int, bool) const {
48 ERROR(this) << "GenExtractor should never be called.";
49 }
50
GetGetterFunctionName() const51 std::string GroupField::GetGetterFunctionName() const {
52 ERROR(this) << "GetGetterFunctionName should never be called.";
53 return "";
54 }
55
GenGetter(std::ostream &,Size,Size) const56 void GroupField::GenGetter(std::ostream&, Size, Size) const {
57 ERROR(this) << "GenGetter should never be called.";
58 }
59
GetBuilderParameterType() const60 std::string GroupField::GetBuilderParameterType() const {
61 ERROR(this) << "GetBuilderParameterType should never be called";
62 return "";
63 }
64
HasParameterValidator() const65 bool GroupField::HasParameterValidator() const {
66 ERROR(this) << "HasParameterValidator should never be called";
67 return false;
68 }
69
GenParameterValidator(std::ostream &) const70 void GroupField::GenParameterValidator(std::ostream&) const {
71 ERROR(this) << "Not implemented";
72 }
73
GenInserter(std::ostream &) const74 void GroupField::GenInserter(std::ostream&) const {
75 ERROR(this) << "GenInserter should never be called.";
76 }
77
GenValidator(std::ostream &) const78 void GroupField::GenValidator(std::ostream&) const {
79 ERROR(this) << "GenValidator should never be called.";
80 }
81
GetFields() const82 const std::list<PacketField*>* GroupField::GetFields() const {
83 return fields_;
84 }
85
GetRustDataType() const86 std::string GroupField::GetRustDataType() const {
87 return GetDataType();
88 }
89
GenRustGetter(std::ostream &,Size,Size) const90 void GroupField::GenRustGetter(std::ostream&, Size, Size) const {
91 }
92
GenRustWriter(std::ostream &,Size,Size) const93 void GroupField::GenRustWriter(std::ostream&, Size, Size) const {}
94