DoxTable.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include "DoxTable.h"
25 
26 #include <sstream>
27 
28 using namespace armarx;
29 
30 DoxTable::DoxTable(const std::vector<std::string>& header)
31 {
32  this->header = header;
33 }
34 
35 void
36 DoxTable::addRow(const std::vector<std::string>& row)
37 {
38  cells.push_back(row);
39 }
40 
41 int
43 {
44  return cells.size();
45 }
46 
47 std::string
49 {
50  std::stringstream ss;
51 
52  /*ss << "| a | b | c |\n"
53  << "|---|---|---|\n"
54  << "| 1 | 2 | 3 |\n"
55  << "| 4 | 5 | 6 |\n";*/
56  ss << "@htmlonly\n";
57  ss << "<table class=\"doxtable\">\n";
58  ss << " <tr>\n";
59 
60  for (std::string s : header)
61  {
62  ss << " <th>" << s << "</th>\n";
63  }
64 
65  ss << " </tr>\n";
66 
67  for (std::vector<std::string> row : cells)
68  {
69  ss << " <tr>\n";
70 
71  for (std::string cell : row)
72  {
73  ss << " <td>" << cell << "</td>\n";
74  }
75 
76  ss << " </tr>\n";
77  }
78 
79  ss << "</table>\n";
80 
81  ss << "@endhtmlonly";
82 
83  return ss.str();
84  /*
85  std::stringstream ss_header;
86  std::stringstream ss_line;
87 
88 
89  for (std::string s : header)
90  {
91  ss_header << "|" << s << "|";
92  ss_line << "|-";
93 
94  }
95  ss_header << "|\n";
96  ss_line << "|\n";
97 
98  std::stringstream ss;
99  ss << ss_header.str() << ss_line.str();
100 
101 
102  for (std::vector<std::string> row : cells)
103  {
104  for (std::string cell : row)
105  {
106  ss << "| " << cell << " ";
107  }
108  ss << "|\n";
109  }
110 
111  ss << "@endhtmlonly";
112 
113  return ss.str();*/
114 }
DoxTable.h
armarx::DoxTable::getDoxString
std::string getDoxString() override
Definition: DoxTable.cpp:48
armarx::DoxTable::DoxTable
DoxTable(const std::vector< std::string > &header)
Definition: DoxTable.cpp:30
armarx::DoxTable::rows
int rows()
Definition: DoxTable.cpp:42
armarx::DoxTable::addRow
void addRow(const std::vector< std::string > &row)
Definition: DoxTable.cpp:36
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27