From f0b98811b30116abf0d2ecd094cde216ca56979a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 20 Apr 2016 22:32:20 +0100 Subject: Make file event handlers non-static --- gentoobrowse-api/service/maintenanceimpl.cpp | 21 +++++++++------------ gentoobrowse-api/service/maintenanceimpl.h | 5 ++++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gentoobrowse-api/service/maintenanceimpl.cpp b/gentoobrowse-api/service/maintenanceimpl.cpp index f0247c7..8592313 100644 --- a/gentoobrowse-api/service/maintenanceimpl.cpp +++ b/gentoobrowse-api/service/maintenanceimpl.cpp @@ -28,32 +28,29 @@ namespace Gentoo { { } - static void - fileDeleted(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s) + Maintenance::fileDeleted(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s) { // b.filename, b.filesize, b.filetypeid, b.moddate, b.pathparts, b.repoid - s->forEachRow([dbc](auto fn, auto, auto, auto, auto, auto) { + s->forEachRow([dbc,&tmp](auto fn, auto, auto, auto, auto, auto) { fprintf(stderr, "deleted file: %s\n", fn.c_str()); }); } - static void - fileChanged(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s) + Maintenance::fileChanged(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s) { // a.filename, a.repoid, a.filesize old_filesize, a.filetypeid old_filetypeid, a.moddate old_moddate, a.pathparts old_pathparts, b.filesize new_filesize, b.filetypeid new_filetypeid, b.moddate new_moddate, b.pathparts new_pathparts - s->forEachRow([dbc](auto fn, auto, auto, auto, auto, auto, auto, auto, auto, auto) { + s->forEachRow([dbc,&tmp](auto fn, auto, auto, auto, auto, auto, auto, auto, auto, auto) { fprintf(stderr, "updated file: %s\n", fn.c_str()); }); } - static void - fileCreated(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s) + Maintenance::fileCreated(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s) { // b.filename, b.filesize, b.filetypeid, b.moddate, b.pathparts, b.repoid - s->forEachRow([dbc](auto fn, auto, auto, auto, auto, auto) { + s->forEachRow([dbc,&tmp](auto fn, auto, auto, auto, auto, auto) { fprintf(stderr, "new file: %s\n", fn.c_str()); }); } @@ -96,9 +93,9 @@ namespace Gentoo { tp.dest = "gentoobrowse.files"; tp.pk = {"repoid", "filename"}; tp.cols = {"repoid", "filename", "filetypeid", "pathparts", "filesize", "moddate"}; - tp.beforeDelete = boost::bind(&fileDeleted, dbc, tmp, _1); - tp.beforeUpdate = boost::bind(&fileChanged, dbc, tmp, _1); - tp.beforeInsert = boost::bind(&fileCreated, dbc, tmp, _1); + tp.beforeDelete = boost::bind(&Maintenance::fileDeleted, this, dbc, tmp, _1); + tp.beforeUpdate = boost::bind(&Maintenance::fileChanged, this, dbc, tmp, _1); + tp.beforeInsert = boost::bind(&Maintenance::fileCreated, this, dbc, tmp, _1); OrderByProcessOrder obpo; tp.order = &obpo; dbc->patchTable(&tp); diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h index 19b2872..baa8783 100644 --- a/gentoobrowse-api/service/maintenanceimpl.h +++ b/gentoobrowse-api/service/maintenanceimpl.h @@ -15,7 +15,10 @@ namespace Gentoo { private: static void createTempFileList(DB::Connection *, const boost::filesystem::path &); - static void processChanges(DB::Connection *, const boost::filesystem::path &); + void processChanges(DB::Connection *, const boost::filesystem::path &); + void fileDeleted(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s); + void fileChanged(DB::Connection * dbc, const boost::filesystem::path &, DB::SelectCommandPtr s); + void fileCreated(DB::Connection * dbc, const boost::filesystem::path & tmp, DB::SelectCommandPtr s); }; } } -- cgit v1.2.3