From 7db6f68b9222c14212d5e2735a5a2d2bc679e9c3 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 17 Apr 2016 08:07:25 -0400 Subject: [PATCH] Database: Removed obsolete ::getCurrentDataFile --- src/Database.cpp | 41 ----------------------------------------- src/Database.h | 1 - 2 files changed, 42 deletions(-) diff --git a/src/Database.cpp b/src/Database.cpp index 3fff10c4..b17d9119 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -37,34 +37,12 @@ void Database::initialize (const std::string& location) { _location = location; - auto current = currentDataFile (); // Because the data files have names YYYY-MM.data, sorting them by name also // sorts by the intervals within. Directory d (_location); auto files = d.list (); std::sort (files.begin (), files.end ()); - - // Ensure the list always contains the name of the current file, even if it - // does not exist. - if (std::find (files.begin (), files.end (), current) == files.end ()) - files.push_back (current); - - for (auto& file : files) - { - // If it looks like a data file. - if (file.find (".data") == file.length () - 5) - { - Datafile df; - df.initialize (file); - - // New files need the set of current exclusions. - if (! File (file).exists ()) - df.setExclusions (_exclusions); - - _files.push_back (df); - } - } } //////////////////////////////////////////////////////////////////////////////// @@ -203,31 +181,12 @@ std::string Database::dump () const for (auto& exclusion : _exclusions) out << " Exclusion: " << exclusion << "\n"; - out << "Datafiles\n"; for (auto& df : _files) out << df.dump (); return out.str (); } -//////////////////////////////////////////////////////////////////////////////// -std::string Database::currentDataFile () const -{ - time_t current; - time (¤t); - struct tm* t = gmtime (¤t); - - std::stringstream out; - out << _location - << '/' - << std::setw (4) << std::setfill ('0') << (t->tm_year + 1900) - << '-' - << std::setw (2) << std::setfill ('0') << (t->tm_mon + 1) - << ".data"; - - return out.str (); -} - //////////////////////////////////////////////////////////////////////////////// unsigned int Database::getDatafile (int year, int month) { diff --git a/src/Database.h b/src/Database.h index 2767f9bd..a3a029a0 100644 --- a/src/Database.h +++ b/src/Database.h @@ -53,7 +53,6 @@ public: std::string dump () const; private: - std::string currentDataFile () const; unsigned int getDatafile (int, int); std::vector segmentRange (const Daterange&);