Row.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <sstream>
4 
5 #include "boca/latex/Command.hh"
6 
7 namespace boca
8 {
9 
10 namespace latex
11 {
12 
13 class Row
14 {
15 
16 public:
17 
18  Row();
19 
20  Row(std::string const& cell);
21 
22  Row(Row const& row) : row_(row.row_.str()), first_(row.first_){}
23 
24  void Initialize();
25 
26  template <typename... Arguments>
27  Row(Arguments... arguments) {
28  this->AddCells(arguments ...);
29  }
30 
31  template <typename Cell, typename... Arguments>
32  void AddCells(Cell const& cell, Arguments... arguments) {
33  AddCell(cell);
34  AddCells(arguments...);
35  }
36 
37  template <typename Cell>
38  void AddCell(Cell const& cell) {
39  SetCell(cell);
40  }
41 
42  std::string str() const;
43 
44 private:
45 
46  template <typename Cell>
47  void SetCell(Cell const& cell) {
48  if (first_) {
49  row_ << " " << cell << '\n';
50  first_ = false;
51  } else row_ << " & " << cell << '\n';
52  }
53 
54  void AddCells() {}
55 
56  std::stringstream row_;
57 
58  bool first_ = true;
59 
60 };
61 
62 }
63 
64 }
void Initialize()
Definition: Row.cpp:30
void AddCells(Cell const &cell, Arguments...arguments)
Definition: Row.hh:32
void AddCell(Cell const &cell)
Definition: Row.hh:38
Row(Row const &row)
Definition: Row.hh:22
Boosted Collider Analysis.
Definition: Analysis.hh:15
std::string str() const
Definition: Row.cpp:36
Row(Arguments...arguments)
Definition: Row.hh:27
Row()
Definition: Row.cpp:17
Definition: Row.hh:13