JFLib

diagram_core/src/views.rs#

Source: lib/diagram_core/src/views.rs

views -- rows of a sheet as the user knows them: shape data, user cells, hyperlinks, layers

  doc.section_rows(sheet, sec) -> Vec<RowView>   every row a section really has
  doc.shape_data(sheet)        the Property rows (DA-01: Label, Type, Format, Value ...)
  doc.user_cells(sheet)        the User rows (Value, Prompt)
  doc.hyperlinks(sheet)        the Hyperlink rows (Address, SubAddress, Description ...)
  doc.layers(page)             the Layer rows of a page sheet (Name, Visible, Print, Lock ...)
  doc.layer_members(shape)     the layer indices of a shape (LayerMember "0;2")
  row.get("Label") -> Resolved   row.text("Label") / num(..) / flag(..)

The views read through inheritance (inherit.rs): an instance shows the shape data of its
master with its own values over them.  Shape data, user cells and hyperlinks exist on shapes,
pages and the document alike.
  • struct RowView<'d> one row of a section with access to its cells
    • sheet: SheetRef -- the sheet asked
    • section: SecKey -- the section
    • row: EffRow -- the row

impl<'d> RowView<'d>

  • fn key(&self) -> RowKey IX or N
  • fn name(&self) -> Option<&'d str> the universal name of a named row (Prop.<name>, User.<name>)
  • fn addr(&self, cell: Sym) -> CellAddr the address of one of its cells
  • fn cell(&self, cell: Sym) -> Resolved<'d> a cell of the row
  • fn get(&self, cell: &str) -> Resolved<'d> a cell of the row by name
  • fn text(&self, cell: &str) -> Option<&'d str> a cell's value as text (None: a number or no value)
  • fn num(&self, cell: &str) -> Option<f64> a cell's value as a number
  • fn flag(&self, cell: &str) -> bool a cell's value as a truth value (a number other than 0, or "TRUE")

impl Document

  • fn section_rows(&self, sheet: SheetRef, sec: SecKey) -> Vec<RowView<'_>> every row section sec really has for sheet

  • fn shape_data(&self, sheet: SheetRef) -> Vec<RowView<'_>> the shape data fields (Property rows)

  • fn user_cells(&self, sheet: SheetRef) -> Vec<RowView<'_>> the user-defined cells (User rows)

  • fn layers(&self, page: PageRef) -> Vec<RowView<'_>> the layers of a page (Layer rows of its page sheet; the index is the layer's number)

  • fn layer_by_name(&self, page: PageRef, name: &str) -> Option<u32> the layer of a page with this universal name (NameUniv, else Name) -> its index

  • fn layer_members(&self, shape: ShapeRef) -> Vec<u32> the layers a shape is on (its LayerMember cell, with inheritance)

  • fn parse_members(text: &str) -> Vec<u32> a LayerMember text ("0;2") -> the layer indices

Source: docs/API.md in the JFLib repository.