GenerateInfo.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5 * Karlsruhe Institute of Technology (KIT), all rights reserved.
6 *
7 * ArmarX is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * ArmarX is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
20 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21 * GNU General Public License
22 */
23
24#pragma once
25
26// STD/STL
27#include <memory>
28#include <string>
29#include <vector>
30
31#include <SimoxUtility/algorithm/string.h>
32
34
36{
37 /// A top-level struct for type-generation information
39 {
40 std::string typeName;
41 std::string definedIn;
42 std::string doc_brief;
43 std::string doc_author;
44
45 std::string
47 {
48 std::vector<std::string> split = simox::alg::split(typeName, "::");
49 return split[split.size() - 1];
50 }
51
52 std::vector<std::string>
54 {
55 auto first = typeName.find("<");
56 if (first == std::string::npos)
57 {
58 return {};
59 }
60
61 auto last = typeName.find(">");
62 ARMARX_CHECK_NOT_EQUAL(last, std::string::npos);
63
64 return simox::alg::split(typeName.substr(first, last - first), ",");
65 }
66
67 std::vector<std::string>
69 {
70 std::vector<std::string> split = simox::alg::split(typeName, "::");
71 std::vector<std::string> namespaces(split);
72 namespaces.pop_back();
73 return namespaces;
74 }
75 };
76} // namespace armarx::aron::typereader
#define ARMARX_CHECK_NOT_EQUAL(lhs, rhs)
This macro evaluates whether lhs is inequal (!=) rhs and if it turns out to be false it will throw an...
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
A top-level struct for type-generation information.
std::string getNameWithoutNamespace() const
std::vector< std::string > getNamespaces() const
std::vector< std::string > getTemplates() const