glbarcode++
 
Loading...
Searching...
No Matches
Barcode2dBase.hpp
Go to the documentation of this file.
1// Barcode2dBase.hpp
2//
3// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
4//
5// This file is part of glbarcode++.
6//
7// glbarcode++ is free software: you can redistribute it and/or modify
8// it under the terms of the GNU Lesser General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// glbarcode++ is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU Lesser General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with glbarcode++. If not, see <http://www.gnu.org/licenses/>.
19//
20
21#ifndef glbarcode_Barcode2dBase_hpp
22#define glbarcode_Barcode2dBase_hpp
23
24
25#include <string>
26#include <vector>
27
28#include "Barcode.hpp"
29#include "Renderer.hpp"
30#include "Matrix.hpp"
31
32
33namespace glbarcode
34{
35
45 class Barcode2dBase : public Barcode
46 {
47
48 protected:
53
54
55 public:
59 ~Barcode2dBase() override;
60
61
76 Barcode& build( const std::string& data,
77 double w = 0,
78 double h = 0 ) override;
79
80
81 protected:
93 virtual bool validate( const std::string& rawData ) = 0;
94
95
106 virtual std::string preprocess( const std::string& rawData );
107
108
120 virtual bool encode( const std::string& cookedData,
121 Matrix<bool>& encodedData ) = 0;
122
123
134 virtual void vectorize( const Matrix<bool>& encodedData,
135 double& w,
136 double& h );
137
138
139 private:
143 struct PrivateData;
144 PrivateData *d;
145
146 };
147
148}
149
150
151#endif // glbarcode_Barcode2dBase_hpp
Definition Barcode2dBase.hpp:46
virtual bool validate(const std::string &rawData)=0
virtual void vectorize(const Matrix< bool > &encodedData, double &w, double &h)
virtual std::string preprocess(const std::string &rawData)
virtual bool encode(const std::string &cookedData, Matrix< bool > &encodedData)=0
Barcode & build(const std::string &data, double w=0, double h=0) override
Definition Barcode.hpp:52
Definition Matrix.hpp:34
Definition Barcode.hpp:38