All files / output cl_abap_codepage.clas.mjs

66.66% Statements 46/69
54.54% Branches 6/11
17.64% Functions 3/17
66.66% Lines 46/69

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 59 60 61 62 63 64 65 66 67 68 691x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x     1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 1x     1x 149x 149x 149x 149x 149x 149x 149x 149x 149x 149x 149x 149x 149x 1x     1x                 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// cl_abap_codepage.clas.abap
class cl_abap_codepage {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CL_ABAP_CODEPAGE';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"CONVERT_TO": {"visibility": "U", "parameters": {"OUTPUT": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "is_optional": " "}, "CODEPAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "SOURCE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "CONVERT_FROM": {"visibility": "U", "parameters": {"OUTPUT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "CODEPAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "SOURCE": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "is_optional": " "}}},
  "SAP_CODEPAGE": {"visibility": "U", "parameters": {"CODEPAGE": {"type": () => {return new abap.types.Character(20, {"qualifiedName":"abap_encoding"});}, "is_optional": " "}, "ENCODING": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async convert_to(INPUT) {
    return cl_abap_codepage.convert_to(INPUT);
  }
  static async convert_to(INPUT) {
    let output = new abap.types.XString({qualifiedName: "XSTRING"});
    let codepage = new abap.types.String({qualifiedName: "STRING"});
    if (INPUT && INPUT.codepage) {codepage.set(INPUT.codepage);}
    if (INPUT === undefined || INPUT.codepage === undefined) {codepage = abap.CharacterFactory.get(5, 'UTF-8');}
    let source = INPUT?.source;
    if (source?.getQualifiedName === undefined || source.getQualifiedName() !== "STRING") { source = undefined; }
    if (source === undefined) { source = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.source); }
    let conv = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_CONV_OUT_CE", RTTIName: "\\CLASS=CL_ABAP_CONV_OUT_CE"});
    conv.set((await abap.Classes['CL_ABAP_CONV_OUT_CE'].create({encoding: codepage})));
    await conv.get().convert({data: source, buffer: output});
    return output;
  }
  async convert_from(INPUT) {
    return cl_abap_codepage.convert_from(INPUT);
  }
  static async convert_from(INPUT) {
    let output = new abap.types.String({qualifiedName: "STRING"});
    let codepage = new abap.types.String({qualifiedName: "STRING"});
    if (INPUT && INPUT.codepage) {codepage.set(INPUT.codepage);}
    if (INPUT === undefined || INPUT.codepage === undefined) {codepage = abap.CharacterFactory.get(5, 'UTF-8');}
    let source = INPUT?.source;
    if (source?.getQualifiedName === undefined || source.getQualifiedName() !== "XSTRING") { source = undefined; }
    if (source === undefined) { source = new abap.types.XString({qualifiedName: "XSTRING"}).set(INPUT.source); }
    let conv = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_CONV_IN_CE", RTTIName: "\\CLASS=CL_ABAP_CONV_IN_CE"});
    let data = new abap.types.String({qualifiedName: "STRING"});
    conv.set((await abap.Classes['CL_ABAP_CONV_IN_CE'].create({encoding: codepage})));
    await conv.get().convert({input: source, data: output});
    return output;
  }
  async sap_codepage(INPUT) {
    return cl_abap_codepage.sap_codepage(INPUT);
  }
  static async sap_codepage(INPUT) {
    let codepage = new abap.types.Character(20, {"qualifiedName":"abap_encoding"});
    let encoding = INPUT?.encoding;
    if (encoding?.getQualifiedName === undefined || encoding.getQualifiedName() !== "STRING") { encoding = undefined; }
    if (encoding === undefined) { encoding = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.encoding); }
    abap.statements.assert(abap.compare.eq(encoding, abap.CharacterFactory.get(8, 'UTF-16LE')));
    codepage.set(abap.CharacterFactory.get(4, '4103'));
    return codepage;
  }
}
abap.Classes['CL_ABAP_CODEPAGE'] = cl_abap_codepage;
export {cl_abap_codepage};