Code Cleanup

- Integrated Context.config.
- Eliminated Config& as a function argument.
- Added extern references to Context where needed.
This commit is contained in:
Paul Beckingham 2009-06-03 02:03:49 -04:00
parent 98978c7c00
commit 66bd5fc3c0
29 changed files with 1115 additions and 451 deletions

View file

@ -5,7 +5,7 @@ LFLAGS = -L/usr/local/lib
OBJECTS = ../TDB.o ../TDB2.o ../T.o ../T2.o ../parse.o ../text.o ../Date.o \
../Duration.o ../util.o ../Config.o ../Sequence.o ../Att.o \
../Record.o ../Mod.o ../StringTable.o ../Subst.o ../Nibbler.o \
../Filter.o ../Location.o
../Filter.o ../Location.o ../Context.o ../Keymap.o
all: $(PROJECT)

View file

@ -24,9 +24,12 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <Context.h>
#include <Att.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -29,6 +29,8 @@
#include <util.h>
#include <task.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -25,9 +25,12 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <Context.h>
#include <Date.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -25,9 +25,12 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <Context.h>
#include <Duration.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
// daily, day, Nd
// weekly, 1w, sennight, biweekly, fortnight

View file

@ -24,9 +24,12 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <Context.h>
#include <Mod.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -24,9 +24,12 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <Context.h>
#include <Nibbler.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -29,6 +29,8 @@
#include "text.h"
#include "test.h"
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
@ -37,13 +39,12 @@ int main (int argc, char** argv)
std::vector <std::string> args;
std::string command;
Config conf;
conf.set ("dateformat", "m/d/Y");
context.config.set ("dateformat", "m/d/Y");
{
T task;
split (args, "add foo", ' ');
parse (args, command, task, conf);
parse (args, command, task);
t.is (command, "add", "(1) command found");
t.is (task.getId (), 0, "(1) zero id on add");
t.is (task.getDescription (), "foo", "(1) correct description");
@ -52,7 +53,7 @@ int main (int argc, char** argv)
{
T task;
split (args, "delete 1,3-5,7", ' ');
parse (args, command, task, conf);
parse (args, command, task);
std::vector <int> sequence = task.getAllIds ();
t.is (sequence.size (), (size_t)5, "(2) sequence length");
if (sequence.size () == 5)
@ -76,7 +77,7 @@ int main (int argc, char** argv)
{
T task;
split (args, "delete 1,2 3,4", ' ');
parse (args, command, task, conf);
parse (args, command, task);
std::vector <int> sequence = task.getAllIds ();
t.is (sequence.size (), (size_t)4, "(3) sequence length");
if (sequence.size () == 4)
@ -98,7 +99,7 @@ int main (int argc, char** argv)
{
T task;
split (args, "1 There are 7 days in a week", ' ');
parse (args, command, task, conf);
parse (args, command, task);
std::vector <int> sequence = task.getAllIds ();
t.is (sequence.size (), (size_t)1, "(4) sequence length");
if (sequence.size () == 1)
@ -116,7 +117,7 @@ int main (int argc, char** argv)
args.clear ();
args.push_back ("1");
args.push_back ("4-123 is back-ordered");
parse (args, command, task, conf);
parse (args, command, task);
std::vector <int> sequence = task.getAllIds ();
t.is (sequence.size (), (size_t)1, "(5) sequence length");
if (sequence.size () == 1)

View file

@ -25,10 +25,13 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <Context.h>
#include <Att.h>
#include <Record.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -25,9 +25,12 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <Context.h>
#include <Sequence.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
Sequence parseSequence (const std::string& input)
{

View file

@ -25,10 +25,13 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <unistd.h>
#include <Context.h>
#include <StringTable.h>
#include <util.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -24,10 +24,13 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <Context.h>
#include <T2.h>
#include <Subst.h>
#include <test.h>
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -29,6 +29,8 @@
#include "task.h"
#include "test.h"
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -29,6 +29,8 @@
#include "task.h"
#include "test.h"
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -31,6 +31,8 @@
#include "task.h"
#include "test.h"
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{

View file

@ -29,6 +29,8 @@
#include "text.h"
#include "test.h"
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{