extern "C" int __cdecl _tmain( int argc, _TCHAR* argv[] );
class CConsoleApp : public CModule {
int m_ExitCode;
bool m_ShowUsage;
friend int _tmain(int argc, _TCHAR* argv[]);
void ParseCmdline();
void AddToArglist( tstring& cmdarg );
tstring::size_type
SkipWhitespace(tstring& cmdline, tstring::size_type& pos);
protected:
// Class members which user overrides
virtual bool init();
virtual void main();
virtual void deinit();
virtual void usage();
list< CCmdArg > arglist;
public:
CConsoleApp() {
m_ExitCode = 0;
m_ShowUsage = true;
}
~CConsoleApp() { }
void SetUsageFlag( bool enable ) { m_ShowUsage = enable; }
void SetExitCode( int exitcode ) { m_ExitCode = exitcode; }
bool GetSwitch( bool& flag,
const tstring& swname,
bool remove_switch );
bool TestSwitch( const tstring& swname, bool remove_switch );
bool GetOption( bool& flag,
const tstring& optname,
tstring& optval,
bool remove_option );
bool GetString( tstring& strValue, bool remove_string );
void DumpArglist( void );
};
// This inline function is defined by each application
extern CConsoleApp* GetConApp();