diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2017-11-29 15:51:39 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2018-02-09 10:27:07 +0100 |
commit | bb48738c4111f5f4e2faa40fe67ae1b8b9d7c2eb (patch) | |
tree | fdea7f0473453423f052700c7cf807640589ab2f /src/odf | |
parent | 754713ed399110d5a199653a684d65cbe258bf5d (diff) |
Rework on the Sheet.ml API : removed low level functions, made the sheet mutable
Diffstat (limited to 'src/odf')
-rwxr-xr-x | src/odf/odf.ml | 2 | ||||
-rwxr-xr-x | src/odf/odfLoader.ml | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/odf/odf.ml b/src/odf/odf.ml index 176e70a..1db9d4b 100755 --- a/src/odf/odf.ml +++ b/src/odf/odf.ml @@ -210,7 +210,7 @@ let save sheet file = begin Xmlm.output output (`El_start (NS.table_node, []));
Xmlm.output output (`El_start (NS.table_row_node, []));
- ignore (Sheet.Raw.fold (f output) (1,1) sheet);
+ ignore (Sheet.fold (f output) (1,1) sheet);
Xmlm.output output `El_end;
Xmlm.output output `El_end;
diff --git a/src/odf/odfLoader.ml b/src/odf/odfLoader.ml index 93a6c62..280e6bd 100755 --- a/src/odf/odfLoader.ml +++ b/src/odf/odfLoader.ml @@ -83,7 +83,7 @@ let build_p (attributes:Xmlm.attribute list) = begin function end
-let build_row (sheet:Sheet.Raw.t ref) (row_num:int ref) catalog (attributes:Xmlm.attribute list) (childs:tree list) = begin
+let build_row (sheet:Sheet.t) (row_num:int ref) (attributes:Xmlm.attribute list) (childs:tree list) = begin
let repetition =
try int_of_string @@ List.assoc (NS.table, "number-rows-repeated") attributes
@@ -94,7 +94,7 @@ let build_row (sheet:Sheet.Raw.t ref) (row_num:int ref) catalog (attributes:Xmlm List.iter (function
| Cell cell ->
for i = 1 to cell.repetition do
- sheet := snd @@ Sheet.Raw.add (!cell_num, !row_num) cell.expression catalog !sheet;
+ ignore @@ Sheet.add ~history:false cell.expression (!cell_num, !row_num) sheet;
cell_num := !cell_num + cell.cell_width
done;
| _ -> ()
@@ -109,13 +109,13 @@ let data str = Data str let load catalog source = begin
(* Mutable datas *)
- let sheet = ref Sheet.Raw.empty in
+ let sheet = Sheet.create catalog in
let cache = Hashtbl.create 10 in
let table = Base.String_dict.of_alist_exn [
((NS.text ^ "p"), build_p);
((NS.table ^ "table-cell"), build_cell cache);
- ((NS.table ^ "table-row"), build_row sheet (ref 1) catalog)
+ ((NS.table ^ "table-row"), build_row sheet (ref 1))
] in
let el (((ns, name), attributes):Xmlm.tag) childs = begin
@@ -125,6 +125,6 @@ let load catalog source = begin end in
match Xmlm.input_doc_tree ~el ~data source with
- | _, Unit -> !sheet
+ | _, Unit -> sheet
| _ -> raise Not_found
end
|