Nebula
Loading...
Searching...
No Matches
application.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/singleton.h"
14
15//------------------------------------------------------------------------------
16namespace App
17{
19{
21public:
25 virtual ~Application();
27 void SetCompanyName(const Util::String& n);
29 const Util::String& GetCompanyName() const;
31 void SetAppTitle(const Util::String& n);
33 const Util::String& GetAppTitle() const;
35 void SetAppID(const Util::String& n);
37 const Util::String& GetAppID() const;
39 void SetAppVersion(const Util::String& n);
41 const Util::String& GetAppVersion() const;
47 virtual bool Open();
49 virtual void Close();
51 virtual void Exit();
53 virtual void Run();
55 bool IsOpen() const;
57 int GetReturnCode() const;
58
59protected:
61 void SetReturnCode(int c);
62
68 bool isOpen;
70};
71
72//------------------------------------------------------------------------------
75inline
76bool
78{
79 return this->isOpen;
80}
81
82//------------------------------------------------------------------------------
85inline
86void
91
92//------------------------------------------------------------------------------
95inline
96const Util::String&
98{
99 return this->companyName;
100}
101
102//------------------------------------------------------------------------------
105inline
106void
108{
109 this->appName = n;
110}
111
112//------------------------------------------------------------------------------
115inline
116const Util::String&
118{
119 return this->appName;
120}
121
122//------------------------------------------------------------------------------
125inline
126void
128{
129 this->appID = n;
130}
131
132//------------------------------------------------------------------------------
135inline
136const Util::String&
138{
139 return this->appID;
140}
141
142//------------------------------------------------------------------------------
145inline
146void
148{
149 this->appVersion = n;
150}
151
152//------------------------------------------------------------------------------
155inline
156const Util::String&
158{
159 return this->appVersion;
160}
161
162//------------------------------------------------------------------------------
165inline
166void
168{
169 this->args = a;
170}
171
172//------------------------------------------------------------------------------
175inline
178{
179 return this->args;
180}
181
182//------------------------------------------------------------------------------
185inline void
187{
188 this->returnCode = c;
189}
190
191//------------------------------------------------------------------------------
194inline int
196{
197 return this->returnCode;
198}
199
200} // namespace App
201//------------------------------------------------------------------------------
Provides a simple application model for Nebula apps.
Definition application.h:19
Util::String companyName
Definition application.h:63
void SetAppTitle(const Util::String &n)
set application name
Definition application.h:107
Util::String appName
Definition application.h:64
Util::String appVersion
Definition application.h:66
const Util::String & GetAppID() const
get application id
Definition application.h:137
void SetCompanyName(const Util::String &n)
set company name
Definition application.h:87
void SetAppID(const Util::String &n)
set application id
Definition application.h:127
bool isOpen
Definition application.h:68
__DeclareSingleton(Application)
Application()
constructor
Definition application.cc:17
void SetCmdLineArgs(const Util::CommandLineArgs &a)
set command line args
Definition application.h:167
virtual bool Open()
open the application
Definition application.cc:41
const Util::String & GetCompanyName() const
get company name
Definition application.h:97
void SetReturnCode(int c)
set return code
Definition application.h:186
int GetReturnCode() const
get the return code
Definition application.h:195
virtual void Exit()
exit the application, call right before leaving main()
Definition application.cc:75
virtual void Run()
run the application, return when user wants to exit
Definition application.cc:62
virtual ~Application()
destructor
Definition application.cc:32
const Util::String & GetAppTitle() const
get application name
Definition application.h:117
const Util::String & GetAppVersion() const
get application version
Definition application.h:157
int returnCode
Definition application.h:69
virtual void Close()
close the application
Definition application.cc:52
bool IsOpen() const
return true if app is open
Definition application.h:77
const Util::CommandLineArgs & GetCmdLineArgs() const
get command line args
Definition application.h:177
Util::CommandLineArgs args
Definition application.h:67
void SetAppVersion(const Util::String &n)
set application version
Definition application.h:147
Util::String appID
Definition application.h:65
A universal cmd line argument parser.
Definition commandlineargs.h:24
Definition gameapplication.cc:24
Nebula's universal string class.
Definition string.h:50