| 1 | // |
|---|---|
| 2 | // TypeDef.cpp |
| 3 | // |
| 4 | // Library: CppParser |
| 5 | // Package: SymbolTable |
| 6 | // Module: TypeDef |
| 7 | // |
| 8 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
| 9 | // and Contributors. |
| 10 | // |
| 11 | // SPDX-License-Identifier: BSL-1.0 |
| 12 | // |
| 13 | |
| 14 | |
| 15 | #include "Poco/CppParser/TypeDef.h" |
| 16 | #include "Poco/String.h" |
| 17 | #include <cctype> |
| 18 | |
| 19 | |
| 20 | namespace Poco { |
| 21 | namespace CppParser { |
| 22 | |
| 23 | |
| 24 | TypeDef::TypeDef(const std::string& decl, NameSpace* pNameSpace): |
| 25 | Decl(decl, pNameSpace) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | |
| 30 | TypeDef::~TypeDef() |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | |
| 35 | Symbol::Kind TypeDef::kind() const |
| 36 | { |
| 37 | return Symbol::SYM_TYPEDEF; |
| 38 | } |
| 39 | |
| 40 | |
| 41 | std::string TypeDef::baseType() const |
| 42 | { |
| 43 | std::string decl = declaration(); |
| 44 | if (decl.compare(0, 7, "typedef") == 0) |
| 45 | { |
| 46 | decl.erase(0, 7); |
| 47 | std::string::size_type pos = decl.size() - 1; |
| 48 | while (pos > 0 && std::isspace(decl[pos])) pos--; |
| 49 | while (pos > 0 && !std::isspace(decl[pos])) pos--; |
| 50 | decl.resize(pos + 1); |
| 51 | Poco::trimInPlace(decl); |
| 52 | } |
| 53 | return decl; |
| 54 | } |
| 55 | |
| 56 | |
| 57 | } } // namespace Poco::CppParser |
| 58 |