File indexing completed on 2026-05-10 08:42:57
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_UTILITY_IOOBJECT_H
0010 #define LLDB_UTILITY_IOOBJECT_H
0011
0012 #include <cstdarg>
0013 #include <cstdio>
0014 #include <sys/types.h>
0015
0016 #include "lldb/lldb-private.h"
0017
0018 namespace lldb_private {
0019
0020 class IOObject {
0021 public:
0022 enum FDType {
0023 eFDTypeFile,
0024 eFDTypeSocket,
0025 };
0026
0027
0028
0029 typedef int WaitableHandle;
0030 static const WaitableHandle kInvalidHandleValue;
0031
0032 IOObject(FDType type) : m_fd_type(type) {}
0033 virtual ~IOObject();
0034
0035 virtual Status Read(void *buf, size_t &num_bytes) = 0;
0036 virtual Status Write(const void *buf, size_t &num_bytes) = 0;
0037 virtual bool IsValid() const = 0;
0038 virtual Status Close() = 0;
0039
0040 FDType GetFdType() const { return m_fd_type; }
0041
0042 virtual WaitableHandle GetWaitableHandle() = 0;
0043
0044 protected:
0045 FDType m_fd_type;
0046
0047 private:
0048 IOObject(const IOObject &) = delete;
0049 const IOObject &operator=(const IOObject &) = delete;
0050 };
0051 }
0052
0053 #endif