blob: 809b851db6745cfd022ab6d940b89b5176722d4e [file] [log] [blame]
Andreas Huber1aec3972016-08-26 09:26:32 -07001/*
2 * Copyright (C) 2016 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
Andreas Huberc9410c72016-07-28 12:18:40 -070017#ifndef STRING_TYPE_H_
18
19#define STRING_TYPE_H_
20
21#include "Type.h"
22
23namespace android {
24
25struct StringType : public Type {
26 StringType();
27
Yifan Hongabf73ee2016-12-05 18:47:00 -080028 bool isString() const override;
29
Yifan Hongc6752dc2016-12-20 14:00:14 -080030 bool canCheckEquality() const override;
31
Andreas Huber4c865b72016-09-14 15:26:27 -070032 std::string getCppType(
33 StorageMode mode,
Andreas Huber4c865b72016-09-14 15:26:27 -070034 bool specifyNamespaces) const override;
Andreas Huber881227d2016-08-02 14:20:21 -070035
Yifan Hong4ed13472016-11-02 10:44:11 -070036 std::string getJavaType(bool /* forInitializer */) const override;
Andreas Huber4c865b72016-09-14 15:26:27 -070037
Andreas Huber2831d512016-08-15 09:33:47 -070038 std::string getJavaSuffix() const override;
39
Zhuoyao Zhangc5ea9f52016-10-06 15:05:39 -070040 std::string getVtsType() const override;
41
Andreas Huber881227d2016-08-02 14:20:21 -070042 void emitReaderWriter(
43 Formatter &out,
44 const std::string &name,
45 const std::string &parcelObj,
46 bool parcelObjIsPointer,
47 bool isReader,
48 ErrorMode mode) const override;
49
50 void emitReaderWriterEmbedded(
51 Formatter &out,
Andreas Huberf9d49f12016-09-12 14:58:36 -070052 size_t depth,
Andreas Huber881227d2016-08-02 14:20:21 -070053 const std::string &name,
Yifan Hongbe2a3732016-10-05 13:33:41 -070054 const std::string & /*sanitizedName*/,
Andreas Huber881227d2016-08-02 14:20:21 -070055 bool nameIsPointer,
56 const std::string &parcelObj,
57 bool parcelObjIsPointer,
58 bool isReader,
59 ErrorMode mode,
60 const std::string &parentName,
61 const std::string &offsetText) const override;
62
Andreas Huber85eabdb2016-08-25 11:24:49 -070063 void emitJavaFieldInitializer(
64 Formatter &out, const std::string &fieldName) const override;
65
66 void emitJavaFieldReaderWriter(
67 Formatter &out,
Andreas Huber4c865b72016-09-14 15:26:27 -070068 size_t depth,
Andreas Huber709b62d2016-09-19 11:21:18 -070069 const std::string &parcelName,
Andreas Huber85eabdb2016-08-25 11:24:49 -070070 const std::string &blobName,
71 const std::string &fieldName,
72 const std::string &offset,
73 bool isReader) const override;
74
Andreas Huber881227d2016-08-02 14:20:21 -070075 bool needsEmbeddedReadWrite() const override;
76 bool resultNeedsDeref() const override;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070077
78 status_t emitVtsTypeDeclarations(Formatter &out) const override;
Andreas Huber85eabdb2016-08-25 11:24:49 -070079
80 void getAlignmentAndSize(size_t *align, size_t *size) const override;
Andreas Huberc9410c72016-07-28 12:18:40 -070081};
82
83} // namespace android
84
85#endif // STRING_TYPE_H_
86