1
/* vim:set et ts=4 sts=4:
3
* ibus-pinyin - The Chinese PinYin engine for IBus
5
* Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2, or (at your option)
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
#if defined(HAVE_UUID_CREATE)
30
#elif defined(HAVE_LIBUUID)
31
# include <uuid/uuid.h>
34
#include <sys/utsname.h>
42
// mask for Ctrl, Alt, Super, Hyper, Meta
43
const guint CMSHM_MASK = IBUS_CONTROL_MASK |
48
// mask for Shift, Ctrl, Alt, Super, Hyper, Meta
49
const guint SCMSHM_MASK = CMSHM_MASK | IBUS_SHIFT_MASK;
52
cmshm_filter (guint modifiers)
54
return modifiers & CMSHM_MASK;
58
scmshm_filter (guint modifiers)
60
return modifiers & SCMSHM_MASK;
64
cmshm_test (guint modifiers, guint mask)
66
return cmshm_filter (modifiers) == mask;
70
scmshm_test (guint modifiers, guint mask)
72
return scmshm_filter (modifiers) == mask;
80
#if defined(HAVE_UUID_CREATE)
83
uuid_to_string (&u, &uuid, 0);
84
g_strlcpy (m_uuid, uuid, sizeof(m_uuid));
86
#elif defined(HAVE_LIBUUID)
88
uuid_unparse_lower (u, m_uuid);
92
operator const gchar * (void) const
108
const gchar *hostname (void) const { return m_buf.nodename; }
110
struct utsname m_buf;
113
class Hostname : public Uname {
115
operator const gchar * (void) const
121
class Env : public std::string {
123
Env (const gchar *name)
126
str = std::getenv (name);
127
assign (str != NULL ? str : "");
130
operator const gchar *(void) const