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