-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotmatrixstring.h
58 lines (34 loc) · 1.28 KB
/
dotmatrixstring.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef RIBI_DOTMATRIXSTRING_H
#define RIBI_DOTMATRIXSTRING_H
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
struct QImage;
namespace ribi {
struct DotMatrixChar;
///DotMatrixString creates a dot matrix 2D array of a string
struct DotMatrixString
{
///Give it a std::string and a spacing (number of pixels) between the characters
DotMatrixString(const std::string& s = "", const int spacing = 0);
boost::shared_ptr<QImage> CreateImage() const noexcept;
///Read back the string
std::string GetString() const noexcept;
///Read if the coordinat is black/high or white/low
bool GetMatrix(const int x, const int y) const noexcept;
///Get the matrix height
int GetMatrixHeight() const noexcept;
///Get the matrix width
int GetMatrixWidth() const noexcept;
static std::string GetVersion() noexcept;
static std::vector<std::string> GetVersionHistory() noexcept;
private:
const int m_spacing;
const std::vector<boost::shared_ptr<const DotMatrixChar>> m_v;
static std::vector<boost::shared_ptr<const DotMatrixChar>>
CreateDotMatrixChars(const std::string& s) noexcept;
};
void TestDotMatrixString() noexcept;
std::ostream& operator<<(std::ostream& os, const DotMatrixString& m) noexcept;
} //~namespace ribi
#endif // RIBI_DOTMATRIXSTRING_H