CVB++ 15.0
detail_config_upc_ean_codes.hpp
1#pragma once
2
3#include "../_decl/decl_config_upc_ean_codes.hpp"
4
5namespace Cvb
6{
7 CVB_BEGIN_INLINE_NS
8
9 namespace CodeReader
10 {
11 namespace Config
12 {
13#pragma region UpcEanBase
14 template <class T>
16 {
18 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_CompositeRequired),
19 1);
20 }
21
22 template <class T>
24 {
26 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_CompositeRequired),
27 0);
28 }
29
30 template <class T>
32 {
34 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_CompositeRequired),
35 1);
36 }
37
38 template <class T>
40 {
42 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_CompositeRequired),
43 0);
44 }
45
46 template <class T>
48 {
50 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_CompositeRequired),
51 1);
52 }
53
54 template <class T>
56 {
58 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_CompositeRequired),
59 0);
60 }
61
62 template <class T>
63 std::pair<bool, bool> UpcEanBase<T>::MapSupplemental(SupplementalCode supplement) const
64 {
65 bool supplement2 = 0;
66 bool supplement5 = 0;
67 switch (supplement)
68 {
70 supplement2 = true;
71 supplement5 = false;
72 break;
74 supplement2 = false;
75 supplement5 = true;
76 break;
78 supplement2 = true;
79 supplement5 = true;
80 break;
81 default:
82 break;
83 }
84 return std::make_pair(supplement2, supplement5);
85 }
86
87 template <class T>
88 SupplementalCode UpcEanBase<T>::MapSupplemental(bool supplement2, bool supplement5) const
89 {
90 if (!supplement2)
91 {
92 if (!supplement5)
94 else
96 }
97 else
98 {
99 if (!supplement5)
101 else
103 }
104 }
105
106 template <class T>
107 inline void UpcEanBase<T>::SetSupplemental(int propertySupplemental2, int propertySupplemental5,
108 int propertyRequired, int propertyAddSpace,
109 SupplementalCode supplement, bool required, bool addSpace)
110 {
111 bool supplement2 = false, supplement5 = false;
112 std::tie(supplement2, supplement5) = MapSupplemental(supplement);
113
114 this->SetIntProperty(propertyRequired, static_cast<int>(required));
115 this->SetIntProperty(propertyAddSpace, static_cast<int>(addSpace));
116 this->SetIntProperty(propertySupplemental2, static_cast<int>(supplement2));
117 this->SetIntProperty(propertySupplemental5, static_cast<int>(supplement5));
118 }
119
120 template <class T>
121 inline SupplementalCode UpcEanBase<T>::Supplemental(int propertySupplemental2, int propertySupplemental5) const
122 {
123 auto supplement2 = static_cast<bool>(this->GetIntProperty(propertySupplemental2));
124 auto supplement5 = static_cast<bool>(this->GetIntProperty(propertySupplemental5));
125 return MapSupplemental(supplement2, supplement5);
126 }
127#pragma endregion
128
129#pragma region UpcA
130 inline UpcA &UpcA::SetSupplemental(SupplementalCode supplement, bool required, bool addSpace)
131 {
133 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_Supplemental2digit),
134 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_Supplemental5digit),
135 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_SupplementalRequired),
136 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_SupplementalAddSpace), supplement,
137 required, addSpace);
138 return *this;
139 }
140
142 {
144 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_Supplemental2digit),
145 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_Supplemental5digit));
146 }
147
148 inline UpcA &UpcA::SetStripCheckDigit(bool value)
149 {
150 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_StripChar),
151 static_cast<int>(value));
152 }
153
154 inline bool UpcA::StripCheckDigit() const
155 {
156 return this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_StripChar));
157 }
158
159 inline UpcA &UpcA::SetStripNumberSystemDigit(bool value)
160 {
161 return SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_StripNumberSystem),
162 static_cast<int>(value));
163 }
164
166 {
167 return static_cast<bool>(
168 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_StripNumberSystem)));
169 }
170
171 inline UpcA &UpcA::SetConvertToEAN13(bool value)
172 {
173 if (value)
174 this->SetIntProperty(static_cast<int>(ReverseMapper<Config::Ean13>().type), 1);
175 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_ConvertToEAN13),
176 static_cast<int>(value));
177 }
178
179 inline bool UpcA::ConvertedToEAN13() const
180 {
181 return static_cast<bool>(
182 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCA::CVCRSPUA_ConvertToEAN13)));
183 }
184#pragma endregion
185
186#pragma region UpcE
187 inline UpcE &UpcE::SetSupplemental(SupplementalCode supplement, bool required, bool addSpace)
188 {
190 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_Supplemental2digit),
191 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_Supplemental5digit),
192 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_SupplementalRequired),
193 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_SupplementalAddSpace), supplement,
194 required, addSpace);
195 return *this;
196 }
197
199 {
201 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_Supplemental2digit),
202 static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_Supplemental5digit));
203 }
204
205 inline UpcE &UpcE::SetStripCheckDigit(bool value)
206 {
207 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_StripChar),
208 static_cast<int>(value));
209 }
210
211 inline bool UpcE::StripCheckDigit() const
212 {
213 return this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_StripChar));
214 }
215
216 inline UpcE &UpcE::SetStripNumberSystemDigit(bool value)
217 {
218 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_StripNumberSystem),
219 static_cast<int>(value));
220 }
221
223 {
224 return static_cast<bool>(
225 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_StripNumberSystem)));
226 }
227
228 inline bool UpcE::EnabledUpcE1() const
229 {
230 return static_cast<bool>(
231 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_UPCE1)));
232 }
233
234 inline UpcE &UpcE::SetEnableUpcE1(bool value)
235 {
236 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_UPCE1),
237 static_cast<int>(value));
238 }
239
240 inline bool UpcE::EnabledUpcEExpansion() const
241 {
242 return static_cast<bool>(
243 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_Expansion)));
244 }
245
246 inline UpcE &UpcE::SetEnableUpcEExpansion(bool value)
247 {
248 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_Expansion),
249 static_cast<int>(value));
250 }
251
252 inline UpcE &UpcE::SetRejectMisreadCode(bool value)
253 {
254 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_RejectUPCEPartial),
255 static_cast<int>(value));
256 }
257
258 inline bool UpcE::RejectMisreadCode() const
259 {
260 return static_cast<bool>(
261 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesUPCE::CVCRSPUE_RejectUPCEPartial)));
262 }
263
264#pragma endregion
265
266#pragma region EAN8
267 inline Ean8 &Ean8::SetSupplemental(SupplementalCode supplement, bool required, bool addSpace)
268 {
270 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_Supplemental2digit),
271 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_Supplemental5digit),
272 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_SupplementalRequired),
273 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_SupplementalAddSpace), supplement,
274 required, addSpace);
275 return *this;
276 }
277
279 {
281 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_Supplemental2digit),
282 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_Supplemental5digit));
283 }
284
285 inline Ean8 &Ean8::SetStripCheckDigit(bool value)
286 {
287 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_StripChar),
288 static_cast<int>(value));
289 }
290
291 inline bool Ean8::StripCheckDigit() const
292 {
293 return this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_StripChar));
294 }
295
296 inline Ean8 &Ean8::SetConvertToEAN13(bool value)
297 {
298 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_ConvertToEAN13),
299 static_cast<int>(value));
300 }
301
302 inline bool Ean8::ConvertedToEAN13() const
303 {
304 return static_cast<bool>(
305 this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesEAN8::CVCRSPE8_ConvertToEAN13)));
306 }
307#pragma endregion
308
309#pragma region EAN13
310 inline Ean13 &Ean13::SetSupplemental(SupplementalCode supplement, bool required, bool addSpace)
311 {
313 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_Supplemental2digit),
314 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_Supplemental5digit),
315 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_SupplementalRequired),
316 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_SupplementalAddSpace), supplement,
317 required, addSpace);
318 return *this;
319 }
320
322 {
324 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_Supplemental2digit),
325 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_Supplemental5digit));
326 }
327
328 inline Ean13 &Ean13::SetStripCheckDigit(bool value)
329 {
330 return this->SetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_StripChar),
331 static_cast<int>(value));
332 }
333
334 inline bool Ean13::StripCheckDigit() const
335 {
336 return this->GetIntProperty(static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_StripChar));
337 }
338
339 inline Ean13 &Ean13::SetConvertBooklandToISBN(bool value)
340 {
341 return this->SetIntProperty(
342 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_ConvertBooklandToISBN),
343 static_cast<int>(value));
344 }
345
347 {
348 return static_cast<bool>(this->GetIntProperty(
349 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_ConvertBooklandToISBN)));
350 }
351
352 inline Ean13 &Ean13::SetConvertBooklandToISSN(bool value)
353 {
354 return this->SetIntProperty(
355 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_ConvertBooklandToISSN),
356 static_cast<int>(value));
357 }
358
360 {
361 return static_cast<bool>(this->GetIntProperty(
362 static_cast<int>(CExports::CVCRSymbologyPropertiesEAN13::CVCRSPE13_ConvertBooklandToISSN)));
363 }
364#pragma endregion
365 } // namespace Config
366 } // namespace CodeReader
367
368 CVB_END_INLINE_NS
369} // namespace Cvb
virtual T & EnableCCB()
Enables CompositeComponent B (CC-B) decoding.
Definition detail_config_base.hpp:75
virtual T & DisableCCB()
Disables CompositeComponent B (CC-B) decoding.
Definition detail_config_base.hpp:81
virtual T & EnableCCA()
Enables CompositeComponent A (CC-A) decoding.
Definition detail_config_base.hpp:57
virtual T & DisableCCA()
Disables CompositeComponent A (CC-A) decoding.
Definition detail_config_base.hpp:63
virtual T & EnableCCC()
Enables CompositeComponent C (CC-C) decoding.
Definition detail_config_base.hpp:93
virtual T & DisableCCC()
Disables CompositeComponent C (CC-C) decoding.
Definition detail_config_base.hpp:99
bool ConvertedFromBooklandToISSN() const
Determines whether conversion from Bookland to ISSN is enabled or disabled.
Definition detail_config_upc_ean_codes.hpp:359
Ean13 & SetStripCheckDigit(bool value) override
Enables or disables the removal of the check digit from read codes.
Definition detail_config_upc_ean_codes.hpp:328
Ean13 & SetConvertBooklandToISBN(bool value)
Enables or disables conversion from Bookland to ISBN.
Definition detail_config_upc_ean_codes.hpp:339
SupplementalCode Supplemental() const override
Retrieves the current configuration of the supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:321
bool ConvertedFromBooklandToISBN() const
Determines whether conversion from Bookland to ISBN is enabled or disabled.
Definition detail_config_upc_ean_codes.hpp:346
bool StripCheckDigit() const override
Determines whether check digit removal is enabled.
Definition detail_config_upc_ean_codes.hpp:334
Ean13 & SetConvertBooklandToISSN(bool value)
Enables or disables conversion from Bookland to ISSN.
Definition detail_config_upc_ean_codes.hpp:352
Ean13 & SetSupplemental(SupplementalCode supplement, bool required=false, bool addSpace=true) override
Configures supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:310
Ean8 & SetSupplemental(SupplementalCode supplement, bool required=false, bool addSpace=true) override
Configures supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:267
Ean8 & SetStripCheckDigit(bool value) override
Enables or disables the removal of the check digit from read codes.
Definition detail_config_upc_ean_codes.hpp:285
bool ConvertedToEAN13() const
Determines whether the conversion of EAN-8 codes to EAN-13 format is enabled or disabled.
Definition detail_config_upc_ean_codes.hpp:302
SupplementalCode Supplemental() const override
Retrieves the current configuration of the supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:278
Ean8 & SetConvertToEAN13(bool value)
Enables or disables the conversion of EAN-8 codes to EAN-13 format in the decoded data.
Definition detail_config_upc_ean_codes.hpp:296
bool StripCheckDigit() const override
Determines whether check digit removal is enabled.
Definition detail_config_upc_ean_codes.hpp:291
bool StripNumberSystemDigit() const
Determines whether UPC-A Number System digit removal is enabled.
Definition detail_config_upc_ean_codes.hpp:165
UpcA & SetConvertToEAN13(bool value)
Enables or disables the conversion of 12-digit UPC-A codes to 13-digit EAN-13 format in the decoded d...
Definition detail_config_upc_ean_codes.hpp:171
UpcA & SetStripNumberSystemDigit(bool value)
Enables or disables the removal of the UPC-A Number System digit from read codes.
Definition detail_config_upc_ean_codes.hpp:159
bool ConvertedToEAN13() const
Determines whether the conversion of 12-digit UPC-A codes to 13-digit EAN-13 format is enabled or dis...
Definition detail_config_upc_ean_codes.hpp:179
SupplementalCode Supplemental() const override
Retrieves the current configuration of the supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:141
UpcA & SetSupplemental(SupplementalCode supplement, bool required=false, bool addSpace=true) override
Configures supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:130
bool StripCheckDigit() const override
Determines whether check digit removal is enabled.
Definition detail_config_upc_ean_codes.hpp:154
UpcA & SetStripCheckDigit(bool value) override
Enables or disables the removal of the check digit from read codes.
Definition detail_config_upc_ean_codes.hpp:148
UpcE & SetEnableUpcE1(bool value)
Enables or disables UPC-E1 decoding.
Definition detail_config_upc_ean_codes.hpp:234
UpcE & SetRejectMisreadCode(bool value)
Configures handling of damaged UPCE-A and EAN-13 codes.
Definition detail_config_upc_ean_codes.hpp:252
UpcE & SetSupplemental(SupplementalCode supplement, bool required=false, bool addSpace=true) override
Configures supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:187
bool StripNumberSystemDigit() const
Determines whether UPC-E Number System digit removal is enabled.
Definition detail_config_upc_ean_codes.hpp:222
bool EnabledUpcE1() const
Checks if UPC-E1 decoding is enabled.
Definition detail_config_upc_ean_codes.hpp:228
UpcE & SetStripCheckDigit(bool value) override
Enables or disables the removal of the check digit from read codes.
Definition detail_config_upc_ean_codes.hpp:205
UpcE & SetEnableUpcEExpansion(bool value)
Enables or disables the expansion of detected UPC-E codes to the UPC-A format.
Definition detail_config_upc_ean_codes.hpp:246
SupplementalCode Supplemental() const override
Retrieves the current configuration of the supplemental code decoding.
Definition detail_config_upc_ean_codes.hpp:198
bool StripCheckDigit() const override
Determines whether check digit removal is enabled.
Definition detail_config_upc_ean_codes.hpp:211
bool EnabledUpcEExpansion() const
Determines if the expansion of detected UPC-E codes to the UPC-A format is enabled.
Definition detail_config_upc_ean_codes.hpp:240
UpcE & SetStripNumberSystemDigit(bool value)
Enables or disables the removal of the UPC-E Number System digit from read codes.
Definition detail_config_upc_ean_codes.hpp:216
bool RejectMisreadCode() const
Determines whether damaged UPC-A or EAN-13 barcodes are rejected.
Definition detail_config_upc_ean_codes.hpp:258
virtual T & SetSupplemental(SupplementalCode supplement, bool required=false, bool addSpace=true)=0
Configures supplemental code decoding.
virtual T & DisableCCA() override
Disables Composite Component A (CC-A) decoding.
Definition detail_config_upc_ean_codes.hpp:23
virtual T & DisableCCB() override
Disables Composite Component B (CC-B) decoding.
Definition detail_config_upc_ean_codes.hpp:39
virtual T & EnableCCA() override
Enables Composite Component A (CC-A) decoding.
Definition detail_config_upc_ean_codes.hpp:15
virtual T & EnableCCB() override
Enables Composite Component B (CC-B) decoding.
Definition detail_config_upc_ean_codes.hpp:31
virtual T & EnableCCC() override
Enables Composite Component C (CC-C) decoding.
Definition detail_config_upc_ean_codes.hpp:47
virtual T & DisableCCC() override
Disables Composite Component C (CC-C) decoding.
Definition detail_config_upc_ean_codes.hpp:55
virtual SupplementalCode Supplemental() const =0
Retrieves the current configuration of the supplemental code decoding.
T make_pair(T... args)
This namespace contains the configuration classes for all supported codes.
Definition decl_config_2d_codes.hpp:14
SupplementalCode
Enum class for configuring supplemental code decoding for UpcA, UpcE, Ean8 and Ean13 codes.
Definition decl_config_upc_ean_codes.hpp:19
@ Supplement2digits
Enables decoding of 2-digit supplemental codes.
Definition decl_config_upc_ean_codes.hpp:23
@ SupplementAll
Enables decoding of both 2-digit and 5-digit supplemental codes.
Definition decl_config_upc_ean_codes.hpp:27
@ None
Disables decoding of supplemental codes.
Definition decl_config_upc_ean_codes.hpp:21
@ Supplement5digits
Enables decoding of 5-digit supplemental codes.
Definition decl_config_upc_ean_codes.hpp:25
Namespace for all decoding functionalities.
Definition decl_config_2d_codes.hpp:10
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
T tie(T... args)