[glibmm/glibmm-2-64] Add Glib::get_host_name()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-64] Add Glib::get_host_name()
- Date: Sun, 15 Mar 2020 14:59:21 +0000 (UTC)
commit c8d53117a388911e8e19d38500cd7c98a7013650
Author: scx <scx mail gmail com>
Date: Sun Mar 15 15:09:52 2020 +0100
Add Glib::get_host_name()
Wraps g_get_host_name() from glib.
Return a name for the machine.
Closes GNOME/glibmm#58
glib/src/miscutils.ccg | 6 ++++++
glib/src/miscutils.hg | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+)
---
diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg
index 8ebc5956..199035a6 100644
--- a/glib/src/miscutils.ccg
+++ b/glib/src/miscutils.ccg
@@ -98,6 +98,12 @@ get_real_name()
return convert_const_gchar_ptr_to_stdstring(g_get_real_name());
}
+std::string
+get_host_name()
+{
+ return convert_const_gchar_ptr_to_stdstring(g_get_host_name());
+}
+
std::string
get_home_dir()
{
diff --git a/glib/src/miscutils.hg b/glib/src/miscutils.hg
index 8d379d58..10809bde 100644
--- a/glib/src/miscutils.hg
+++ b/glib/src/miscutils.hg
@@ -174,6 +174,26 @@ std::string get_user_name();
GLIBMM_API
std::string get_real_name();
+/** Return a name for the machine.
+ *
+ * The returned name is not necessarily a fully-qualified domain name,
+ * or even present in DNS or some other name service at all. It need
+ * not even be unique on your local network or site, but usually it
+ * is. Callers should not rely on the return value having any specific
+ * properties like uniqueness for security purposes. Even if the name
+ * of the machine is changed while an application is running, the
+ * return value from this function does not change. The returned
+ * string is owned by GLib and should not be modified or freed. If no
+ * name can be determined, a default fixed string "localhost" is
+ * returned.
+ *
+ * @return The host name of the machine.
+ *
+ * @newin{2,64}
+ */
+GLIBMM_API
+std::string get_host_name();
+
/** Gets the current user's home directory.
* @return The current user's home directory or an empty string if not defined.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]