Home | History | Annotate | Download | only in hidl
      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 FQName& fullName, const Location& loc,
     22                      Scope* parent)
     23     : Type(parent), mLocalName(localName), mFullName(fullName), mLocation(loc) {}
     24 
     25 bool NamedType::isNamedType() const {
     26     return true;
     27 }
     28 
     29 const FQName &NamedType::fqName() const {
     30     return mFullName;
     31 }
     32 
     33 std::string NamedType::localName() const {
     34     return mLocalName;
     35 }
     36 
     37 std::string NamedType::fullName() const {
     38     return mFullName.cppName();
     39 }
     40 
     41 std::string NamedType::fullJavaName() const {
     42     return mFullName.javaName();
     43 }
     44 
     45 const Location &NamedType::location() const {
     46     return mLocation;
     47 }
     48 
     49 void NamedType::emitDump(
     50         Formatter &out,
     51         const std::string &streamName,
     52         const std::string &name) const {
     53     emitDumpWithMethod(out, streamName, fqName().cppNamespace() + "::toString", name);
     54 }
     55 
     56 }  // namespace android
     57 
     58