Commit 3ebe99a6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f89760d1
......@@ -24,11 +24,13 @@
# XXX doc
from libcpp cimport nullptr_t, nullptr as nil
from libcpp.string cimport string
cdef extern from *:
ctypedef bint cbool "bool"
cdef extern from "wcfs_misc.h" nogil:
cppclass error:
string Error() const
cbool operator==(nullptr_t) const
cbool operator!=(nullptr_t) const
cbool operator==(const error&) const
......@@ -48,7 +50,7 @@ cdef class PyWatchLink:
with nogil:
err = wlink_close_pyexc(pywlink.wlink)
if err != nil:
raise RuntimeError(err) # XXX exc class?
raise RuntimeError(err.Error()) # XXX exc class?
......
......@@ -50,15 +50,18 @@ using std::vector;
const nullptr_t nil = nullptr;
// error mimics error from Go.
struct error {
string err; // XXX -> private + ,error() ?
class error {
string _err;
public:
string Error() const;
error() {}
error(nullptr_t) {} // = nil
// == nil
bool operator==(nullptr_t) const {
return err.empty();
return _err.empty();
}
bool operator!=(nullptr_t) const {
return !(*this==NULL);
......@@ -66,7 +69,7 @@ struct error {
// == error
bool operator==(const error &rhs) const {
return (err == rhs.err);
return (_err == rhs._err);
}
bool operator!=(const error &rhs) const {
return !(*this==rhs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment