mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Remove accidentially added files from repository
This commit is contained in:
parent
c416b48612
commit
9598f01fcf
39 changed files with 0 additions and 2517 deletions
|
@ -1,36 +0,0 @@
|
|||
#include "GranularDatetime.h"
|
||||
#include <Datetime.h>
|
||||
#include <timew.h>
|
||||
#include <format.h>
|
||||
|
||||
GranularDatetime::GranularDatetime(Rules &rules, const std::string &input, const std::string &format) : Datetime()
|
||||
{
|
||||
if (!input.empty()) {
|
||||
std::string::size_type start = 0;
|
||||
if (! parse (input, start, format))
|
||||
throw ::format ("'{1}' is not a valid date in the '{2}' format.", input, format);
|
||||
}
|
||||
|
||||
debug (::format ("Granular time, input {1}", this->toISOLocalExtended()));
|
||||
|
||||
if (rules.has("record.granularity"))
|
||||
this->correct_for_granularity(rules.getInteger("record.granularity", 0));
|
||||
|
||||
debug (::format ("Granular time, output {1}", this->toISOLocalExtended()));
|
||||
}
|
||||
|
||||
void GranularDatetime::correct_for_granularity(int granularity)
|
||||
{
|
||||
debug (::format ("Granularity set to {1}", granularity));
|
||||
|
||||
int seconds = this->second();
|
||||
int minutes = this->minute();
|
||||
|
||||
debug (::format ("Seconds {1}, minutes {2}", seconds, minutes));
|
||||
|
||||
int minute_delta = granularity == 0 ? 0 : minutes % granularity;
|
||||
|
||||
debug (::format ("Seconds {1}, minutes {2}", seconds, minutes-minute_delta));
|
||||
|
||||
this->_date -= minute_delta*60 + seconds;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef GRANULARDATETIME_H
|
||||
#define GRANULARDATETIME_H
|
||||
|
||||
#include <Rules.h>
|
||||
#include <Datetime.h>
|
||||
|
||||
class GranularDatetime : public Datetime
|
||||
{
|
||||
public:
|
||||
GranularDatetime(Rules &rules, const std::string& input = "", const std::string& format = "");
|
||||
|
||||
private:
|
||||
void correct_for_granularity(int granularity);
|
||||
};
|
||||
|
||||
#endif // GRANULARDATETIME_H
|
|
@ -1,35 +0,0 @@
|
|||
#include <LegacyRulesWrapper.h>
|
||||
|
||||
LegacyRulesWrapper::LegacyRulesWrapper(Rules &rules)
|
||||
: _rules(rules)
|
||||
{}
|
||||
|
||||
bool LegacyRulesWrapper::has (const std::string& key) const
|
||||
{
|
||||
return _rules.has(key);
|
||||
}
|
||||
|
||||
std::string LegacyRulesWrapper::get (const std::string& key) const
|
||||
{
|
||||
return _rules.get(key);
|
||||
}
|
||||
|
||||
int LegacyRulesWrapper::getInteger (const std::string& key, int defaultValue) const
|
||||
{
|
||||
return _rules.getInteger(key, defaultValue);
|
||||
}
|
||||
|
||||
double LegacyRulesWrapper::getReal (const std::string& key) const
|
||||
{
|
||||
return _rules.getReal(key);
|
||||
}
|
||||
|
||||
bool LegacyRulesWrapper::getBoolean (const std::string& key) const
|
||||
{
|
||||
return _rules.getBoolean(key);
|
||||
}
|
||||
|
||||
std::vector <std::string> LegacyRulesWrapper::all (const std::string& stem = "") const
|
||||
{
|
||||
return _rules.all(stem);
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef INCLUDED_LEGACYRULESWRAPPER
|
||||
#define INCLUDED_LEGACYRULESWRAPPER
|
||||
|
||||
#include <Rules.h>
|
||||
#include <RulesProvider.h>
|
||||
|
||||
class LegacyRulesWrapper : public RulesProvider
|
||||
{
|
||||
public:
|
||||
explicit LegacyRulesWrapper(Rules &rules);
|
||||
|
||||
bool has (const std::string&) const override;
|
||||
std::string get (const std::string&) const override;
|
||||
int getInteger (const std::string&, int defaultValue) const override;
|
||||
double getReal (const std::string&) const override;
|
||||
bool getBoolean (const std::string&) const override;
|
||||
|
||||
std::vector <std::string> all (const std::string& stem) const;
|
||||
|
||||
private:
|
||||
Rules& _rules;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef INCLUDED_RULESPROVIDER
|
||||
#define INCLUDED_RULESPROVIDER
|
||||
|
||||
class RulesProvider
|
||||
{
|
||||
public:
|
||||
virtual bool has (const std::string&) const = 0;
|
||||
virtual std::string get (const std::string&) const = 0;
|
||||
virtual int getInteger (const std::string&, int defaultValue) const = 0;
|
||||
virtual double getReal (const std::string&) const = 0;
|
||||
virtual bool getBoolean (const std::string&) const = 0;
|
||||
|
||||
virtual std::vector <std::string> all (const std::string& stem = "") const = 0;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue