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 #include "NamedType.h" 18 19 namespace android { 20 21 NamedType::NamedType(const char* localName, const Location& loc, Scope* parent) 22 : mLocalName(localName), mLocation(loc), mParent(parent) {} 23 24 bool NamedType::isNamedType() const { 25 return true; 26 } 27 28 void NamedType::setFullName(const FQName &fullName) { 29 mFullName = fullName; 30 } 31 32 const FQName &NamedType::fqName() const { 33 return mFullName; 34 } 35 36 std::string NamedType::localName() const { 37 return mLocalName; 38 } 39 40 std::string NamedType::fullName() const { 41 return mFullName.cppName(); 42 } 43 44 std::string NamedType::partialCppName() const { 45 return mFullName.cppLocalName(); 46 } 47 48 std::string NamedType::fullJavaName() const { 49 return mFullName.javaName(); 50 } 51 52 const Location &NamedType::location() const { 53 return mLocation; 54 } 55 56 Scope* NamedType::parent() const { 57 return mParent; 58 } 59 60 void NamedType::emitDump( 61 Formatter &out, 62 const std::string &streamName, 63 const std::string &name) const { 64 emitDumpWithMethod(out, streamName, fqName().cppNamespace() + "::toString", name); 65 } 66 67 } // namespace android 68 69