Hachoir should have three major modes:
- Read only
- Edit but don't allow to break (file) format
- Allowed to do everything
Hachoir should be able to edit a filed in a compressed stream: edit a file in a ZIP will edit parent file.
Two different approchs are currently tested:
- (a) Edit data in place
- (b) Have two classes: one contains the original datas, the other contains the 'diff' from original datas to edited datas
Approach (a) is very complex to implement because fields have to have two state: original state and new state, and it's hard to know which state is asked... It's also hard to keep data consistent.
With approach (b), read is slower, but it's easier to get original and 'current' states. It's also more natural to see/get what has changed from the original datas.
Done:
- It's possible to rewrite a file from it's fields representation: each Field class has it's writeInto() method, and OutputStream() is written