mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 13:08:20 +00:00
Rename Zeexygen to Zeekygen
This commit is contained in:
parent
f2f06d66c0
commit
84ca12fdb4
78 changed files with 444 additions and 440 deletions
53
src/zeekygen/ReStructuredTextTable.h
Normal file
53
src/zeekygen/ReStructuredTextTable.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#ifndef ZEEKYGEN_RESTTABLE_H
|
||||
#define ZEEKYGEN_RESTTABLE_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace zeekygen {
|
||||
|
||||
/**
|
||||
* A reST table with arbitrary number of columns.
|
||||
*/
|
||||
class ReStructuredTextTable {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Create the reST table object.
|
||||
* @param arg_num_cols The number of columns in the table.
|
||||
*/
|
||||
explicit ReStructuredTextTable(size_t arg_num_cols);
|
||||
|
||||
/**
|
||||
* Add a new content row to the table.
|
||||
* @param new_row A vector with one element for each column in the table.
|
||||
*/
|
||||
void AddRow(const std::vector<std::string>& new_row);
|
||||
|
||||
/**
|
||||
* @param col_sizes Vector of column sizes (width in number of characters).
|
||||
* @param border Character to use for the border.
|
||||
* @return A border sized appropriated for the table with columns of sizes
|
||||
* denoted by \a col_sizes.
|
||||
*/
|
||||
static std::string MakeBorder(const std::vector<size_t> col_sizes,
|
||||
char border);
|
||||
|
||||
/**
|
||||
* @param border Character to use for the border.
|
||||
* @return the reST representation of the table and its content.
|
||||
*/
|
||||
std::string AsString(char border) const;
|
||||
|
||||
private:
|
||||
|
||||
size_t num_cols;
|
||||
std::vector<std::vector<std::string> > rows;
|
||||
std::vector<size_t> longest_row_in_column;
|
||||
};
|
||||
|
||||
} // namespace zeekygen
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue