From: Andrew G. <ag...@em...> - 2004-10-07 22:00:13
|
I've added Size(), TimeCreated() and TimeModified() methods to ZFileSpec, and made concomitant additions to ZFileLoc and its various concrete subclasses. I've also changed the names of some of the navigational methods on ZFileSpec, partly for aesthetics and partly to invalidate existing code because of a change in the interpretation of path parameters. Finally I've made most of the code more friendly towards C++ libraries where vector<XX>::iterator is a real type and not just a typedefed pointer. The new ZFileSpec method names are Parent, Child, Sibling and Trail. They replace GetParent, GetChild, GetSibling and GetDescendant. Parent returns the parent of the ZFileSpec, just as GetParent did. Child takes a *filename* as a parameter and returns a ZFileSpec referencing the child node with that name. This differs from GetChild, which took a ZFileTrail which generally was conversion-constructed from a passed-in string. By taking just a name you can now reference arbitrary node names, including those containing the posix file separator. Trail works like the old GetChild, in that takes a ZFileTrail. The ZFileTrail can be constructed from a string, in which case posix path notation is assumed and interpreted. It can also be constructed step by step, or by passing iterators referencing a string container, in which case there are no restrictions on the names used at each step of the trail (except for the empty string, indicating a bounce). Sibling effectively calls this->Parent().Child(const string&). If you want to walk a trail starting at the parent then you should explicitly call theFileSpec.Parent().Trail(theTrail). I've also changed the default values on the various Open and Create methods' iPreventWriters parameter. The rule now is that if you open or create with any write access then iPreventWriters by default is true. Otherwise it defaults to false. I wonder if perhaps there should not be any default values provided at all, but they remain until I hear a good argument for losing them. A+ -- Andrew Green mailto:ag...@em... Electric Magic Co. vox: +1 (831) 621 1822 |