1 #include "unifilesystemgen.h" 4 #include "wvfileutils.h" 6 #include "wvlinkerhack.h" 23 UniFileSystemGen::UniFileSystemGen(
WvStringParm _dir, mode_t _mode)
24 : dir(_dir), mode(_mode)
32 for (i.rewind(); i.next(); )
34 if (*i ==
"." || *i ==
".." || *i ==
"")
54 WvFile file(path, O_RDONLY);
59 if (fstat(file.
getrfd(), &st) < 0)
62 if (S_ISREG(st.st_mode))
91 WvFile file(path, O_WRONLY|O_CREAT|O_TRUNC, mode & 0666);
113 : gen(_gen), i(path,
false), rel(_rel)
126 {
return i->relname; }
129 {
return gen->
get(
WvString(
"%s/%s", rel, i->relname)); }
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
The basic interface which is included by all other XPLC interfaces and objects.
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
An abstract data container that backs a UniConf tree.
bool isnull() const
returns true if this string is null
virtual int geterr() const
If isok() is false, return the system error number corresponding to the error, -1 for a special error...
bool next()
Seeks to the next element in the sequence.
WvFile implements a stream connected to a file or Unix device.
An abstract iterator over keys and values in a generator.
virtual size_t write(const void *buf, size_t count)
Write data to the stream.
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
void rewind()
Rewinds the iterator.
A type-safe version of WvMonikerBase that lets you provide create functions for object types other th...
Creates a UniConf tree that mirrors some point in the Linux filesystem, with restrictions.
UniConfKey key() const
Returns the current key.
virtual bool isok() const
return true if the stream is actually usable right now
virtual void setv(const UniConfPairList &pairs)
Stores multiple key-value pairs into the registry.
UniConfKey removelast(int n=1) const
Returns the path formed by removing the last n segments of this path.
int getrfd() const
Returns the Unix file descriptor for reading from this stream.
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
WvString is an implementation of a simple and efficient printable-string class.
An iterator over the segments of a key.
virtual size_t read(void *buf, size_t count)
read a data block on the stream.
WvString getstr()
Returns the entire buffer as a null-terminated WvString.
WvString value() const
Returns the value of the current key.