diff options
Diffstat (limited to 'src/cc4group.h')
| -rw-r--r-- | src/cc4group.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/cc4group.h b/src/cc4group.h index c08bad8..8de4616 100644 --- a/src/cc4group.h +++ b/src/cc4group.h @@ -247,6 +247,7 @@ typedef struct { bool (*create)(CC4Group* const this); // opens a group or a normal folder on the filesystem; path may point to a directory inside a group; path "-" can be used to read the group from stdin + // if path points to a directory inside a group, saving behaves the same as for cc4group.openAsChild bool (*openExisting)(CC4Group* const this, const char* const path); // opens a group that is stored entirely in memory @@ -273,12 +274,21 @@ typedef struct { // saves the current in-memory state of the group as a compressed c4group to disk + // overwrites the group from which this instance was opened + // works only for groups opened using cc4group.openExisting (and not from stdin via "-") + bool (*save)(CC4Group* const this); + + // same as cc4group.save, but in case of a group created using cc4group.openAsChild, saves the top-most parent instead + // also applies to groups which have been opened using a path which is a subgroup of the actual group + bool (*saveParent)(CC4Group* const this); + + // saves the current in-memory state of the group as a compressed c4group to disk // fails if the given path already exists; path "-" can be used to write the group to stdout - bool (*save)(CC4Group* const this, const char* const path); + bool (*saveAs)(CC4Group* const this, const char* const path); // same as save, except that an already existing group will be overwritten // be careful, any existing file will be overwritten in-place. if any error occurs after opening the target file (e.g. out of memory, a program or system crash), the previous contents will be lost - bool (*saveOverwrite)(CC4Group* const this, const char* const path); + bool (*saveAsOverwrite)(CC4Group* const this, const char* const path); // saves the compressed group file by writing it to the file descriptor // the file descriptor must have been opened with write access and must be in blocking mode (should be default if O_NONBLOCK is not specified) @@ -415,7 +425,10 @@ typedef struct { // the returned group will share most resources with its parent (the one passed as this) // the parent may be deleted anytime, but it will stay in memory until the child is deleted as well (using reference counting) // because both share most of their data, modifications of the child will affect the parent and the opposite direction is also possible if the modifications involve the subgroup - // saving through child groups is not implemented yet, it will result in an error + // all save methods except cc4group.save and cc4group.saveParent save the child groups contents as if it didn't have a parent at all + // cc4group.save refuses to save groups from cc4group.openAsChild + // cc4group.saveParent saves the top-most parent with cc4group.save in order to save the changes in the child to disk. this will also save modifications made inside the parent group... + // ...outside of this children CC4Group* (*openAsChild)(CC4Group* const this, const char* const path); } const CC4Group_API; |
