FF4 - Skeleton code for 2.0

- Created new objects for the 2.0.0 code base, needed in 1.8.0.
- Sketched out basic interfaces.
This commit is contained in:
Paul Beckingham 2009-05-16 17:38:54 -04:00
parent 833fac3c13
commit 69ed1e0ebb
21 changed files with 357 additions and 79 deletions

1
src/rewrite/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
1.8

View file

@ -29,21 +29,39 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Att::Att () Att::Att ()
: mName ("")
, mValue ("")
{ {
mMods.clear ();
} }
////////////////////////////////////////////////////////////////////////////////
Att::Att (const std::string& name, const std::string& value)
{
throw std::string ("unimplemented");
mName = name;
mValue = value;
mMods.clear ();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Att::Att (const Att& other) Att::Att (const Att& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mName = other.mName;
mValue = other.mValue;
mMods = other.mMods;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Att& Att::operator= (const Att& other) Att& Att::operator= (const Att& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mName = other.mName;
mValue = other.mValue;
mMods = other.mMods;
} }
return *this; return *this;
@ -55,4 +73,82 @@ Att::~Att ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Parse the following forms:
// name [[.mod] ...] : [value]
void Att::parse (const std::string& input)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////
std::string Att::composeF4 () const
{
throw std::string ("unimplemented");
return "";
}
////////////////////////////////////////////////////////////////////////////////
void Att::addMod (const std::string&)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////
std::string Att::name () const
{
return mName;
}
////////////////////////////////////////////////////////////////////////////////
void Att::name (const std::string& name)
{
mName = name;
}
////////////////////////////////////////////////////////////////////////////////
std::string Att::value () const
{
return mValue;
}
////////////////////////////////////////////////////////////////////////////////
void Att::value (const std::string& value)
{
mValue = value;
}
////////////////////////////////////////////////////////////////////////////////
int Att::value_int () const
{
throw std::string ("unimplemented");
return 0;
}
////////////////////////////////////////////////////////////////////////////////
void Att::value_int (int)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////
bool Att::filter () const
{
throw std::string ("unimplemented");
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Att::required () const
{
throw std::string ("unimplemented");
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Att::internal () const
{
throw std::string ("unimplemented");
return false;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,28 +27,40 @@
#ifndef INCLUDED_ATT #ifndef INCLUDED_ATT
#define INCLUDED_ATT #define INCLUDED_ATT
#include <string>
#include <vector>
class Att class Att
{ {
public: public:
Att (); // Default constructor Att (); // Default constructor
Att (const Att&); // Copy constructor Att (const std::string&, const std::string&);
Att& operator= (const Att&); // Assignment operator Att (const Att&); // Copy constructor
~Att (); // Destructor Att& operator= (const Att&); // Assignment operator
~Att (); // Destructor
/* void parse (const std::string&);
Att (name, value) std::string composeF4 () const;
std::string name ()
std::string value () void addMod (const std::string&);
int value_int ()
addMod () std::string name () const;
bool isFilter () void name (const std::string&);
bool isRequired ()
bool isInternal () std::string value () const;
composeF4 () void value (const std::string&);
parse (const std::stirng&)
*/ int value_int () const;
void value_int (int);
bool filter () const;
bool required () const;
bool internal () const;
private: private:
std::string mName;
std::string mValue;
std::vector <std::string> mMods;
}; };
#endif #endif

View file

@ -35,15 +35,27 @@ Context::Context ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Context::Context (const Context& other) Context::Context (const Context& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
// config = other.config;
filter = other.filter;
keymap = other.keymap;
sequence = other.sequence;
task = other.task;
tdb = other.tdb;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Context& Context::operator= (const Context& other) Context& Context::operator= (const Context& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; // config = other.config;
filter = other.filter;
keymap = other.keymap;
sequence = other.sequence;
task = other.task;
tdb = other.tdb;
} }
return *this; return *this;
@ -57,15 +69,17 @@ Context::~Context ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Context::initialize () void Context::initialize ()
{ {
// TODO Load config throw std::string ("unimplemented");
// TODO Load pending.data // TODO Load config.
// TODO Load completed.data // TODO Load pending.data.
// TODO Load deleted.data // TODO Load completed.data.
// TODO Load deleted.data.
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int Context::commandLine (int argc, char** argv) int Context::commandLine (int argc, char** argv)
{ {
throw std::string ("unimplemented");
// TODO Support rc: override. // TODO Support rc: override.
return 0; return 0;
} }
@ -73,6 +87,11 @@ int Context::commandLine (int argc, char** argv)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int Context::run () int Context::run ()
{ {
throw std::string ("unimplemented");
// TODO Dispatch to command handlers.
// TODO Auto shadow update.
// TODO Auto gc.
return 0; return 0;
} }

View file

@ -35,15 +35,17 @@ Date::Date ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Date::Date (const Date& other) Date::Date (const Date& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mTime = other.mTime;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Date& Date::operator= (const Date& other) Date& Date::operator= (const Date& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mTime = other.mTime;
} }
return *this; return *this;
@ -55,4 +57,13 @@ Date::~Date ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// TODO Support m/d/y
// TODO Support ISO-???
// TODO Support time_t
// TODO Relative dates (today, tomorrow, yesterday, +1d, -2w, eow, eom, eoy)
void Date::parse (const std::string& input)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,19 +27,22 @@
#ifndef INCLUDED_DATE #ifndef INCLUDED_DATE
#define INCLUDED_DATE #define INCLUDED_DATE
#include <string>
#include <time.h>
class Date class Date
{ {
public: public:
Date (); // Default constructor Date (); // Default constructor
Date (const Date&); // Copy constructor Date (const Date&); // Copy constructor
Date (time_t); // Copy constructor
Date& operator= (const Date&); // Assignment operator Date& operator= (const Date&); // Assignment operator
~Date (); // Destructor ~Date (); // Destructor
/* void parse (const std::string&);
bool isDate (const std::string&)
*/
private: private:
time_t mTime;
}; };
#endif #endif

View file

@ -29,21 +29,24 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Duration::Duration () Duration::Duration ()
: mSeconds (0)
{ {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Duration::Duration (const Duration& other) Duration::Duration (const Duration& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mSeconds = other.mSeconds;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Duration& Duration::operator= (const Duration& other) Duration& Duration::operator= (const Duration& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mSeconds = other.mSeconds;
} }
return *this; return *this;
@ -55,4 +58,9 @@ Duration::~Duration ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Duration::parse (const std::string& input)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,19 +27,20 @@
#ifndef INCLUDED_DURATION #ifndef INCLUDED_DURATION
#define INCLUDED_DURATION #define INCLUDED_DURATION
#include <string>
class Duration class Duration
{ {
public: public:
Duration (); // Default constructor Duration (); // Default constructor
Duration (const Duration&); // Copy constructor Duration (const Duration&); // Copy constructor
Duration& operator= (const Duration&); // Assignment operator Duration& operator= (const Duration&); // Assignment operator
~Duration (); // Destructor ~Duration (); // Destructor
/* void parse (const std::string&);
bool isDuration (const std::string&)
*/
private: private:
int mSeconds;
}; };
#endif #endif

View file

@ -35,15 +35,17 @@ Filter::Filter ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Filter::Filter (const Filter& other) Filter::Filter (const Filter& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mAtts = other.mAtts;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Filter& Filter::operator= (const Filter& other) Filter& Filter::operator= (const Filter& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mAtts = other.mAtts;
} }
return *this; return *this;
@ -55,4 +57,17 @@ Filter::~Filter ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Filter::add (Att& att)
{
throw std::string ("unimplemented");
mAtts.push_back (att);
}
////////////////////////////////////////////////////////////////////////////////
bool Filter::pass (T&)
{
throw std::string ("unimplemented");
return false;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,21 +27,23 @@
#ifndef INCLUDED_FILTER #ifndef INCLUDED_FILTER
#define INCLUDED_FILTER #define INCLUDED_FILTER
#include <vector>
#include "Att.h"
#include "T.h"
class Filter class Filter
{ {
public: public:
Filter (); // Default constructor Filter (); // Default constructor
Filter (const Filter&); // Copy constructor Filter (const Filter&); // Copy constructor
Filter& operator= (const Filter&); // Assignment operator Filter& operator= (const Filter&); // Assignment operator
~Filter (); // Destructor ~Filter (); // Destructor
/* void add (Att&);
add (Att&) bool pass (T&);
bool Filter::pass (T&)
Filter::parse ()
*/
private: private:
std::vector <Att> mAtts;
}; };
#endif #endif

View file

@ -25,6 +25,7 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "Keymap.h" #include "Keymap.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -35,12 +36,14 @@ Keymap::Keymap ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Keymap::Keymap (const Keymap& other) Keymap::Keymap (const Keymap& other)
{ {
throw std::string ("unimplemented");
// mOne = other.mOne; // mOne = other.mOne;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Keymap& Keymap::operator= (const Keymap& other) Keymap& Keymap::operator= (const Keymap& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; // mOne = other.mOne;
@ -55,4 +58,9 @@ Keymap::~Keymap ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Keymap::load (const std::string& file)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,15 +27,24 @@
#ifndef INCLUDED_KEYMAP #ifndef INCLUDED_KEYMAP
#define INCLUDED_KEYMAP #define INCLUDED_KEYMAP
#include <string>
class Keymap class Keymap
{ {
public: public:
Keymap (); // Default constructor Keymap (); // Default constructor
Keymap (const Keymap&); // Copy constructor Keymap (const Keymap&); // Copy constructor
Keymap& operator= (const Keymap&); // Assignment operator Keymap& operator= (const Keymap&); // Assignment operator
~Keymap (); // Destructor ~Keymap (); // Destructor
void load (const std::string&); // Load the map file
/*
real (); // Convert soft to real
soft (); // Convert real to soft
*/
private: private:
// TODO Structure for mapping strings to keys.
}; };
#endif #endif

View file

@ -35,15 +35,17 @@ Record::Record ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Record::Record (const Record& other) Record::Record (const Record& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mAtts = other.mAtts;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Record& Record::operator= (const Record& other) Record& Record::operator= (const Record& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mAtts = other.mAtts;
} }
return *this; return *this;

View file

@ -27,15 +27,19 @@
#ifndef INCLUDED_RECORD #ifndef INCLUDED_RECORD
#define INCLUDED_RECORD #define INCLUDED_RECORD
#include <vector>
#include "Att.h"
class Record class Record
{ {
public: public:
Record (); // Default constructor Record (); // Default constructor
Record (const Record&); // Copy constructor Record (const Record&); // Copy constructor
Record& operator= (const Record&); // Assignment operator Record& operator= (const Record&); // Assignment operator
~Record (); // Destructor ~Record (); // Destructor
private: private:
std::vector <Att> mAtts;
}; };
#endif #endif

View file

@ -25,6 +25,7 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "Sequence.h" #include "Sequence.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -35,15 +36,17 @@ Sequence::Sequence ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Sequence::Sequence (const Sequence& other) Sequence::Sequence (const Sequence& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mSequence = other.mSequence;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Sequence& Sequence::operator= (const Sequence& other) Sequence& Sequence::operator= (const Sequence& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mSequence = other.mSequence;
} }
return *this; return *this;
@ -55,4 +58,9 @@ Sequence::~Sequence ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Sequence::parse (const std::string& input)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,15 +27,21 @@
#ifndef INCLUDED_SEQUENCE #ifndef INCLUDED_SEQUENCE
#define INCLUDED_SEQUENCE #define INCLUDED_SEQUENCE
#include <vector>
#include <string>
class Sequence class Sequence
{ {
public: public:
Sequence (); // Default constructor Sequence (); // Default constructor
Sequence (const Sequence&); // Copy constructor Sequence (const Sequence&); // Copy constructor
Sequence& operator= (const Sequence&); // Assignment operator Sequence& operator= (const Sequence&); // Assignment operator
~Sequence (); // Destructor ~Sequence (); // Destructor
void parse (const std::string&);
private: private:
std::vector <int> mSequence;
}; };
#endif #endif

View file

@ -25,6 +25,7 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "T.h" #include "T.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -35,12 +36,20 @@ T::T ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
T::T (const T& other) T::T (const T& other)
{ {
throw std::string ("unimplemented");
// mOne = other.mOne; // mOne = other.mOne;
} }
////////////////////////////////////////////////////////////////////////////////
T::T (const std::string& input)
{
throw std::string ("unimplemented");
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
T& T::operator= (const T& other) T& T::operator= (const T& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; // mOne = other.mOne;
@ -55,4 +64,23 @@ T::~T ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string T::composeF4 ()
{
throw std::string ("unimplemented");
return "";
}
////////////////////////////////////////////////////////////////////////////////
std::string T::composeCSV ()
{
throw std::string ("unimplemented");
return "";
}
////////////////////////////////////////////////////////////////////////////////
void T::parse (const std::string& input)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,20 +27,20 @@
#ifndef INCLUDED_T #ifndef INCLUDED_T
#define INCLUDED_T #define INCLUDED_T
#include <string>
class T class T
{ {
public: public:
T (); // Default constructor T (); // Default constructor
T (const T&); // Copy constructor T (const T&); // Copy constructor
T (const std::string&); // Parse
T& operator= (const T&); // Assignment operator T& operator= (const T&); // Assignment operator
~T (); // Destructor ~T (); // Destructor
/* std::string composeF4 ();
T (const std::string&); std::string composeCSV ();
composeF4 void parse (const std::string&);
composeCSV
parse
*/
private: private:
}; };

View file

@ -25,6 +25,7 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "TDB.h" #include "TDB.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -35,15 +36,17 @@ TDB::TDB ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
TDB::TDB (const TDB& other) TDB::TDB (const TDB& other)
{ {
// mOne = other.mOne; throw std::string ("unimplemented");
mLocations = other.mLocations;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
TDB& TDB::operator= (const TDB& other) TDB& TDB::operator= (const TDB& other)
{ {
throw std::string ("unimplemented");
if (this != &other) if (this != &other)
{ {
// mOne = other.mOne; mLocations = other.mLocations;
} }
return *this; return *this;
@ -55,4 +58,39 @@ TDB::~TDB ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TDB::location (const std::string& path)
{
throw std::string ("unimplemented");
mLocations.push_back (path);
}
////////////////////////////////////////////////////////////////////////////////
// TODO Returns number of filtered tasks.
int TDB::load (std::vector <T>& tasks, Filter& filter)
{
throw std::string ("unimplemented");
return 0;
}
////////////////////////////////////////////////////////////////////////////////
// TODO Write to transaction log.
void TDB::update (T& before, T& after)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////
// TODO writes all, including comments
int TDB::commit ()
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////
// TODO -> FF4
void TDB::upgrade ()
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,28 +27,28 @@
#ifndef INCLUDED_TDB #ifndef INCLUDED_TDB
#define INCLUDED_TDB #define INCLUDED_TDB
#include <vector>
#include <string>
#include "Filter.h"
#include "T.h"
class TDB class TDB
{ {
public: public:
TDB (); // Default constructor TDB (); // Default constructor
TDB (const TDB&); // Copy constructor TDB (const TDB&); // Copy constructor
TDB& operator= (const TDB&); // Assignment operator TDB& operator= (const TDB&); // Assignment operator
~TDB (); // Destructor ~TDB (); // Destructor
/* void location (const std::string&);
location (path to task dir) int load (std::vector <T>&, Filter&);
std::vector <T> load (filter) void update (T&, T&);
caches all raw, including comments int commit ();
void upgrade ();
update (T& old, T& new)
commit ()
writes all, including comments
autoupgrade ()
-> FF4
*/
private: private:
std::vector <std::string> mLocations;
// TODO Need cache of raw file contents.
}; };
#endif #endif

View file

@ -1,4 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include "Context.h" #include "Context.h"
int main (int argc, char** argv) int main (int argc, char** argv)
@ -13,6 +15,11 @@ int main (int argc, char** argv)
return 0; return 0;
} }
catch (std::string e)
{
std::cerr << e << std::endl;
}
catch (...) catch (...)
{ {
} }