2 * Copyright (C) 2011 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.
16 #ifndef __VARTYPE__H__
17 #define __VARTYPE__H__
21 // VarType models the types of values used on the wire protocol by
22 // both encoders and decoders. Each type is identified by a unique id,
23 // and a name, and provides a size in bytes for the values, a printf-like
24 // formatter string, and a flag telling if the value corresponds to a
30 m_name("default_constructed"),
32 m_printFormat("0x%x"),
36 const std::string& name,
38 const std::string& printFormat,
43 m_printFormat(printFormat),
44 m_isPointer(isPointer) {}
48 size_t id() const { return m_id; }
49 const std::string& name() const { return m_name; }
50 size_t bytes() const { return m_byteSize; }
51 const std::string& printFormat() const { return m_printFormat; }
52 bool isPointer() const { return m_isPointer; }
58 std::string m_printFormat;