00001 #ifndef __Q_IBUS_TEXT_H_ 00002 #define __Q_IBUS_TEXT_H_ 00003 00004 #include "qibusserializable.h" 00005 #include "qibusattribute.h" 00006 #include "qibusattrlist.h" 00007 00008 namespace IBus { 00009 00010 class Text; 00011 typedef Pointer<Text> TextPointer; 00012 00013 class Text : public Serializable 00014 { 00015 Q_OBJECT; 00016 00017 protected: 00018 00019 public: 00020 Text () {} 00021 Text (const QString &text) : m_text (text), m_attrs(0) {} 00022 Text (const QChar &ch) : m_text (ch), m_attrs(0) {} 00023 00024 public: 00025 virtual bool serialize (QDBusArgument &argument); 00026 virtual bool deserialize (const QDBusArgument &argument); 00027 00028 const QString &text (void) const { return m_text; } 00029 const AttrListPointer &attrs (void) const { return m_attrs; } 00030 const uint getLength (void) const { return m_text.length(); } 00031 void appendAttribute (uint type, uint value, uint startIndex, int endIndex); 00032 00033 private: 00034 QString m_text; 00035 AttrListPointer m_attrs; 00036 00037 IBUS_SERIALIZABLE 00038 }; 00039 00040 }; 00041 00042 #endif