@dusted/anqst 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/app.js +31 -9
- package/dist/src/base93.js +0 -72
- package/dist/src/boundary-codec-analysis.js +468 -0
- package/dist/src/boundary-codec-leaves.js +602 -0
- package/dist/src/boundary-codec-model.js +77 -0
- package/dist/src/boundary-codec-plan.js +522 -0
- package/dist/src/boundary-codec-render.js +1738 -0
- package/dist/src/boundary-codecs.js +174 -0
- package/dist/src/emit.js +580 -90
- package/dist/src/program.js +1 -1
- package/package.json +2 -2
- package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/decoder.js +0 -35
- package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/encoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/decoder.js +0 -26
- package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/encoder.js +0 -38
- package/dist/src/codecgenerators/basecodecemitters/binary-blob/decoder.js +0 -28
- package/dist/src/codecgenerators/basecodecemitters/binary-blob/encoder.js +0 -34
- package/dist/src/codecgenerators/basecodecemitters/binary-buffer/decoder.js +0 -29
- package/dist/src/codecgenerators/basecodecemitters/binary-buffer/encoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/decoder.js +0 -46
- package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/encoder.js +0 -49
- package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/decoder.js +0 -46
- package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/encoder.js +0 -47
- package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/decoder.js +0 -46
- package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/encoder.js +0 -49
- package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/decoder.js +0 -50
- package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/encoder.js +0 -52
- package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/decoder.js +0 -38
- package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/encoder.js +0 -44
- package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/decoder.js +0 -33
- package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/encoder.js +0 -34
- package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/decoder.js +0 -46
- package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/encoder.js +0 -49
- package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/decoder.js +0 -46
- package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/encoder.js +0 -49
- package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/decoder.js +0 -28
- package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/encoder.js +0 -34
- package/dist/src/codecgenerators/basecodecemitters/boolean/decoder.js +0 -34
- package/dist/src/codecgenerators/basecodecemitters/boolean/encoder.js +0 -40
- package/dist/src/codecgenerators/basecodecemitters/dynamic-json/decoder.js +0 -43
- package/dist/src/codecgenerators/basecodecemitters/dynamic-json/encoder.js +0 -45
- package/dist/src/codecgenerators/basecodecemitters/dynamic-object/decoder.js +0 -44
- package/dist/src/codecgenerators/basecodecemitters/dynamic-object/encoder.js +0 -46
- package/dist/src/codecgenerators/basecodecemitters/integer-int16/decoder.js +0 -32
- package/dist/src/codecgenerators/basecodecemitters/integer-int16/encoder.js +0 -43
- package/dist/src/codecgenerators/basecodecemitters/integer-int32/decoder.js +0 -26
- package/dist/src/codecgenerators/basecodecemitters/integer-int32/encoder.js +0 -37
- package/dist/src/codecgenerators/basecodecemitters/integer-int8/decoder.js +0 -26
- package/dist/src/codecgenerators/basecodecemitters/integer-int8/encoder.js +0 -37
- package/dist/src/codecgenerators/basecodecemitters/integer-qint16/decoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/integer-qint16/encoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/integer-qint32/decoder.js +0 -25
- package/dist/src/codecgenerators/basecodecemitters/integer-qint32/encoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/integer-qint8/decoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/integer-qint8/encoder.js +0 -36
- package/dist/src/codecgenerators/basecodecemitters/integer-quint16/decoder.js +0 -26
- package/dist/src/codecgenerators/basecodecemitters/integer-quint16/encoder.js +0 -38
- package/dist/src/codecgenerators/basecodecemitters/integer-quint32/decoder.js +0 -27
- package/dist/src/codecgenerators/basecodecemitters/integer-quint32/encoder.js +0 -39
- package/dist/src/codecgenerators/basecodecemitters/integer-quint8/decoder.js +0 -26
- package/dist/src/codecgenerators/basecodecemitters/integer-quint8/encoder.js +0 -38
- package/dist/src/codecgenerators/basecodecemitters/integer-uint16/decoder.js +0 -30
- package/dist/src/codecgenerators/basecodecemitters/integer-uint16/encoder.js +0 -42
- package/dist/src/codecgenerators/basecodecemitters/integer-uint32/decoder.js +0 -31
- package/dist/src/codecgenerators/basecodecemitters/integer-uint32/encoder.js +0 -43
- package/dist/src/codecgenerators/basecodecemitters/integer-uint8/decoder.js +0 -30
- package/dist/src/codecgenerators/basecodecemitters/integer-uint8/encoder.js +0 -40
- package/dist/src/codecgenerators/basecodecemitters/number/decoder.js +0 -26
- package/dist/src/codecgenerators/basecodecemitters/number/encoder.js +0 -38
- package/dist/src/codecgenerators/basecodecemitters/shared/comments.js +0 -13
- package/dist/src/codecgenerators/basecodecemitters/shared/contracts.js +0 -2
- package/dist/src/codecgenerators/basecodecemitters/shared/fixedwidth.js +0 -53
- package/dist/src/codecgenerators/basecodecemitters/shared/index.js +0 -21
- package/dist/src/codecgenerators/basecodecemitters/shared/positionalBase93.js +0 -48
- package/dist/src/codecgenerators/basecodecemitters/shared/rawbytes.js +0 -30
- package/dist/src/codecgenerators/basecodecemitters/string/decoder.js +0 -43
- package/dist/src/codecgenerators/basecodecemitters/string/encoder.js +0 -43
- package/dist/src/codecgenerators/basecodecemitters/stringArray/decoder.js +0 -80
- package/dist/src/codecgenerators/basecodecemitters/stringArray/encoder.js +0 -57
- package/dist/src/structured-top-level-codecs.js +0 -1305
package/dist/src/program.js
CHANGED
|
@@ -81,7 +81,7 @@ function readTsConfigFrom(specPath) {
|
|
|
81
81
|
function createTscProgramContext(specPath) {
|
|
82
82
|
const absoluteSpecPath = node_path_1.default.resolve(specPath);
|
|
83
83
|
const tsConfig = readTsConfigFrom(absoluteSpecPath);
|
|
84
|
-
const rootNames =
|
|
84
|
+
const rootNames = [absoluteSpecPath];
|
|
85
85
|
const options = tsConfig?.options ?? {
|
|
86
86
|
target: typescript_1.default.ScriptTarget.ES2022,
|
|
87
87
|
module: typescript_1.default.ModuleKind.CommonJS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dusted/anqst",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Opinionated backend generator for webapps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build": "node scripts/build-with-stamp.js",
|
|
48
48
|
"build:test": "npm run clean && tsc -p tsconfig.json && npm run chmod:bin",
|
|
49
49
|
"prepare": "npm run build",
|
|
50
|
-
"test": "npm run build:test && node --test dist/test
|
|
50
|
+
"test": "npm run build:test && node --test dist/test/*.test.js",
|
|
51
51
|
"start": "node dist/src/bin/anqst.js"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter: AnQst.Type.qint64 — TypeScript decoder (standalone base93 string → bigint).
|
|
4
|
-
*
|
|
5
|
-
* - Decodes base93 to 8 bytes, then reads signed 64-bit two's complement via BigInt64Array.
|
|
6
|
-
* - C++ decoder uses memcpy from decoded bytes into qint64 (see emitCppDecoder).
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.decoderEmitter = exports.descriptor = void 0;
|
|
10
|
-
const fixedwidth_1 = require("../shared/fixedwidth");
|
|
11
|
-
const FIXED_WIDTH = {
|
|
12
|
-
byteWidth: 8,
|
|
13
|
-
tsViewCtor: "BigInt64Array",
|
|
14
|
-
cppType: "qint64"
|
|
15
|
-
};
|
|
16
|
-
exports.descriptor = {
|
|
17
|
-
codecId: "bigint-qint64",
|
|
18
|
-
specPath: "RefinedSpecs/Codecs/BigInt_qint64_Codec.md",
|
|
19
|
-
tsType: "bigint",
|
|
20
|
-
cppType: "qint64",
|
|
21
|
-
wireCategory: "fixed-width-scalar",
|
|
22
|
-
strategySummary: "Decode standalone base93 to 8 bytes, reinterpret as qint64 / BigInt64Array[0] as bigint.",
|
|
23
|
-
fixedWidth: FIXED_WIDTH
|
|
24
|
-
};
|
|
25
|
-
const TS_FN = "decodeQint64Standalone";
|
|
26
|
-
const CPP_FN = "decodeQint64Standalone";
|
|
27
|
-
exports.decoderEmitter = {
|
|
28
|
-
descriptor: exports.descriptor,
|
|
29
|
-
emitTsDecoder() {
|
|
30
|
-
return (0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)(TS_FN, FIXED_WIDTH);
|
|
31
|
-
},
|
|
32
|
-
emitCppDecoder() {
|
|
33
|
-
return (0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)(CPP_FN, FIXED_WIDTH);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter: AnQst.Type.qint64 — TypeScript encoder (bigint → standalone base93 string).
|
|
4
|
-
*
|
|
5
|
-
* - 8-byte signed two's complement via BigInt64Array; platform-native byte order.
|
|
6
|
-
* - Standalone wire: one base93 string (10 characters for 8 bytes).
|
|
7
|
-
* - C++ side mirrors layout with memcpy into qint64 (see emitCppEncoder).
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.encoderEmitter = exports.descriptor = void 0;
|
|
11
|
-
const fixedwidth_1 = require("../shared/fixedwidth");
|
|
12
|
-
const FIXED_WIDTH = {
|
|
13
|
-
byteWidth: 8,
|
|
14
|
-
tsViewCtor: "BigInt64Array",
|
|
15
|
-
cppType: "qint64"
|
|
16
|
-
};
|
|
17
|
-
exports.descriptor = {
|
|
18
|
-
codecId: "bigint-qint64",
|
|
19
|
-
specPath: "RefinedSpecs/Codecs/BigInt_qint64_Codec.md",
|
|
20
|
-
tsType: "bigint",
|
|
21
|
-
cppType: "qint64",
|
|
22
|
-
wireCategory: "fixed-width-scalar",
|
|
23
|
-
strategySummary: "Serialize qint64 as 8-byte signed two's complement (BigInt64Array / C++ memcpy), then base93-encode to a standalone JSON string.",
|
|
24
|
-
fixedWidth: FIXED_WIDTH
|
|
25
|
-
};
|
|
26
|
-
const TS_FN = "encodeQint64Standalone";
|
|
27
|
-
const CPP_FN = "encodeQint64Standalone";
|
|
28
|
-
exports.encoderEmitter = {
|
|
29
|
-
descriptor: exports.descriptor,
|
|
30
|
-
emitTsEncoder() {
|
|
31
|
-
return (0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)(TS_FN, FIXED_WIDTH);
|
|
32
|
-
},
|
|
33
|
-
emitCppEncoder() {
|
|
34
|
-
return (0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)(CPP_FN, FIXED_WIDTH);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Decoder emitter for the AnQst base-type codec `AnQst.Type.quint64`.
|
|
4
|
-
*
|
|
5
|
-
* Reverses the standalone encoder: base93 string → 8 bytes → `BigUint64Array` → bigint (≥ 0n).
|
|
6
|
-
* C++ decodes to `quint64` via `std::memcpy` from decoded bytes.
|
|
7
|
-
*
|
|
8
|
-
* Spec: RefinedSpecs/Codecs/BigInt_quint64_Codec.md
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.decoder = exports.descriptor = void 0;
|
|
12
|
-
const fixedwidth_1 = require("../shared/fixedwidth");
|
|
13
|
-
const encoder_1 = require("./encoder");
|
|
14
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
15
|
-
const fixedWidth = encoder_1.descriptor.fixedWidth;
|
|
16
|
-
const TS_FN = "decodeQuint64Standalone";
|
|
17
|
-
const CPP_FN = "decodeQuint64Standalone";
|
|
18
|
-
exports.decoder = {
|
|
19
|
-
descriptor: encoder_1.descriptor,
|
|
20
|
-
emitTsDecoder() {
|
|
21
|
-
return (0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)(TS_FN, fixedWidth);
|
|
22
|
-
},
|
|
23
|
-
emitCppDecoder() {
|
|
24
|
-
return (0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)(CPP_FN, fixedWidth);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Emitter for the AnQst base-type codec `AnQst.Type.quint64`.
|
|
4
|
-
*
|
|
5
|
-
* Maps TypeScript `bigint` to an 8-byte unsigned little-endian representation via
|
|
6
|
-
* `BigUint64Array`, then to a standalone base93 string (10 characters). C++ uses
|
|
7
|
-
* `quint64` with `std::memcpy` for the same 8-byte layout on the host platform.
|
|
8
|
-
*
|
|
9
|
-
* Spec: RefinedSpecs/Codecs/BigInt_quint64_Codec.md
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.encoder = exports.descriptor = void 0;
|
|
13
|
-
const fixedwidth_1 = require("../shared/fixedwidth");
|
|
14
|
-
const fixedWidth = {
|
|
15
|
-
byteWidth: 8,
|
|
16
|
-
tsViewCtor: "BigUint64Array",
|
|
17
|
-
cppType: "quint64"
|
|
18
|
-
};
|
|
19
|
-
exports.descriptor = {
|
|
20
|
-
codecId: "bigint-quint64",
|
|
21
|
-
specPath: "RefinedSpecs/Codecs/BigInt_quint64_Codec.md",
|
|
22
|
-
tsType: "bigint",
|
|
23
|
-
cppType: "quint64",
|
|
24
|
-
wireCategory: "fixed-width-scalar",
|
|
25
|
-
strategySummary: "8-byte unsigned host-endian representation (BigUint64Array / memcpy into quint64), base93 standalone string (10 chars).",
|
|
26
|
-
fixedWidth
|
|
27
|
-
};
|
|
28
|
-
const TS_FN = "encodeQuint64Standalone";
|
|
29
|
-
const CPP_FN = "encodeQuint64Standalone";
|
|
30
|
-
exports.encoder = {
|
|
31
|
-
descriptor: exports.descriptor,
|
|
32
|
-
emitTsEncoder() {
|
|
33
|
-
return (0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)(TS_FN, fixedWidth);
|
|
34
|
-
},
|
|
35
|
-
emitCppEncoder() {
|
|
36
|
-
return (0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)(CPP_FN, fixedWidth);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter (decode): `AnQst.Type.blob`.
|
|
4
|
-
* Decoding mirrors `AnQst.Type.buffer`: base93 text reconstructs the original raw bytes as ArrayBuffer/QByteArray.
|
|
5
|
-
* This file preserves blob-specific descriptor identity while reusing the shared raw-byte scaffold.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.decoderEmitter = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const rawbytes_1 = require("../shared/rawbytes");
|
|
11
|
-
const encoder_1 = require("./encoder");
|
|
12
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
13
|
-
const TS_FN = "decodeBinaryBlobStandalone";
|
|
14
|
-
const CPP_FN = "decodeBinaryBlobStandalone";
|
|
15
|
-
const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.blob / QByteArray", [
|
|
16
|
-
"Base93-decodes the standalone wire string back into the original opaque byte sequence.",
|
|
17
|
-
"Wire layout is intentionally identical to AnQst.Type.buffer; the distinction is semantic descriptor metadata.",
|
|
18
|
-
"Expects base93Decode in scope; C++ reconstructs QByteArray directly from decoded bytes."
|
|
19
|
-
]);
|
|
20
|
-
exports.decoderEmitter = {
|
|
21
|
-
descriptor: encoder_1.descriptor,
|
|
22
|
-
emitTsDecoder() {
|
|
23
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneDecoder)(TS_FN, "bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)")}`;
|
|
24
|
-
},
|
|
25
|
-
emitCppDecoder() {
|
|
26
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneDecoder)(CPP_FN, "QByteArray(reinterpret_cast<const char*>(bytes.data()), static_cast<int>(bytes.size()))")}`;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter (encode): `AnQst.Type.blob`.
|
|
4
|
-
* Wire shape is identical to `AnQst.Type.buffer`: raw ArrayBuffer bytes become one base93 string.
|
|
5
|
-
* This emitter keeps distinct blob descriptor metadata while reusing the shared raw-byte scaffold.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.encoderEmitter = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const rawbytes_1 = require("../shared/rawbytes");
|
|
11
|
-
exports.descriptor = {
|
|
12
|
-
codecId: "binary-blob",
|
|
13
|
-
specPath: "RefinedSpecs/Codecs/Binary_blob_Codec.md",
|
|
14
|
-
tsType: "ArrayBuffer",
|
|
15
|
-
cppType: "QByteArray",
|
|
16
|
-
wireCategory: "binary",
|
|
17
|
-
strategySummary: "Serialize ArrayBuffer / QByteArray raw bytes as one base93 string; wire-identical to buffer, but with blob-specific descriptor metadata."
|
|
18
|
-
};
|
|
19
|
-
const TS_FN = "encodeBinaryBlobStandalone";
|
|
20
|
-
const CPP_FN = "encodeBinaryBlobStandalone";
|
|
21
|
-
const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.blob / QByteArray", [
|
|
22
|
-
"Treats the payload as opaque bytes and base93-encodes them into one standalone JSON string.",
|
|
23
|
-
"Wire layout is intentionally identical to AnQst.Type.buffer; only descriptor identity differs.",
|
|
24
|
-
"Expects base93Encode in scope; C++ path reads QByteArray bytes without adding length/type metadata."
|
|
25
|
-
]);
|
|
26
|
-
exports.encoderEmitter = {
|
|
27
|
-
descriptor: exports.descriptor,
|
|
28
|
-
emitTsEncoder() {
|
|
29
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneEncoder)(TS_FN, "new Uint8Array(value)")}`;
|
|
30
|
-
},
|
|
31
|
-
emitCppEncoder() {
|
|
32
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneEncoder)(CPP_FN, "std::vector<std::uint8_t>(reinterpret_cast<const std::uint8_t*>(value.constData()), reinterpret_cast<const std::uint8_t*>(value.constData()) + value.size())")}`;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter (decode): standalone base93 string → `ArrayBuffer` / `QByteArray`.
|
|
4
|
-
* The decoder reconstructs the exact raw byte sequence and returns the decoded backing buffer in TS.
|
|
5
|
-
* Composite codecs must decide where buffer-length metadata lives when a variable-length buffer shares a
|
|
6
|
-
* payload with sibling fields; this file only emits the standalone leaf helper and documents that strategy.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.decoder = exports.descriptor = void 0;
|
|
10
|
-
const comments_1 = require("../shared/comments");
|
|
11
|
-
const rawbytes_1 = require("../shared/rawbytes");
|
|
12
|
-
const encoder_1 = require("./encoder");
|
|
13
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
14
|
-
const TS_FN = "decodeAnqstBase_buffer";
|
|
15
|
-
const CPP_FN = "decodeAnqstBase_buffer";
|
|
16
|
-
const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.buffer / ArrayBuffer", [
|
|
17
|
-
"Base93-decodes the standalone wire string to raw bytes and returns the resulting opaque byte sequence.",
|
|
18
|
-
"TypeScript returns the ArrayBuffer backing the decoded Uint8Array without an extra copy; C++ rebuilds QByteArray from decoded bytes.",
|
|
19
|
-
"Composite codecs should read byte-length metadata from their planned numeric blob or trailing-position convention before consuming a buffer payload; that structured orchestration is intentionally not wired here."
|
|
20
|
-
]);
|
|
21
|
-
exports.decoder = {
|
|
22
|
-
descriptor: encoder_1.descriptor,
|
|
23
|
-
emitTsDecoder() {
|
|
24
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneDecoder)(TS_FN, "bytes.buffer")}`;
|
|
25
|
-
},
|
|
26
|
-
emitCppDecoder() {
|
|
27
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneDecoder)(CPP_FN, "QByteArray(bytes.begin(), bytes.end())")}`;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter (encode): `AnQst.Type.buffer` / `ArrayBuffer` ↔ `QByteArray`.
|
|
4
|
-
* Standalone wire shape is one base93 string over the raw bytes, including `""` for an empty buffer.
|
|
5
|
-
* Composite codecs should keep the variable-length buffer payload in its own string slot and pair it with
|
|
6
|
-
* byte-length metadata when sibling fields make boundaries ambiguous; that structured integration is
|
|
7
|
-
* documented here but intentionally not emitted by this leaf helper.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.encoder = exports.descriptor = void 0;
|
|
11
|
-
const comments_1 = require("../shared/comments");
|
|
12
|
-
const rawbytes_1 = require("../shared/rawbytes");
|
|
13
|
-
exports.descriptor = {
|
|
14
|
-
codecId: "AnQst.Type.buffer",
|
|
15
|
-
specPath: "RefinedSpecs/Codecs/Binary_buffer_Codec.md",
|
|
16
|
-
tsType: "ArrayBuffer",
|
|
17
|
-
cppType: "QByteArray",
|
|
18
|
-
wireCategory: "binary",
|
|
19
|
-
strategySummary: "ArrayBuffer/QByteArray raw bytes encoded as one standalone base93 string; composite codecs keep the payload in its own string slot and carry byte length separately when needed."
|
|
20
|
-
};
|
|
21
|
-
const TS_FN = "encodeAnqstBase_buffer";
|
|
22
|
-
const CPP_FN = "encodeAnqstBase_buffer";
|
|
23
|
-
const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.buffer / ArrayBuffer", [
|
|
24
|
-
"Treats the domain value as an opaque byte sequence and base93-encodes it as one standalone string.",
|
|
25
|
-
"TypeScript reads bytes through Uint8Array(value); C++ reads QByteArray through begin()/end() into std::vector<std::uint8_t>.",
|
|
26
|
-
"Composite codecs should keep this variable-length payload in its own wire string position and carry byte-length metadata separately when boundary disambiguation is required; that orchestration is not emitted here."
|
|
27
|
-
]);
|
|
28
|
-
exports.encoder = {
|
|
29
|
-
descriptor: exports.descriptor,
|
|
30
|
-
emitTsEncoder() {
|
|
31
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneEncoder)(TS_FN, "new Uint8Array(value)")}`;
|
|
32
|
-
},
|
|
33
|
-
emitCppEncoder() {
|
|
34
|
-
return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneEncoder)(CPP_FN, "std::vector<std::uint8_t>(value.begin(), value.end())")}`;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AnQstGen base-type codec emitter for `binary-float32Array`.
|
|
4
|
-
* Decoder consumes one base93 string of raw bytes and reconstructs a concrete `Float32Array`.
|
|
5
|
-
* Multi-byte element byte order and all IEEE 754 bit patterns are preserved exactly as transmitted.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.decoder = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const encoder_1 = require("./encoder");
|
|
11
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
12
|
-
const TS_FN = "decodeBinaryFloat32ArrayStandalone";
|
|
13
|
-
const CPP_FN = "decodeBinaryFloat32ArrayStandalone";
|
|
14
|
-
exports.decoder = {
|
|
15
|
-
descriptor: encoder_1.descriptor,
|
|
16
|
-
emitTsDecoder() {
|
|
17
|
-
return [
|
|
18
|
-
(0, comments_1.emitStrategyComment)("AnQst Float32Array decoder (raw-byte base93)", [
|
|
19
|
-
"Decodes base93 to bytes, then constructs a concrete Float32Array view over the decoded buffer.",
|
|
20
|
-
"Rejected decoded byte counts not divisible by 4 indicate corrupted wire data because Float32Array elements require 4 bytes each."
|
|
21
|
-
]),
|
|
22
|
-
`function ${TS_FN}(encoded) {`,
|
|
23
|
-
" const bytes = base93Decode(encoded);",
|
|
24
|
-
" if ((bytes.byteLength & 3) !== 0) {",
|
|
25
|
-
" throw new RangeError(\"Decoded Float32Array byte length must be divisible by 4.\");",
|
|
26
|
-
" }",
|
|
27
|
-
" return new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);",
|
|
28
|
-
"}"
|
|
29
|
-
].join("\n");
|
|
30
|
-
},
|
|
31
|
-
emitCppDecoder() {
|
|
32
|
-
return [
|
|
33
|
-
(0, comments_1.emitStrategyComment)("AnQst Float32Array decoder (QByteArray raw bytes)", [
|
|
34
|
-
"C++ receives the raw bytes as QByteArray; float interpretation stays outside the byte-transport codec.",
|
|
35
|
-
"Portable tests may supply a lightweight QByteArray shim with a (const char*, int) constructor."
|
|
36
|
-
]),
|
|
37
|
-
`inline QByteArray ${CPP_FN}(const std::string& encoded) {`,
|
|
38
|
-
" const std::vector<std::uint8_t> bytes = base93Decode(encoded);",
|
|
39
|
-
" return QByteArray(",
|
|
40
|
-
" reinterpret_cast<const char*>(bytes.data()),",
|
|
41
|
-
" static_cast<int>(bytes.size())",
|
|
42
|
-
" );",
|
|
43
|
-
"}"
|
|
44
|
-
].join("\n");
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AnQstGen base-type codec emitter for `binary-float32Array`.
|
|
4
|
-
* Wire form is one base93 string carrying the raw bytes of a `Float32Array` view.
|
|
5
|
-
* The TypeScript path must respect `byteOffset`/`byteLength`; the C++ path keeps the spec-facing `QByteArray` signature.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.encoder = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
exports.descriptor = {
|
|
11
|
-
codecId: "binary-float32Array",
|
|
12
|
-
specPath: "RefinedSpecs/Codecs/Binary_float32Array_Codec.md",
|
|
13
|
-
tsType: "Float32Array",
|
|
14
|
-
cppType: "QByteArray",
|
|
15
|
-
wireCategory: "binary",
|
|
16
|
-
strategySummary: "Base93-encode the raw bytes of the Float32Array view (respecting byteOffset/byteLength); C++ receives the same raw bytes in QByteArray."
|
|
17
|
-
};
|
|
18
|
-
const TS_FN = "encodeBinaryFloat32ArrayStandalone";
|
|
19
|
-
const CPP_FN = "encodeBinaryFloat32ArrayStandalone";
|
|
20
|
-
exports.encoder = {
|
|
21
|
-
descriptor: exports.descriptor,
|
|
22
|
-
emitTsEncoder() {
|
|
23
|
-
return [
|
|
24
|
-
(0, comments_1.emitStrategyComment)("AnQst Float32Array encoder (raw-byte base93)", [
|
|
25
|
-
"Reads only the concrete view window via byteOffset/byteLength, so subviews do not leak adjacent buffer bytes.",
|
|
26
|
-
"Preserves the stored IEEE 754 binary32 bit patterns exactly, including NaN payloads, infinities, and signed zero."
|
|
27
|
-
]),
|
|
28
|
-
`function ${TS_FN}(value) {`,
|
|
29
|
-
" const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);",
|
|
30
|
-
" return base93Encode(bytes);",
|
|
31
|
-
"}"
|
|
32
|
-
].join("\n");
|
|
33
|
-
},
|
|
34
|
-
emitCppEncoder() {
|
|
35
|
-
return [
|
|
36
|
-
(0, comments_1.emitStrategyComment)("AnQst Float32Array encoder (QByteArray raw bytes)", [
|
|
37
|
-
"Host-side integration passes the raw float32 bytes as QByteArray; portable tests can provide a minimal QByteArray shim.",
|
|
38
|
-
"No byte swapping or float normalization is performed; the QByteArray contents are forwarded as-is into base93."
|
|
39
|
-
]),
|
|
40
|
-
`inline std::string ${CPP_FN}(const QByteArray& value) {`,
|
|
41
|
-
" std::vector<std::uint8_t> bytes(static_cast<std::size_t>(value.size()));",
|
|
42
|
-
" if (!bytes.empty()) {",
|
|
43
|
-
" std::memcpy(bytes.data(), value.constData(), bytes.size());",
|
|
44
|
-
" }",
|
|
45
|
-
" return base93Encode(bytes);",
|
|
46
|
-
"}"
|
|
47
|
-
].join("\n");
|
|
48
|
-
}
|
|
49
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AnQstGen base-type codec emitter for `binary-float64Array`.
|
|
4
|
-
* Decoder consumes one base93 string of raw bytes and reconstructs a concrete `Float64Array`.
|
|
5
|
-
* Multi-byte element byte order is preserved exactly as transmitted; no byte swapping is introduced.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.decoder = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const encoder_1 = require("./encoder");
|
|
11
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
12
|
-
const TS_FN = "decodeBinaryFloat64ArrayStandalone";
|
|
13
|
-
const CPP_FN = "decodeBinaryFloat64ArrayStandalone";
|
|
14
|
-
exports.decoder = {
|
|
15
|
-
descriptor: encoder_1.descriptor,
|
|
16
|
-
emitTsDecoder() {
|
|
17
|
-
return [
|
|
18
|
-
(0, comments_1.emitStrategyComment)("AnQst Float64Array decoder (raw-byte base93)", [
|
|
19
|
-
"Decodes base93 to bytes, then constructs a concrete Float64Array over the decoded buffer.",
|
|
20
|
-
"Rejected decoded byte counts that are not divisible by 8 indicate corrupted wire data because Float64Array elements require 8 bytes each."
|
|
21
|
-
]),
|
|
22
|
-
`function ${TS_FN}(encoded) {`,
|
|
23
|
-
" const bytes = base93Decode(encoded);",
|
|
24
|
-
" if ((bytes.byteLength & 7) !== 0) {",
|
|
25
|
-
' throw new RangeError("Decoded Float64Array byte length must be divisible by 8.");',
|
|
26
|
-
" }",
|
|
27
|
-
" return new Float64Array(bytes.buffer);",
|
|
28
|
-
"}"
|
|
29
|
-
].join("\n");
|
|
30
|
-
},
|
|
31
|
-
emitCppDecoder() {
|
|
32
|
-
return [
|
|
33
|
-
(0, comments_1.emitStrategyComment)("AnQst Float64Array decoder (QByteArray raw bytes)", [
|
|
34
|
-
"C++ receives the raw bytes as QByteArray; element interpretation stays outside the byte-transport codec.",
|
|
35
|
-
"Portable tests may supply a lightweight QByteArray shim with a (const char*, int) constructor."
|
|
36
|
-
]),
|
|
37
|
-
`inline QByteArray ${CPP_FN}(const std::string& encoded) {`,
|
|
38
|
-
" const std::vector<std::uint8_t> bytes = base93Decode(encoded);",
|
|
39
|
-
" return QByteArray(",
|
|
40
|
-
" reinterpret_cast<const char*>(bytes.data()),",
|
|
41
|
-
" static_cast<int>(bytes.size())",
|
|
42
|
-
" );",
|
|
43
|
-
"}"
|
|
44
|
-
].join("\n");
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AnQstGen base-type codec emitter for `binary-float64Array`.
|
|
4
|
-
* Wire form is one base93 string carrying the raw bytes of a `Float64Array` view.
|
|
5
|
-
* The TypeScript path must respect `byteOffset`/`byteLength`; the C++ path keeps the spec-facing `QByteArray` signature.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.encoder = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const rawbytes_1 = require("../shared/rawbytes");
|
|
11
|
-
exports.descriptor = {
|
|
12
|
-
codecId: "binary-float64Array",
|
|
13
|
-
specPath: "RefinedSpecs/Codecs/Binary_float64Array_Codec.md",
|
|
14
|
-
tsType: "Float64Array",
|
|
15
|
-
cppType: "QByteArray",
|
|
16
|
-
wireCategory: "binary",
|
|
17
|
-
strategySummary: "Base93-encode the raw bytes of the Float64Array view (respecting byteOffset/byteLength); C++ receives the same raw bytes in QByteArray."
|
|
18
|
-
};
|
|
19
|
-
const TS_FN = "encodeBinaryFloat64ArrayStandalone";
|
|
20
|
-
const CPP_FN = "encodeBinaryFloat64ArrayStandalone";
|
|
21
|
-
exports.encoder = {
|
|
22
|
-
descriptor: exports.descriptor,
|
|
23
|
-
emitTsEncoder() {
|
|
24
|
-
return [
|
|
25
|
-
(0, comments_1.emitStrategyComment)("AnQst Float64Array encoder (raw-byte base93)", [
|
|
26
|
-
"Reads only the active Float64Array view window via byteOffset/byteLength, so subviews do not leak adjacent buffer bytes.",
|
|
27
|
-
"Preserves the stored IEEE 754 binary64 bytes exactly, including NaN payloads, infinities, signed zero, and subnormals."
|
|
28
|
-
]),
|
|
29
|
-
(0, rawbytes_1.emitTsRawByteStandaloneEncoder)(TS_FN, "new Uint8Array(value.buffer, value.byteOffset, value.byteLength)")
|
|
30
|
-
].join("\n\n");
|
|
31
|
-
},
|
|
32
|
-
emitCppEncoder() {
|
|
33
|
-
return [
|
|
34
|
-
(0, comments_1.emitStrategyComment)("AnQst Float64Array encoder (QByteArray raw bytes)", [
|
|
35
|
-
"Host-side integration passes the Float64Array payload as QByteArray because the backend mapping is raw bytes, not a numeric container.",
|
|
36
|
-
"No byte swapping or normalization is performed; the QByteArray contents are forwarded as-is into base93."
|
|
37
|
-
]),
|
|
38
|
-
`inline std::string ${CPP_FN}(const QByteArray& value) {`,
|
|
39
|
-
" std::vector<std::uint8_t> bytes(static_cast<std::size_t>(value.size()));",
|
|
40
|
-
" if (!bytes.empty()) {",
|
|
41
|
-
" std::memcpy(bytes.data(), value.constData(), bytes.size());",
|
|
42
|
-
" }",
|
|
43
|
-
" return base93Encode(bytes);",
|
|
44
|
-
"}"
|
|
45
|
-
].join("\n");
|
|
46
|
-
}
|
|
47
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AnQstGen base-type codec emitter for `binary-int16Array`.
|
|
4
|
-
* Decoder consumes one base93 string of raw bytes and reconstructs a concrete `Int16Array`.
|
|
5
|
-
* Multi-byte element byte order is preserved exactly as transmitted; no byte swapping is introduced.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.decoder = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const encoder_1 = require("./encoder");
|
|
11
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
12
|
-
const TS_FN = "decodeBinaryInt16ArrayStandalone";
|
|
13
|
-
const CPP_FN = "decodeBinaryInt16ArrayStandalone";
|
|
14
|
-
exports.decoder = {
|
|
15
|
-
descriptor: encoder_1.descriptor,
|
|
16
|
-
emitTsDecoder() {
|
|
17
|
-
return [
|
|
18
|
-
(0, comments_1.emitStrategyComment)("AnQst Int16Array decoder (raw-byte base93)", [
|
|
19
|
-
"Decodes base93 to bytes, then reconstructs a concrete Int16Array over the decoded buffer.",
|
|
20
|
-
"Rejected odd decoded byte counts indicate corrupted wire data because Int16Array elements require 2 bytes each."
|
|
21
|
-
]),
|
|
22
|
-
`function ${TS_FN}(encoded) {`,
|
|
23
|
-
" const bytes = base93Decode(encoded);",
|
|
24
|
-
" if ((bytes.byteLength & 1) !== 0) {",
|
|
25
|
-
" throw new RangeError(\"Decoded Int16Array byte length must be divisible by 2.\");",
|
|
26
|
-
" }",
|
|
27
|
-
" return new Int16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2);",
|
|
28
|
-
"}"
|
|
29
|
-
].join("\n");
|
|
30
|
-
},
|
|
31
|
-
emitCppDecoder() {
|
|
32
|
-
return [
|
|
33
|
-
(0, comments_1.emitStrategyComment)("AnQst Int16Array decoder (QByteArray raw bytes)", [
|
|
34
|
-
"C++ receives the raw bytes as QByteArray; signed 16-bit interpretation stays outside the byte-transport codec.",
|
|
35
|
-
"Portable tests may supply a lightweight QByteArray shim with a (const char*, int) constructor."
|
|
36
|
-
]),
|
|
37
|
-
`inline QByteArray ${CPP_FN}(const std::string& encoded) {`,
|
|
38
|
-
" const std::vector<std::uint8_t> bytes = base93Decode(encoded);",
|
|
39
|
-
" return QByteArray(",
|
|
40
|
-
" reinterpret_cast<const char*>(bytes.data()),",
|
|
41
|
-
" static_cast<int>(bytes.size())",
|
|
42
|
-
" );",
|
|
43
|
-
"}"
|
|
44
|
-
].join("\n");
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AnQstGen base-type codec emitter for `binary-int16Array`.
|
|
4
|
-
* Wire form is one base93 string carrying the raw bytes of an `Int16Array` view.
|
|
5
|
-
* The TypeScript path must respect `byteOffset`/`byteLength`; the C++ path keeps the spec-facing `QByteArray` signature.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.encoder = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
exports.descriptor = {
|
|
11
|
-
codecId: "binary-int16Array",
|
|
12
|
-
specPath: "RefinedSpecs/Codecs/Binary_int16Array_Codec.md",
|
|
13
|
-
tsType: "Int16Array",
|
|
14
|
-
cppType: "QByteArray",
|
|
15
|
-
wireCategory: "binary",
|
|
16
|
-
strategySummary: "Base93-encode the raw bytes of the Int16Array view (respecting byteOffset/byteLength); C++ receives the same raw bytes in QByteArray."
|
|
17
|
-
};
|
|
18
|
-
const TS_FN = "encodeBinaryInt16ArrayStandalone";
|
|
19
|
-
const CPP_FN = "encodeBinaryInt16ArrayStandalone";
|
|
20
|
-
exports.encoder = {
|
|
21
|
-
descriptor: exports.descriptor,
|
|
22
|
-
emitTsEncoder() {
|
|
23
|
-
return [
|
|
24
|
-
(0, comments_1.emitStrategyComment)("AnQst Int16Array encoder (raw-byte base93)", [
|
|
25
|
-
"Reads only the concrete view window via byteOffset/byteLength, so subviews do not leak adjacent buffer bytes.",
|
|
26
|
-
"Preserves platform-native two-byte element layout by forwarding the stored raw bytes unchanged into base93."
|
|
27
|
-
]),
|
|
28
|
-
`function ${TS_FN}(value) {`,
|
|
29
|
-
" const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);",
|
|
30
|
-
" return base93Encode(bytes);",
|
|
31
|
-
"}"
|
|
32
|
-
].join("\n");
|
|
33
|
-
},
|
|
34
|
-
emitCppEncoder() {
|
|
35
|
-
return [
|
|
36
|
-
(0, comments_1.emitStrategyComment)("AnQst Int16Array encoder (QByteArray raw bytes)", [
|
|
37
|
-
"Host-side integration passes the raw typed-array bytes as QByteArray; portable tests can provide a minimal QByteArray shim.",
|
|
38
|
-
"No byte swapping is performed; the QByteArray contents are forwarded as-is into base93."
|
|
39
|
-
]),
|
|
40
|
-
`inline std::string ${CPP_FN}(const QByteArray& value) {`,
|
|
41
|
-
" std::vector<std::uint8_t> bytes(static_cast<std::size_t>(value.size()));",
|
|
42
|
-
" if (!bytes.empty()) {",
|
|
43
|
-
" std::memcpy(bytes.data(), value.constData(), bytes.size());",
|
|
44
|
-
" }",
|
|
45
|
-
" return base93Encode(bytes);",
|
|
46
|
-
"}"
|
|
47
|
-
].join("\n");
|
|
48
|
-
}
|
|
49
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Base codec emitter: `AnQst.Type.int32Array` decoder.
|
|
4
|
-
* Decodes one raw-byte base93 string back into a concrete `Int32Array`, preserving
|
|
5
|
-
* the exact transmitted byte sequence and rejecting byte counts that cannot form 32-bit elements.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.decoder = exports.decoderEmitter = exports.descriptor = void 0;
|
|
9
|
-
const comments_1 = require("../shared/comments");
|
|
10
|
-
const encoder_1 = require("./encoder");
|
|
11
|
-
Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
|
|
12
|
-
const TS_FN = "decodeBinaryInt32ArrayStandalone";
|
|
13
|
-
const CPP_FN = "decodeBinaryInt32ArrayStandalone";
|
|
14
|
-
exports.decoderEmitter = {
|
|
15
|
-
descriptor: encoder_1.descriptor,
|
|
16
|
-
emitTsDecoder() {
|
|
17
|
-
return [
|
|
18
|
-
(0, comments_1.emitStrategyComment)("AnQst Int32Array decoder (raw-byte base93)", [
|
|
19
|
-
"Base93-decodes the standalone wire payload back to raw bytes and reconstructs a concrete Int32Array.",
|
|
20
|
-
"Decoded byte counts must be divisible by 4 because each Int32Array element occupies exactly 4 bytes.",
|
|
21
|
-
"Slices the decoded byte window before constructing Int32Array so reconstruction is robust even if the decoded Uint8Array is not offset-zero."
|
|
22
|
-
]),
|
|
23
|
-
`function ${TS_FN}(encoded) {`,
|
|
24
|
-
" const bytes = base93Decode(encoded);",
|
|
25
|
-
" if ((bytes.byteLength & 3) !== 0) {",
|
|
26
|
-
" throw new RangeError(\"Decoded Int32Array byte length must be divisible by 4.\");",
|
|
27
|
-
" }",
|
|
28
|
-
" const buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);",
|
|
29
|
-
" return new Int32Array(buffer);",
|
|
30
|
-
"}"
|
|
31
|
-
].join("\n");
|
|
32
|
-
},
|
|
33
|
-
emitCppDecoder() {
|
|
34
|
-
return [
|
|
35
|
-
(0, comments_1.emitStrategyComment)("AnQst Int32Array decoder (QByteArray raw bytes)", [
|
|
36
|
-
"C++ receives the same raw 32-bit element storage bytes as QByteArray; typed interpretation remains outside this byte-transport helper.",
|
|
37
|
-
"Portable interop tests can use a lightweight QByteArray shim with a (const char*, int) constructor.",
|
|
38
|
-
"No sign conversion or byte swapping occurs during wire decode; the original raw bytes are restored exactly."
|
|
39
|
-
]),
|
|
40
|
-
`inline QByteArray ${CPP_FN}(const std::string& encoded) {`,
|
|
41
|
-
" const std::vector<std::uint8_t> bytes = base93Decode(encoded);",
|
|
42
|
-
" return QByteArray(",
|
|
43
|
-
" reinterpret_cast<const char*>(bytes.data()),",
|
|
44
|
-
" static_cast<int>(bytes.size())",
|
|
45
|
-
" );",
|
|
46
|
-
"}"
|
|
47
|
-
].join("\n");
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
exports.decoder = exports.decoderEmitter;
|