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 #include <string>
20
21 namespace android {
22
NamedType(const std::string & localName,const FQName & fullName,const Location & loc,Scope * parent)23 NamedType::NamedType(const std::string& localName, const FQName& fullName, const Location& loc,
24 Scope* parent)
25 : Type(parent, localName), mFullName(fullName), mLocation(loc) {}
26
isNamedType() const27 bool NamedType::isNamedType() const {
28 return true;
29 }
30
fqName() const31 const FQName &NamedType::fqName() const {
32 return mFullName;
33 }
34
fullName() const35 std::string NamedType::fullName() const {
36 return mFullName.cppName();
37 }
38
fullJavaName() const39 std::string NamedType::fullJavaName() const {
40 return mFullName.javaName();
41 }
42
location() const43 const Location &NamedType::location() const {
44 return mLocation;
45 }
46
emitDump(Formatter & out,const std::string & streamName,const std::string & name) const47 void NamedType::emitDump(
48 Formatter &out,
49 const std::string &streamName,
50 const std::string &name) const {
51 emitDumpWithMethod(out, streamName, fqName().cppNamespace() + "::toString", name);
52 }
53
54 } // namespace android
55