diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-12-18 23:41:54 -0800 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-12-18 23:41:54 -0800 |
commit | aec952125146ef754b755f75bf9281d16e837155 (patch) | |
tree | f9632a7fc772044142a589ac6bd41584be830bb2 /includes/Handle.h | |
parent | b2f3f5217a0e9833479367bc3ebbb7926819b71b (diff) |
Visual Studio port.
Diffstat (limited to 'includes/Handle.h')
-rw-r--r-- | includes/Handle.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/includes/Handle.h b/includes/Handle.h index 15415a6..941748e 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -30,6 +30,12 @@ class BaseEvent; }; +#ifdef _MSC_VER +#define WARN_UNUSED_RESULT +#else +#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#endif + class Handle { public: virtual ~Handle() { AAssert(m_refCount == 0, "Do not use handles directly; warp them in IO<>"); } @@ -44,8 +50,8 @@ class Handle { virtual bool canSeek(); virtual bool canRead(); virtual bool canWrite(); - virtual ssize_t read(void * buf, size_t count) throw (GeneralException) __attribute__((warn_unused_result)); - virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) __attribute__((warn_unused_result)); + virtual ssize_t read(void * buf, size_t count) throw (GeneralException) WARN_UNUSED_RESULT; + virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) WARN_UNUSED_RESULT; virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); virtual off_t rtell() throw (GeneralException); @@ -77,11 +83,11 @@ class Handle { // these need to be changed into Future<>s template <size_t L> - ssize_t writeString(const char (&str)[L]) __attribute__((warn_unused_result)); - ssize_t writeString(const String & str) __attribute__((warn_unused_result)) { return forceWrite(str.to_charp(), str.strlen()); } - ssize_t writeString(const char * str, ssize_t len) __attribute__((warn_unused_result)) { return forceWrite(str, len); } - ssize_t forceRead(void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) __attribute__((warn_unused_result)); - ssize_t forceWrite(const void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) __attribute__((warn_unused_result)); + ssize_t writeString(const char (&str)[L]) WARN_UNUSED_RESULT; + ssize_t writeString(const String & str) WARN_UNUSED_RESULT { return forceWrite(str.to_charp(), str.strlen()); } + ssize_t writeString(const char * str, ssize_t len) WARN_UNUSED_RESULT { return forceWrite(str, len); } + ssize_t forceRead(void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) WARN_UNUSED_RESULT; + ssize_t forceWrite(const void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) WARN_UNUSED_RESULT; protected: Handle() : m_refCount(0) { } |