Author: lslezak Date: Mon Jul 14 17:06:05 2008 New Revision: 49064 URL: http://svn.opensuse.org/viewcvs/yast?rev=49064&view=rev Log: - DBusMsg - added copy constructor and operator= Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc?rev=49064&r1=49063&r2=49064&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc (original) +++ branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc Mon Jul 14 17:06:05 2008 @@ -13,6 +13,38 @@ { } +// create a copy of the DBusMsg object +DBusMsg::DBusMsg(const DBusMsg &orig) +{ + // release the old pointer + release(); + + // store a copy of the DBusMessage pointer + msg = orig.msg; + + // increase the reference counter + y2debug("Increasing the ref counter of the DBusMessage"); + dbus_message_ref(msg); +} + +// assignment operator +DBusMsg &DBusMsg::operator=(const DBusMsg &orig) +{ + // self assignment check + if (this == &orig) return *this; + + // release the old message + release(); + + // store a copy of the DBusMessage pointer + msg = orig.msg; + + // increase the reference counter + dbus_message_ref(msg); + + return *this; +} + void DBusMsg::createCall(const std::string &service, const std::string &object, const std::string &interface, const std::string &method) { @@ -37,7 +69,8 @@ { if (msg != NULL) { - // release the message + y2debug("Decreasing DBusMessage reference counter"); + // decrease the reference counter (release the message if it's 0) dbus_message_unref(msg); } } @@ -309,7 +342,8 @@ } else { - y2error("Unsupported type: %s", val->toString().c_str()); + y2error("Unsupported type %s, value: %s", Type::vt2type(val->valuetype())->toString().c_str(), + val->toString().c_str()); return false; } @@ -590,7 +624,9 @@ + key_type.c_str() + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING).c_str(); } - y2warning("Unsupported type for value %s", val->toString().c_str()); + y2error("Unsupported type %s, value: %s", Type::vt2type(val->valuetype())->toString().c_str(), + val->toString().c_str()); + return DBUS_TYPE_INVALID_AS_STRING; } Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h?rev=49064&r1=49063&r2=49064&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h (original) +++ branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h Mon Jul 14 17:06:05 2008 @@ -20,6 +20,10 @@ DBusMsg(); ~DBusMsg(); + // copying functions + DBusMsg(const DBusMsg &); + DBusMsg &operator = (const DBusMsg &); + // create a method call void createCall(const std::string &service, const std::string &object, const std::string &interface, const std::string &method); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org