32#ifndef _QORE_CLASS_FILEPOLLOPERATION_H
34#define _QORE_CLASS_FILEPOLLOPERATION_H
36#include "qore/intern/QC_SocketPollOperationBase.h"
37#include "qore/intern/qore_qf_private.h"
38#include "qore/QoreFile.h"
43constexpr int FPS_NONE = 0;
44constexpr int FPS_READING = 1;
45constexpr int FPS_READ_DONE = 2;
47class FileReadPollOperationBase :
public SocketPollOperationBase {
49 DLLLOCAL FileReadPollOperationBase(File* file,
bool to_string) : file(file), to_string(to_string) {
56 file->priv->clearNonBlock(xsink);
63 DLLLOCAL
virtual bool goalReached()
const {
64 return state == FPS_READ_DONE;
67 DLLLOCAL
virtual const char* getStateImpl()
const {
69 case FPS_NONE:
return "none";
70 case FPS_READING:
return "reading";
71 case FPS_READ_DONE:
return "read-done";
77 DLLLOCAL
virtual QoreValue getOutput()
const {
90 std::unique_ptr<AbstractPollState> poll_state;
94 bool set_non_block =
false;
100class FileReadPollOperation :
public FileReadPollOperationBase {
102 DLLLOCAL FileReadPollOperation(
ExceptionSink* xsink, File* file,
const char* path, ssize_t size,
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:65
provides a safe and exception-safe way to hold locks in Qore, only to be used on the stack,...
Definition: QoreThreadLock.h:136
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:50
defines a Qore-language class
Definition: QoreClass.h:253
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:65
DLLEXPORT bool ROdereference() const
atomically decrements the reference count
manages a reference count of a pointer to a class that takes a simple "deref()" call with no argument...
Definition: ReferenceHolder.h:127
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276
DLLEXPORT QoreValue refSelf() const
references the contained value if type == QV_Node, returns itself