summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XBidiParagraph.d.ts
blob: 94d29baa42f6cde6573c0a3015e01cff021ea386 (plain)
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
import { u8, usize } from "./diplomat-runtime"
import { FFIError } from "./diplomat-runtime"
import { ICU4XBidiDirection } from "./ICU4XBidiDirection";
import { ICU4XError } from "./ICU4XError";

/**

 * Bidi information for a single processed paragraph
 */
export class ICU4XBidiParagraph {

  /**

   * Given a paragraph index `n` within the surrounding text, this sets this object to the paragraph at that index. Returns `ICU4XError::OutOfBoundsError` when out of bounds.

   * This is equivalent to calling `paragraph_at()` on `ICU4XBidiInfo` but doesn't create a new object
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  set_paragraph_in_text(n: usize): void | never;

  /**

   * The primary direction of this paragraph

   * See the {@link https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at Rust documentation for `level_at`} for more information.
   */
  direction(): ICU4XBidiDirection;

  /**

   * The number of bytes in this paragraph

   * See the {@link https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.ParagraphInfo.html#method.len Rust documentation for `len`} for more information.
   */
  size(): usize;

  /**

   * The start index of this paragraph within the source text
   */
  range_start(): usize;

  /**

   * The end index of this paragraph within the source text
   */
  range_end(): usize;

  /**

   * Reorder a line based on display order. The ranges are specified relative to the source text and must be contained within this paragraph's range.

   * See the {@link https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at Rust documentation for `level_at`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  reorder_line(range_start: usize, range_end: usize): string | never;

  /**

   * Get the BIDI level at a particular byte index in this paragraph. This integer is conceptually a `unicode_bidi::Level`, and can be further inspected using the static methods on ICU4XBidi.

   * Returns 0 (equivalent to `Level::ltr()`) on error

   * See the {@link https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.Paragraph.html#method.level_at Rust documentation for `level_at`} for more information.
   */
  level_at(pos: usize): u8;
}