#define STRING_SPECIAL_PHRASES ("SpecialPhrases")
#define STRING_BOPOMOFO_KEYBOARD_MAPPING ("BopomofoKeyboardMapping")
-PinyinConfig * PinyinConfig::m_instance = NULL;
-BopomofoConfig * BopomofoConfig::m_instance = NULL;
+boost::scoped_ptr<PinyinConfig> PinyinConfig::m_instance;
+boost::scoped_ptr<BopomofoConfig> BopomofoConfig::m_instance;
Config::Config (Bus & bus, const std::string & name)
: Object (ibus_bus_get_config (bus)),
PinyinConfig::init (Bus & bus)
{
if (PinyinConfig::m_instance == NULL) {
- PinyinConfig::m_instance = new PinyinConfig (bus);
+ PinyinConfig::m_instance.reset (new PinyinConfig (bus));
}
}
BopomofoConfig::init (Bus & bus)
{
if (BopomofoConfig::m_instance == NULL) {
- BopomofoConfig::m_instance = new BopomofoConfig (bus);
+ BopomofoConfig::m_instance.reset (new BopomofoConfig (bus));
}
}
#define __PY_CONFIG_H_
#include <string>
+#include <boost/scoped_ptr.hpp>
#include <glib.h>
#include <glib-object.h>
#include <ibus.h>
PinyinConfig (Bus & bus, const std::string & name = "Pinyin") : Config (bus, name) { }
private:
- static PinyinConfig * m_instance;
+ static boost::scoped_ptr<PinyinConfig> m_instance;
};
/* Bopomof Config */
BopomofoConfig (Bus & bus) : PinyinConfig (bus, "Bopomofo") { }
private:
- static BopomofoConfig * m_instance;
+ static boost::scoped_ptr<BopomofoConfig> m_instance;
};
};