wip: fix doctree example

This commit is contained in:
2024-12-30 12:22:36 +02:00
parent 523a58cfec
commit e34a770cc6
278 changed files with 19517 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
module spreadsheet
import freeflowuniverse.herolib.data.currency
pub struct Cell {
pub mut:
val f64
row &Row @[skip; str: skip]
empty bool = true
}
pub fn (mut c Cell) set(v string) ! {
// means we insert a currency so need to do the exchange
mut amount := currency.amount_get(v)!
assert amount.currency.name != ''
mut amount2 := amount.exchange(c.row.sheet.currency)! // do the exchange to the local currency
c.val = amount2.val
c.empty = false
}
pub fn (mut c Cell) add(v f64) {
c.val += v
c.empty = false
}
pub fn (mut c Cell) repr() string {
if c.empty {
return '-'
}
return float_repr(c.val, c.row.reprtype)
}
pub fn (mut c Cell) str() string {
return c.repr()
}