All files / output zcl_abapgit_string_buffer.clas.mjs

89.7% Statements 61/68
90% Branches 9/10
47.05% Functions 8/17
89.7% Lines 61/68

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 681x 1x 14x 14x 14x 14x 14x 14x 1x 1x 1x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 60x 60x 60x 60x 60x 60x 60x 60x 14x           14x 13x 13x 13x 13x 13x 14x 1x 1x 1x 1x 1x 14x     14x 9x 9x 9x 9x 14x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_string_buffer.clas.abap
class zcl_abapgit_string_buffer {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_STRING_BUFFER';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MT_BUFFER": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"NEW": {"visibility": "U", "parameters": {"RO_ME": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_BUFFER", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_BUFFER"});}, "is_optional": " "}}},
  "ADD": {"visibility": "U", "parameters": {"RO_ME": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_BUFFER", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_BUFFER"});}, "is_optional": " "}, "IV_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "JOIN_AND_FLUSH": {"visibility": "U", "parameters": {"RV_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "JOIN_W_NEWLINE_AND_FLUSH": {"visibility": "U", "parameters": {"RV_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "JOIN_W_SPACE_AND_FLUSH": {"visibility": "U", "parameters": {"RV_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}};
  #mt_buffer;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "add": this.add.bind(this),
      "join_and_flush": this.join_and_flush.bind(this),
      "join_w_newline_and_flush": this.join_w_newline_and_flush.bind(this),
      "join_w_space_and_flush": this.join_w_space_and_flush.bind(this),
    };
    this.#mt_buffer = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");
    this.FRIENDS_ACCESS_INSTANCE["mt_buffer"] = this.#mt_buffer;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async add(INPUT) {
    let ro_me = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_BUFFER", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_BUFFER"});
    let iv_str = INPUT?.iv_str;
    if (iv_str?.getQualifiedName === undefined || iv_str.getQualifiedName() !== "STRING") { iv_str = undefined; }
    if (iv_str === undefined) { iv_str = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_str); }
    abap.statements.append({source: iv_str, target: this.#mt_buffer});
    ro_me.set(this.me);
    return ro_me;
  }
  async join_and_flush() {
    let rv_str = new abap.types.String({qualifiedName: "STRING"});
    rv_str.set(abap.builtin.concat_lines_of({table: this.#mt_buffer}));
    this.#mt_buffer.clear();
    return rv_str;
  }
  async join_w_newline_and_flush() {
    let rv_str = new abap.types.String({qualifiedName: "STRING"});
    rv_str.set(abap.builtin.concat_lines_of({table: this.#mt_buffer, sep: abap.Classes['CL_ABAP_CHAR_UTILITIES'].newline}));
    this.#mt_buffer.clear();
    return rv_str;
  }
  async join_w_space_and_flush() {
    let rv_str = new abap.types.String({qualifiedName: "STRING"});
    rv_str.set(abap.builtin.concat_lines_of({table: this.#mt_buffer, sep: new abap.types.String().set(` `)}));
    this.#mt_buffer.clear();
    return rv_str;
  }
  async new() {
    return zcl_abapgit_string_buffer.new();
  }
  static async new() {
    let ro_me = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_STRING_BUFFER", RTTIName: "\\CLASS=ZCL_ABAPGIT_STRING_BUFFER"});
    ro_me.set(await (new abap.Classes['ZCL_ABAPGIT_STRING_BUFFER']()).constructor_());
    return ro_me;
  }
}
abap.Classes['ZCL_ABAPGIT_STRING_BUFFER'] = zcl_abapgit_string_buffer;
export {zcl_abapgit_string_buffer};