2 * Copyright (C) 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "generic_message.h"
19 GenericMessage::GenericMessage()
23 GenericMessage::~GenericMessage()
28 GenericMessage::addInt32(int32_t fieldId, uint32_t value)
31 node.type = TYPE_VALUE32;
33 mNodes.insert(pair<int32_t,Node>(fieldId, node));
37 GenericMessage::addInt64(int32_t fieldId, uint64_t value)
40 node.type = TYPE_VALUE64;
42 mNodes.insert(pair<int32_t,Node>(fieldId, node));
46 GenericMessage::addMessage(int32_t fieldId)
48 GenericMessage* result = new GenericMessage();
50 node.type = TYPE_MESSAGE;
51 node.message = result;
52 mNodes.insert(pair<int32_t,Node>(fieldId, node));
57 GenericMessage::addString(int32_t fieldId, const string& value)
60 node.type = TYPE_STRING;
61 node.str = new string(value);
62 mNodes.insert(pair<int32_t,Node>(fieldId, node));
65 GenericMessage::const_iterator_pair
66 GenericMessage::find(int fieldId) const
68 return mNodes.equal_range(fieldId);