TNodeFile

working with stored binary qubtrees

TNodeFile.Create

Creates an unopened file. Root is null.

Root

INode: read/write: the top-level node of the file. Valid if IsOpen.
Set Root to replace the contents of a (possibly emtpy) file.

IsOpen

Boolean: whether this TNodeFile is managing an open file

Close

returns      true if successful

Closes the underlying file without saving changes.
If there are outstanding references to Root or any subtree, it will be copied into memory, with the references transparently redirected there. (so it's more efficient to lose your references before closing the file.)
Once closed, the TNodeFile can be reused to open another file.

Save

returns      true if successful

Saves any nodes for which node.Changed is true.
Node.changed is set automatically for structural changes (Parent, Child, DataSize) but you should set it manually after modifying the data's contents.
The file must already be open.

TNodeStdFile

Subclass of TNodeFile for working with nodes on disk.
Uses C's <stdio.h>.

Open( name :String; canWrite, overwrite :Boolean )

name      the path of a file to open or create
canWrite      true: open or create a file with read-write permissions
false: open an existing file read-only
overwrite      if the file already exists, and canWrite, replace it with a new file
returns      true if successful

Opens or creates a qubtree binary file on disk.