}
-struct CompareCallbackImpl : public CompareCallback
-{
- void start() { cout << _("comparing snapshots...") << flush; }
- void stop() { cout << " " << _("done") << endl; }
-};
-
-CompareCallbackImpl compare_callback_impl;
-
-
-struct UndoCallbackImpl : public UndoCallback
-{
- void start() { cout << _("undoing change...") << endl; }
- void stop() { cout << _("undoing change done") << endl; }
-
- void createInfo(const string& name)
- { if (verbose) cout << sformat(_("creating %s"), name.c_str()) << endl; }
- void modifyInfo(const string& name)
- { if (verbose) cout << sformat(_("modifying %s"), name.c_str()) << endl; }
- void deleteInfo(const string& name)
- { if (verbose) cout << sformat(_("deleting %s"), name.c_str()) << endl; }
-
- void createError(const string& name)
- { cerr << sformat(_("failed to create %s"), name.c_str()) << endl; }
- void modifyError(const string& name)
- { cerr << sformat(_("failed to modify %s"), name.c_str()) << endl; }
- void deleteError(const string& name)
- { cerr << sformat(_("failed to delete %s"), name.c_str()) << endl; }
-};
-
-UndoCallbackImpl undo_callback_impl;
-
-
int
main(int argc, char** argv)
{
public:
MessageMethodCall(const char* service, const char* object, const char* interface,
- const char* method)
+ const char* method)
: Message(dbus_message_new_method_call(service, object, interface, method))
{
}
comparison->getSnapshot2()->getNum());
if (getSnapper()->getCompareCallback())
- getSnapper()->getCompareCallback()->start();
+ getSnapper()->getCompareCallback()->start(comparison);
if (!comparison->getSnapshot1()->isCurrent())
comparison->getSnapshot1()->mountFilesystemSnapshot();
sort(entries.begin(), entries.end());
if (getSnapper()->getCompareCallback())
- getSnapper()->getCompareCallback()->stop();
+ getSnapper()->getCompareCallback()->stop(comparison);
y2mil("found " << entries.size() << " lines");
}
{
switch (getAction())
{
- case CREATE: getSnapper()->getUndoCallback()->createInfo(name); break;
- case MODIFY: getSnapper()->getUndoCallback()->modifyInfo(name); break;
- case DELETE: getSnapper()->getUndoCallback()->deleteInfo(name); break;
+ case CREATE: getSnapper()->getUndoCallback()->createInfo(comparison, name); break;
+ case MODIFY: getSnapper()->getUndoCallback()->modifyInfo(comparison, name); break;
+ case DELETE: getSnapper()->getUndoCallback()->deleteInfo(comparison, name); break;
}
}
{
switch (getAction())
{
- case CREATE: getSnapper()->getUndoCallback()->createError(name); break;
- case MODIFY: getSnapper()->getUndoCallback()->modifyError(name); break;
- case DELETE: getSnapper()->getUndoCallback()->deleteError(name); break;
+ case CREATE: getSnapper()->getUndoCallback()->createError(comparison, name); break;
+ case MODIFY: getSnapper()->getUndoCallback()->modifyError(comparison, name); break;
+ case DELETE: getSnapper()->getUndoCallback()->deleteError(comparison, name); break;
}
}
class SysconfigFile;
class Filesystem;
+ class Comparison;
struct CompareCallback
CompareCallback() {}
virtual ~CompareCallback() {}
- virtual void start() = 0;
- virtual void stop() = 0;
+ virtual void start(const Comparison* comparison) = 0;
+ virtual void stop(const Comparison* comparison) = 0;
};
virtual void start() = 0;
virtual void stop() = 0;
- virtual void createInfo(const string& name) = 0;
- virtual void modifyInfo(const string& name) = 0;
- virtual void deleteInfo(const string& name) = 0;
+ virtual void createInfo(const Comparison* comparison, const string& name) = 0;
+ virtual void modifyInfo(const Comparison* comparison, const string& name) = 0;
+ virtual void deleteInfo(const Comparison* comparison, const string& name) = 0;
- virtual void createError(const string& name) = 0;
- virtual void modifyError(const string& name) = 0;
- virtual void deleteError(const string& name) = 0;
+ virtual void createError(const Comparison* comparison, const string& name) = 0;
+ virtual void modifyError(const Comparison* comparison, const string& name) = 0;
+ virtual void deleteError(const Comparison* comparison, const string& name) = 0;
};
struct CompareCallbackImpl : public CompareCallback
{
- void start() { cout << "comparing snapshots..." << flush; }
- void stop() { cout << " done" << endl; }
+ void start(const Comparison* comparison) { cout << "comparing snapshots..." << flush; }
+ void stop(const Comparison* comparison) { cout << " done" << endl; }
};
CompareCallbackImpl compare_callback_impl;
void start() { cout << "undoing..." << endl; }
void stop() { cout << "undoing done" << endl; }
- void createInfo(const string& name) { cout << "creating " << name << endl; }
- void modifyInfo(const string& name) { cout << "modifying " << name << endl; }
- void deleteInfo(const string& name) { cout << "deleting " << name << endl; }
-
- void createError(const string& name) { cout << "failed to create " << name << endl; numCreateErrors++; }
- void modifyError(const string& name) { cout << "failed to modify " << name << endl; numModifyErrors++; }
- void deleteError(const string& name) { cout << "failed to delete " << name << endl; numDeleteErrors++; }
+ void createInfo(const Comparison* comparison, const string& name)
+ { cout << "creating " << name << endl; }
+ void modifyInfo(const Comparison* comparison, const string& name)
+ { cout << "modifying " << name << endl; }
+ void deleteInfo(const Comparison* comparison, const string& name)
+ { cout << "deleting " << name << endl; }
+
+ void createError(const Comparison* comparison, const string& name)
+ { cout << "failed to create " << name << endl; numCreateErrors++; }
+ void modifyError(const Comparison* comparison, const string& name)
+ { cout << "failed to modify " << name << endl; numModifyErrors++; }
+ void deleteError(const Comparison* comparison, const string& name)
+ { cout << "failed to delete " << name << endl; numDeleteErrors++; }
};
UndoCallbackImpl undo_callback_impl;