ArrayType.h revision 1aec397b1fdea7db4120dbe55b6995bb2a9d9138
1/* 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 17#ifndef ARRAY_TYPE_H_ 18 19#define ARRAY_TYPE_H_ 20 21#include "Type.h" 22 23#include <string> 24 25namespace android { 26 27struct ArrayType : public Type { 28 ArrayType(Type *elementType, const char *dimension); 29 30 std::string getCppType(StorageMode mode, std::string *extra) const override; 31 32 std::string getJavaType() const override; 33 34 void emitReaderWriter( 35 Formatter &out, 36 const std::string &name, 37 const std::string &parcelObj, 38 bool parcelObjIsPointer, 39 bool isReader, 40 ErrorMode mode) const override; 41 42 void emitReaderWriterEmbedded( 43 Formatter &out, 44 const std::string &name, 45 bool nameIsPointer, 46 const std::string &parcelObj, 47 bool parcelObjIsPointer, 48 bool isReader, 49 ErrorMode mode, 50 const std::string &parentName, 51 const std::string &offsetText) const override; 52 53 bool needsEmbeddedReadWrite() const override; 54 55 void emitJavaReaderWriter( 56 Formatter &out, 57 const std::string &parcelObj, 58 const std::string &argName, 59 bool isReader) const override; 60 61 void emitJavaFieldInitializer( 62 Formatter &out, const std::string &fieldName) const override; 63 64 void emitJavaFieldReaderWriter( 65 Formatter &out, 66 const std::string &blobName, 67 const std::string &fieldName, 68 const std::string &offset, 69 bool isReader) const override; 70 71 status_t emitVtsTypeDeclarations(Formatter &out) const override; 72 73 bool isJavaCompatible() const override; 74 75 void getAlignmentAndSize(size_t *align, size_t *size) const override; 76 77private: 78 Type *mElementType; 79 std::string mDimension; 80 81 DISALLOW_COPY_AND_ASSIGN(ArrayType); 82}; 83 84} // namespace android 85 86#endif // ARRAY_TYPE_H_ 87 88