MCPcopy
hub / github.com/zxing-js/library / constructor

Method constructor

src/core/datamatrix/encoder/EncoderContext.ts:16–33  ·  view source on GitHub ↗
(private readonly msg: string)

Source from the content-addressed store, hash-verified

14 private skipAtEnd: number = 0;
15
16 constructor(private readonly msg: string) {
17 // From this point on Strings are not Unicode anymore!
18 const msgBinary = msg.split('').map(c => c.charCodeAt(0));
19 const sb = new StringBuilder();
20 for (let i = 0, c = msgBinary.length; i < c; i++) {
21 const ch = String.fromCharCode(msgBinary[i] & 0xff);
22 if (ch === '?' && msg.charAt(i) !== '?') {
23 throw new Error(
24 'Message contains characters outside ISO-8859-1 encoding.'
25 );
26 }
27 sb.append(ch);
28 }
29 this.msg = sb.toString(); // Not Unicode here!
30 this.shape = SymbolShapeHint.FORCE_NONE;
31 this.codewords = new StringBuilder();
32 this.newEncoding = -1;
33 }
34
35 public setSymbolShape(shape: SymbolShapeHint) {
36 this.shape = shape;

Callers

nothing calls this directly

Calls 3

appendMethod · 0.95
toStringMethod · 0.95
charAtMethod · 0.65

Tested by

no test coverage detected