Enhancement - Object integration

- Began the big integration festival by moving all objects out of
  the sandbox.
- Hooked up one error message to context.stringtable, just to make
  a point.
This commit is contained in:
Paul Beckingham 2009-05-31 01:49:24 -04:00
parent fe4c8f3a9d
commit 97145fbb07
11 changed files with 36 additions and 12 deletions

View file

@ -34,6 +34,13 @@
////////////////////////////////////////////////////////////////////////////////
Context::Context ()
: config ()
, filter ()
, keymap ()
, sequence ()
, task ()
, tdb ()
, stringtable ()
{
// Set up randomness.
#ifdef HAVE_SRANDOM

View file

@ -1,10 +1,11 @@
bin_PROGRAMS = task
task_SOURCES = Config.cpp Date.cpp Record.cpp T.cpp TDB.cpp Att.cpp Mod.cpp \
Filter.cpp Sequence.cpp Table.cpp Grid.cpp Timer.cpp \
Duration.cpp StringTable.cpp Location.cpp Subst.cpp Keymap.cpp \
Nibbler.cpp color.cpp parse.cpp task.cpp command.cpp edit.cpp \
report.cpp util.cpp text.cpp rules.cpp import.cpp Config.h \
Date.h Record.h T.h TDB.h Att.h Mod.h Filter.h Sequence.h \
Table.h Grid.h Timer.h Duration.h StringTable.h Location.h \
Subst.h Keymap.h Nibbler.h color.h task.h
task_SOURCES = Config.cpp Date.cpp Record.cpp T.cpp T2.cpp TDB.cpp TDB2.cpp \
Att.cpp Mod.cpp Filter.cpp Sequence.cpp Table.cpp Grid.cpp \
Timer.cpp Duration.cpp StringTable.cpp Location.cpp Subst.cpp \
Keymap.cpp Nibbler.cpp Context.cpp color.cpp parse.cpp \
task.cpp command.cpp edit.cpp report.cpp util.cpp text.cpp \
rules.cpp import.cpp Config.h Date.h Record.h T.h TDB.h Att.h \
Mod.h Filter.h Sequence.h Table.h Grid.h Timer.h Duration.h \
StringTable.h Location.h Subst.h Keymap.h Nibbler.h Context.h \
color.h task.h

View file

@ -68,6 +68,8 @@ StringTable::~StringTable ()
// ...
void StringTable::load (const std::string& file)
{
mMapping.clear (); // Allows dynamic reload.
std::ifstream in;
in.open (file.c_str (), std::ifstream::in);
if (in.good ())

View file

@ -26,6 +26,7 @@
////////////////////////////////////////////////////////////////////////////////
#include <string>
#include "Nibbler.h"
#include "T2.h"
////////////////////////////////////////////////////////////////////////////////
@ -56,6 +57,11 @@ T2::~T2 ()
{
}
////////////////////////////////////////////////////////////////////////////////
void T2::legacyParse (const std::string& input)
{
}
////////////////////////////////////////////////////////////////////////////////
// [name:value, name:"value",name:[name:value,name:value]]
std::string T2::composeF4 ()

View file

@ -38,6 +38,7 @@ public:
T2& operator= (const T2&); // Assignment operator
~T2 (); // Destructor
void legacyParse (const std::string&);
std::string composeF4 ();
std::string composeCSV ();

View file

@ -2,9 +2,10 @@ PROJECT = 1.8
CFLAGS = -I. -I.. -Wall -pedantic -ggdb3 -fno-rtti -fno-stack-check
LFLAGS =
LIBS =
OBJECTS = main.o Context.o TDB2.o T2.o ../Sequence.o ../Filter.o ../Att.o \
../Keymap.o ../Record.o ../Mod.o ../StringTable.o ../util.o \
../text.o ../Date.o ../Config.o ../Location.o ../Subst.o ../Nibbler.o
OBJECTS = main.o ../Context.o ../TDB2.o ../T2.o ../Sequence.o ../Filter.o \
../Att.o ../Keymap.o ../Record.o ../Mod.o ../StringTable.o \
../util.o ../text.o ../Date.o ../Config.o ../Location.o ../Subst.o \
../Nibbler.o
all: $(PROJECT)

View file

@ -317,8 +317,13 @@ int main (int argc, char** argv)
srand (time (NULL));
#endif
// TODO 1.8.0 requires the Context.
Context context;
try
{
context.initialize (argc, argv);
// Load the config file from the home directory. If the file cannot be
// found, offer to create a sample one.
Config conf;
@ -365,7 +370,7 @@ int main (int argc, char** argv)
catch (...)
{
std::cerr << "Unknown error." << std::endl;
std::cerr << context.stringtable.get (100, "Unknown error.") << std::endl;
return -2;
}

View file

@ -29,6 +29,7 @@
#include <vector>
#include <map>
#include <sys/types.h>
#include "Context.h"
#include "T.h"
#include "TDB.h"
#include "Config.h"