Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <qt_gui_cpp/settings.h>
00034
00035 #include <stdexcept>
00036
00037 namespace qt_gui_cpp {
00038
00039 Settings::Settings(QObject* obj)
00040 : proxy_(obj)
00041 {}
00042
00043 Settings Settings::getSettings(const QString& prefix)
00044 {
00045 Settings settings(proxy_.proxiedObject());
00046 bool rc = proxy_.invokeMethodWithReturn("get_settings", Q_RETURN_ARG(Settings, settings), Q_ARG(QString, prefix));
00047 if (!rc) throw std::runtime_error("Settings::get_settings() invoke method failed");
00048 return settings;
00049 }
00050
00051 QStringList Settings::allKeys() const
00052 {
00053 QStringList list;
00054 bool rc = const_cast<Settings*>(this)->proxy_.invokeMethodWithReturn("all_keys", Q_RETURN_ARG(QStringList, list));
00055 if (!rc) throw std::runtime_error("Settings::all_keys() invoke method failed");
00056 return list;
00057 }
00058
00059 QStringList Settings::childGroups() const
00060 {
00061 QStringList list;
00062 bool rc = const_cast<Settings*>(this)->proxy_.invokeMethodWithReturn("child_groups", Q_RETURN_ARG(QStringList, list));
00063 if (!rc) throw std::runtime_error("Settings::child_groups() invoke method failed");
00064 return list;
00065 }
00066
00067 QStringList Settings::childKeys() const
00068 {
00069 QStringList list;
00070 bool rc = const_cast<Settings*>(this)->proxy_.invokeMethodWithReturn("child_keys", Q_RETURN_ARG(QStringList, list));
00071 if (!rc) throw std::runtime_error("Settings::child_keys() invoke method failed");
00072 return list;
00073 }
00074
00075 bool Settings::contains(const QString& key) const
00076 {
00077 bool flag = false;
00078 bool rc = const_cast<Settings*>(this)->proxy_.invokeMethodWithReturn("contains", Q_RETURN_ARG(bool, flag), Q_ARG(QString, key));
00079 if (!rc) throw std::runtime_error("Settings::contains() invoke method failed");
00080 return flag;
00081 }
00082
00083 void Settings::remove(const QString& key)
00084 {
00085 bool rc = proxy_.invokeMethod("remove", Q_ARG(QString, key));
00086 if (!rc) throw std::runtime_error("Settings::remove() invoke method failed");
00087 }
00088
00089 void Settings::setValue(const QString& key, const QVariant& value)
00090 {
00091 bool rc = proxy_.invokeMethod("set_value", Q_ARG(QString, key), Q_ARG(QVariant, value));
00092 if (!rc) throw std::runtime_error("Settings::set_value() invoke method failed");
00093 }
00094
00095 QVariant Settings::value(const QString& key, const QVariant& defaultValue) const
00096 {
00097 QVariant val;
00098 bool rc = const_cast<Settings*>(this)->proxy_.invokeMethodWithReturn("value", Q_RETURN_ARG(QVariant, val), Q_ARG(QString, key), Q_ARG(QVariant, defaultValue));
00099 if (!rc) throw std::runtime_error("Settings::value() invoke method failed");
00100 return val;
00101 }
00102
00103 }