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() { delete fields_; }
23 
24 const std::string GroupField::kFieldType = "GroupField";
25 
GetName() const26 std::string GroupField::GetName() const {
27   ERROR(this) << "GetName should never be called.";
28   return "";
29 }
30 
GetFieldType() const31 const std::string& GroupField::GetFieldType() const { return GroupField::kFieldType; }
32 
GetSize() const33 Size GroupField::GetSize() const {
34   ERROR(this) << "GetSize should never be called.";
35   return Size();
36 }
37 
GetDataType() const38 std::string GroupField::GetDataType() const {
39   ERROR(this) << "GetType should never be called.";
40   return "";
41 }
42 
GenExtractor(std::ostream &,int,bool) const43 void GroupField::GenExtractor(std::ostream&, int, bool) const {
44   ERROR(this) << "GenExtractor should never be called.";
45 }
46 
GetGetterFunctionName() const47 std::string GroupField::GetGetterFunctionName() const {
48   ERROR(this) << "GetGetterFunctionName should never be called.";
49   return "";
50 }
51 
GenGetter(std::ostream &,Size,Size) const52 void GroupField::GenGetter(std::ostream&, Size, Size) const {
53   ERROR(this) << "GenGetter should never be called.";
54 }
55 
GetBuilderParameterType() const56 std::string GroupField::GetBuilderParameterType() const {
57   ERROR(this) << "GetBuilderParameterType should never be called";
58   return "";
59 }
60 
HasParameterValidator() const61 bool GroupField::HasParameterValidator() const {
62   ERROR(this) << "HasParameterValidator should never be called";
63   return false;
64 }
65 
GenParameterValidator(std::ostream &) const66 void GroupField::GenParameterValidator(std::ostream&) const { ERROR(this) << "Not implemented"; }
67 
GenInserter(std::ostream &) const68 void GroupField::GenInserter(std::ostream&) const {
69   ERROR(this) << "GenInserter should never be called.";
70 }
71 
GenValidator(std::ostream &) const72 void GroupField::GenValidator(std::ostream&) const {
73   ERROR(this) << "GenValidator should never be called.";
74 }
75 
GetFields() const76 const std::list<PacketField*>* GroupField::GetFields() const { return fields_; }
77