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 ()
: 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)
{
// mOne = other.mOne;
throw std::string ("unimplemented");
mName = other.mName;
mValue = other.mValue;
mMods = other.mMods;
}
////////////////////////////////////////////////////////////////////////////////
Att& Att::operator= (const Att& other)
{
throw std::string ("unimplemented");
if (this != &other)
{
// mOne = other.mOne;
mName = other.mName;
mValue = other.mValue;
mMods = other.mMods;
}
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
#define INCLUDED_ATT
#include <string>
#include <vector>
class Att
{
public:
Att (); // Default constructor
Att (const std::string&, const std::string&);
Att (const Att&); // Copy constructor
Att& operator= (const Att&); // Assignment operator
~Att (); // Destructor
/*
Att (name, value)
std::string name ()
std::string value ()
int value_int ()
addMod ()
bool isFilter ()
bool isRequired ()
bool isInternal ()
composeF4 ()
parse (const std::stirng&)
*/
void parse (const std::string&);
std::string composeF4 () const;
void addMod (const std::string&);
std::string name () const;
void name (const std::string&);
std::string value () const;
void value (const std::string&);
int value_int () const;
void value_int (int);
bool filter () const;
bool required () const;
bool internal () const;
private:
std::string mName;
std::string mValue;
std::vector <std::string> mMods;
};
#endif

View file

@ -35,15 +35,27 @@ Context::Context ()
////////////////////////////////////////////////////////////////////////////////
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)
{
throw std::string ("unimplemented");
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;
@ -57,15 +69,17 @@ Context::~Context ()
////////////////////////////////////////////////////////////////////////////////
void Context::initialize ()
{
// TODO Load config
// TODO Load pending.data
// TODO Load completed.data
// TODO Load deleted.data
throw std::string ("unimplemented");
// TODO Load config.
// TODO Load pending.data.
// TODO Load completed.data.
// TODO Load deleted.data.
}
////////////////////////////////////////////////////////////////////////////////
int Context::commandLine (int argc, char** argv)
{
throw std::string ("unimplemented");
// TODO Support rc: override.
return 0;
}
@ -73,6 +87,11 @@ int Context::commandLine (int argc, char** argv)
////////////////////////////////////////////////////////////////////////////////
int Context::run ()
{
throw std::string ("unimplemented");
// TODO Dispatch to command handlers.
// TODO Auto shadow update.
// TODO Auto gc.
return 0;
}

View file

@ -35,15 +35,17 @@ Date::Date ()
////////////////////////////////////////////////////////////////////////////////
Date::Date (const Date& other)
{
// mOne = other.mOne;
throw std::string ("unimplemented");
mTime = other.mTime;
}
////////////////////////////////////////////////////////////////////////////////
Date& Date::operator= (const Date& other)
{
throw std::string ("unimplemented");
if (this != &other)
{
// mOne = other.mOne;
mTime = other.mTime;
}
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
#define INCLUDED_DATE
#include <string>
#include <time.h>
class Date
{
public:
Date (); // Default constructor
Date (const Date&); // Copy constructor
Date (time_t); // Copy constructor
Date& operator= (const Date&); // Assignment operator
~Date (); // Destructor
/*
bool isDate (const std::string&)
*/
void parse (const std::string&);
private:
time_t mTime;
};
#endif

View file

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

View file

@ -27,6 +27,8 @@
#ifndef INCLUDED_DURATION
#define INCLUDED_DURATION
#include <string>
class Duration
{
public:
@ -35,11 +37,10 @@ public:
Duration& operator= (const Duration&); // Assignment operator
~Duration (); // Destructor
/*
bool isDuration (const std::string&)
*/
void parse (const std::string&);
private:
int mSeconds;
};
#endif

View file

@ -35,15 +35,17 @@ Filter::Filter ()
////////////////////////////////////////////////////////////////////////////////
Filter::Filter (const Filter& other)
{
// mOne = other.mOne;
throw std::string ("unimplemented");
mAtts = other.mAtts;
}
////////////////////////////////////////////////////////////////////////////////
Filter& Filter::operator= (const Filter& other)
{
throw std::string ("unimplemented");
if (this != &other)
{
// mOne = other.mOne;
mAtts = other.mAtts;
}
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,6 +27,10 @@
#ifndef INCLUDED_FILTER
#define INCLUDED_FILTER
#include <vector>
#include "Att.h"
#include "T.h"
class Filter
{
public:
@ -35,13 +39,11 @@ public:
Filter& operator= (const Filter&); // Assignment operator
~Filter (); // Destructor
/*
add (Att&)
bool Filter::pass (T&)
Filter::parse ()
*/
void add (Att&);
bool pass (T&);
private:
std::vector <Att> mAtts;
};
#endif

View file

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

View file

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

View file

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

View file

@ -27,6 +27,9 @@
#ifndef INCLUDED_RECORD
#define INCLUDED_RECORD
#include <vector>
#include "Att.h"
class Record
{
public:
@ -36,6 +39,7 @@ public:
~Record (); // Destructor
private:
std::vector <Att> mAtts;
};
#endif

View file

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

View file

@ -27,6 +27,9 @@
#ifndef INCLUDED_SEQUENCE
#define INCLUDED_SEQUENCE
#include <vector>
#include <string>
class Sequence
{
public:
@ -35,7 +38,10 @@ public:
Sequence& operator= (const Sequence&); // Assignment operator
~Sequence (); // Destructor
void parse (const std::string&);
private:
std::vector <int> mSequence;
};
#endif

View file

@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "T.h"
////////////////////////////////////////////////////////////////////////////////
@ -35,12 +36,20 @@ T::T ()
////////////////////////////////////////////////////////////////////////////////
T::T (const T& other)
{
throw std::string ("unimplemented");
// mOne = other.mOne;
}
////////////////////////////////////////////////////////////////////////////////
T::T (const std::string& input)
{
throw std::string ("unimplemented");
}
////////////////////////////////////////////////////////////////////////////////
T& T::operator= (const T& other)
{
throw std::string ("unimplemented");
if (this != &other)
{
// 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
#define INCLUDED_T
#include <string>
class T
{
public:
T (); // Default constructor
T (const T&); // Copy constructor
T (const std::string&); // Parse
T& operator= (const T&); // Assignment operator
~T (); // Destructor
/*
T (const std::string&);
composeF4
composeCSV
parse
*/
std::string composeF4 ();
std::string composeCSV ();
void parse (const std::string&);
private:
};

View file

@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "TDB.h"
////////////////////////////////////////////////////////////////////////////////
@ -35,15 +36,17 @@ TDB::TDB ()
////////////////////////////////////////////////////////////////////////////////
TDB::TDB (const TDB& other)
{
// mOne = other.mOne;
throw std::string ("unimplemented");
mLocations = other.mLocations;
}
////////////////////////////////////////////////////////////////////////////////
TDB& TDB::operator= (const TDB& other)
{
throw std::string ("unimplemented");
if (this != &other)
{
// mOne = other.mOne;
mLocations = other.mLocations;
}
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,6 +27,11 @@
#ifndef INCLUDED_TDB
#define INCLUDED_TDB
#include <vector>
#include <string>
#include "Filter.h"
#include "T.h"
class TDB
{
public:
@ -35,20 +40,15 @@ public:
TDB& operator= (const TDB&); // Assignment operator
~TDB (); // Destructor
/*
location (path to task dir)
std::vector <T> load (filter)
caches all raw, including comments
update (T& old, T& new)
commit ()
writes all, including comments
autoupgrade ()
-> FF4
*/
void location (const std::string&);
int load (std::vector <T>&, Filter&);
void update (T&, T&);
int commit ();
void upgrade ();
private:
std::vector <std::string> mLocations;
// TODO Need cache of raw file contents.
};
#endif

View file

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