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 #include <sstream>
26 
27 using namespace armarx;
28 
29 
30 DoxTable::DoxTable(const std::vector<std::string>& header)
31 {
32  this->header = header;
33 }
34 
35 void DoxTable::addRow(const std::vector<std::string>& row)
36 {
37  cells.push_back(row);
38 }
39 
41 {
42  return cells.size();
43 }
44 
46 {
47  std::stringstream ss;
48 
49  /*ss << "| a | b | c |\n"
50  << "|---|---|---|\n"
51  << "| 1 | 2 | 3 |\n"
52  << "| 4 | 5 | 6 |\n";*/
53  ss << "@htmlonly\n";
54  ss << "<table class=\"doxtable\">\n";
55  ss << " <tr>\n";
56 
57  for (std::string s : header)
58  {
59  ss << " <th>" << s << "</th>\n";
60 
61  }
62 
63  ss << " </tr>\n";
64 
65  for (std::vector<std::string> row : cells)
66  {
67  ss << " <tr>\n";
68 
69  for (std::string cell : row)
70  {
71  ss << " <td>" << cell << "</td>\n";
72  }
73 
74  ss << " </tr>\n";
75  }
76 
77  ss << "</table>\n";
78 
79  ss << "@endhtmlonly";
80 
81  return ss.str();
82  /*
83  std::stringstream ss_header;
84  std::stringstream ss_line;
85 
86 
87  for (std::string s : header)
88  {
89  ss_header << "|" << s << "|";
90  ss_line << "|-";
91 
92  }
93  ss_header << "|\n";
94  ss_line << "|\n";
95 
96  std::stringstream ss;
97  ss << ss_header.str() << ss_line.str();
98 
99 
100  for (std::vector<std::string> row : cells)
101  {
102  for (std::string cell : row)
103  {
104  ss << "| " << cell << " ";
105  }
106  ss << "|\n";
107  }
108 
109  ss << "@endhtmlonly";
110 
111  return ss.str();*/
112 
113 }
DoxTable.h
armarx::DoxTable::getDoxString
std::string getDoxString() override
Definition: DoxTable.cpp:45
armarx::DoxTable::DoxTable
DoxTable(const std::vector< std::string > &header)
Definition: DoxTable.cpp:30
armarx::DoxTable::rows
int rows()
Definition: DoxTable.cpp:40
armarx::DoxTable::addRow
void addRow(const std::vector< std::string > &row)
Definition: DoxTable.cpp:35
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:28