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.
34
Text (const gchar *str)
35
: Object (ibus_text_new_from_string (str)) { }
37
Text (const std::string & str)
38
: Object (ibus_text_new_from_string (str.c_str ())) { }
41
: Object (ibus_text_new_from_unichar (ch)) { }
43
void appendAttribute (guint type, guint value, guint start, guint end)
45
ibus_text_append_attribute (get<IBusText> (), type, value, start, end);
48
const gchar *text (void) const
50
return get<IBusText> ()->text;
53
operator IBusText * (void) const
55
return get<IBusText> ();
59
class StaticText : public Text {
61
StaticText (const gchar *str)
62
: Text (ibus_text_new_from_static_string (str)) { }
64
StaticText (const std::string & str)
65
: Text (ibus_text_new_from_static_string (str.c_str ())) { }
67
StaticText (gunichar ch)
70
operator IBusText * (void) const
72
return Text::operator IBusText * ();