mirror of
https://github.com/livingcomputermuseum/UniBone.git
synced 2026-05-01 22:07:16 +00:00
Initial
This commit is contained in:
36
90_common/src/stringgrid.hpp
Normal file
36
90_common/src/stringgrid.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/* fills and prints an array of strings
|
||||
* each string has col,row
|
||||
*/
|
||||
#ifndef _STRINGRID_HPP_
|
||||
#define _STRINGRID_HPP_
|
||||
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
// a col,row index pair
|
||||
// first =col, second = row
|
||||
typedef pair<unsigned, unsigned> stringgrid_index_c;
|
||||
|
||||
class stringgrid_c {
|
||||
private:
|
||||
map<stringgrid_index_c, string> grid;
|
||||
|
||||
public:
|
||||
unsigned col_count;
|
||||
unsigned row_count;
|
||||
stringgrid_c();
|
||||
~stringgrid_c();
|
||||
void clear();
|
||||
void set(unsigned col, unsigned row, string s);
|
||||
string *get(unsigned col, unsigned row);
|
||||
|
||||
vector<unsigned> columm_widths;
|
||||
void calc_columnwidths(void);
|
||||
void print_row(unsigned r, string colsep);
|
||||
void print(string colsep, char titlesep);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user