46 , _newlineTrim(newlineTrim)
73 QString s = QString(
"%1 / %2").arg(
_data.size()).arg(
_maxSize);
143 QJsonObject o = r->
_data.object();
144 if (o.contains(
"data"))
146 QJsonValue v = o[
"data"];
150 QString data = v.toString();
152 _data += data + (data.right(1)!=
"\n"?
"\n" :
"");
159 int i =
_data.indexOf(
"\n");
191 r->
_reason =
"Bad stream data... only strings and null are allowed, and a 'data' field must exist.";
static char * get(QString which="")
Fetch an icon from the library.
VFS_node is the base class from which all other VFS_node classes derive.
virtual void metadata(VFS_request *r)
Fetch the metadata of this node.
void diff(VFS_node *origin, VFS_request *t)
Emit a diff, which will trigger notifySubscribers() for a mounted node.
The base class for all requests between nodes.
QString _reason
if something (probably bad) happened, this is the reason
bool _success
if the request was successfully completed
QJsonDocument _data
the request payload
QJsonObject _metadata
the request payload
virtual void metadata(VFS_request *r)
Fetch the metadata for this node.
bool _newlineTrim
Buffer will be truncated by bytes or newlines.
virtual void read(VFS_request *r)
Read the contents of the buffer.
virtual bool isContainer()
A VFS_stream node cannot contain children.
QString _data
The actual buffer.
Q_INVOKABLE VFS_stream(quint32 maxSize=0, bool newlineTrim=false)
virtual void applyDiff(VFS_request *r)
Apply a diff to the buffer.
virtual QByteArray icon()
The "stream" icon found in the VFS_icons library.
virtual void write(VFS_request *r)
Write to the buffer.
virtual void submit(VFS_request *r)
Submit data to the buffer.
int _maxSize
The maximum size in bytes.
virtual QString reportDetails()
Report the current stream size.