Some work toward Issue 27 and Issue 319

This commit is contained in:
Nick Bolton 2010-05-31 21:30:29 +00:00
parent fea12827d4
commit f974d8d680
74 changed files with 4057 additions and 3756 deletions

View file

@ -14,6 +14,7 @@
#include "common.h"
#include "CArch.h"
#include "CLog.h"
#undef ARCH_CONSOLE
#undef ARCH_DAEMON
@ -41,6 +42,7 @@
# include "CArchSystemWindows.h"
# include "CArchTaskBarWindows.h"
# include "CArchTimeWindows.h"
# include "CArchAppUtilWindows.h"
#elif SYSAPI_UNIX
# include "CArchConsoleUnix.h"
# include "CArchDaemonUnix.h"
@ -55,6 +57,7 @@
# include "CArchSystemUnix.h"
# include "CArchTaskBarXWindows.h"
# include "CArchTimeUnix.h"
# include "CArchAppUtilUnix.h"
#endif
#if !defined(ARCH_CONSOLE)
@ -101,13 +104,17 @@
# error unsupported platform for time
#endif
#if !defined(ARCH_APPUTIL)
# error unsupported platform for app util
#endif
//
// CArch
//
CArch* CArch::s_instance = NULL;
CArch::CArch(ARCH_ARGS* args)
CArch::CArch()
{
// only once instance of CArch
assert(s_instance == NULL);
@ -122,9 +129,10 @@ CArch::CArch(ARCH_ARGS* args)
m_sleep = new ARCH_SLEEP;
m_string = new ARCH_STRING;
m_time = new ARCH_TIME;
m_console = new ARCH_CONSOLE(args);
m_console = new ARCH_CONSOLE;
m_daemon = new ARCH_DAEMON;
m_taskbar = new ARCH_TASKBAR(args);
m_taskbar = new ARCH_TASKBAR;
m_appUtil = new ARCH_APPUTIL;
#if SYSAPI_WIN32
CArchMiscWindows::init();
@ -145,6 +153,7 @@ CArch::~CArch()
delete m_file;
delete m_system;
delete m_mt;
delete m_appUtil;
// no instance
s_instance = NULL;
@ -182,12 +191,6 @@ CArch::writeConsole(const char* str)
m_console->writeConsole(str);
}
const char*
CArch::getNewlineForConsole()
{
return m_console->getNewlineForConsole();
}
void
CArch::installDaemon(const char* name,
const char* description,
@ -643,3 +646,27 @@ CArch::time()
{
return m_time->time();
}
bool
CArch::parseArg(const int& argc, const char* const* argv, int& i)
{
return m_appUtil->parseArg(argc, argv, i);
}
void
CArch::adoptApp(CApp* app)
{
m_appUtil->adoptApp(app);
}
CApp&
CArch::app() const
{
return m_appUtil->app();
}
int
CArch::run(int argc, char** argv, CreateTaskBarReceiverFunc createTaskBarReceiver)
{
return m_appUtil->run(argc, argv, createTaskBarReceiver);
}