aboutsummaryrefslogtreecommitdiffstats
path: root/src/libgamma-error.hh
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-03 06:44:56 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-03 06:44:56 +0200
commit95e1c55437699aee29235e5ba2c919adbf51145e (patch)
tree70ad905a8f3e9544b8c41380eea404d3231f2e41 /src/libgamma-error.hh
parenttest libgamma::method_capabilities (diff)
downloadlibgammamm-95e1c55437699aee29235e5ba2c919adbf51145e.tar.gz
libgammamm-95e1c55437699aee29235e5ba2c919adbf51145e.tar.bz2
libgammamm-95e1c55437699aee29235e5ba2c919adbf51145e.tar.xz
libgamma_group_gid and libgamma_group_name
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libgamma-error.hh')
-rw-r--r--src/libgamma-error.hh72
1 files changed, 70 insertions, 2 deletions
diff --git a/src/libgamma-error.hh b/src/libgamma-error.hh
index a30b2c7..5fe1cbc 100644
--- a/src/libgamma-error.hh
+++ b/src/libgamma-error.hh
@@ -24,9 +24,29 @@
#include "libgamma-native.hh"
+
+#ifndef __WIN32__
+# define libgamma_gid_t gid_t
+#else
+# define libgamma_gid_t short
+#endif
+
+
+
namespace libgamma
{
/**
+ * Class for `group_gid`.
+ */
+ class GroupGid;
+
+ /**
+ * Class for `group_name`.
+ */
+ class GroupName;
+
+
+ /**
* Prints an error to stderr in a `perror` fashion,
* however this function will not translate the `libgamma`
* errors into human-readable strings, it will simply
@@ -64,8 +84,56 @@ namespace libgamma
int value_of_error(const std::string* name);
- /* TODO libgamma_group_gid */
- /* TODO libgamma_group_name */
+ /**
+ * Class for `group_gid`.
+ */
+ class GroupGid
+ {
+ public:
+ const GroupGid& operator =(const libgamma_gid_t& value) const
+ {
+ libgamma_group_gid = value;
+ return *this;
+ }
+
+ operator libgamma_gid_t() const
+ {
+ return libgamma_group_gid;
+ }
+ };
+
+ /**
+ * Group that the user needs to be a member of if
+ * `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned.
+ */
+ extern GroupGid group_gid;
+
+
+ /**
+ * Class for `group_name`.
+ */
+ class GroupName
+ {
+ public:
+ const GroupName& operator =(const char* value) const
+ {
+ libgamma_group_name = value;
+ return *this;
+ }
+
+ operator char*() const
+ {
+ return (char*)libgamma_group_name;
+ }
+ };
+
+ /**
+ * Group that the user needs to be a member of if
+ * `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned,
+ * `nullptr` if the name of the group
+ * `libgamma::group_gid` cannot be determined.
+ */
+ extern GroupName group_name;
}