aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/errno.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsde/xsde/cxx/errno.ixx')
-rw-r--r--libxsde/xsde/cxx/errno.ixx44
1 files changed, 44 insertions, 0 deletions
diff --git a/libxsde/xsde/cxx/errno.ixx b/libxsde/xsde/cxx/errno.ixx
new file mode 100644
index 0000000..f817bbc
--- /dev/null
+++ b/libxsde/xsde/cxx/errno.ixx
@@ -0,0 +1,44 @@
+// file : xsde/cxx/errno.ixx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <xsde/cxx/config.hxx>
+
+#ifdef XSDE_PLATFORM_WINCE
+# include <winbase.h> // Get/SetLastError
+#else
+# include <errno.h>
+#endif
+
+namespace xsde
+{
+ namespace cxx
+ {
+#ifdef XSDE_PLATFORM_WINCE
+ inline int
+ get_errno ()
+ {
+ return static_cast<int> (GetLastError ());
+ }
+
+ inline void
+ set_errno (int e)
+ {
+ SetLastError (static_cast<DWORD> (e));
+ }
+#else
+ inline int
+ get_errno ()
+ {
+ return errno;
+ }
+
+ inline void
+ set_errno (int e)
+ {
+ errno = e;
+ }
+#endif
+ }
+}