6 #ifndef _INC_cAppState_H
7 #define _INC_cAppState_H
60 return ((ch) ==
'-' || (ch) ==
'/');
63 cStringF get_ArgsStr() const noexcept;
70 ITERATE_t FindCommandArg(const
FILECHAR_t* pszCommandArg,
bool bRegex = true,
bool bIgnoreCase = true) const;
71 ITERATE_t _cdecl FindCommandArgs(
bool bIgnoreCase, const
FILECHAR_t* pszCommandArgFind, ...) const;
73 bool HasCommandArg(const
FILECHAR_t* pszCommandArg,
bool bRegex = true,
bool bIgnoreCase = true)
const
76 ITERATE_t iRet = FindCommandArg(pszCommandArg, bRegex, bIgnoreCase);
128 const cAppState*
const pApp = get_SingleU();
152 m_eAppState = eAppState;
154 void InitAppState() noexcept;
156 THREADID_t get_MainThreadId() const noexcept
159 return m_nMainThreadId;
163 static bool GRAYCALL isAppRunning();
164 static bool GRAYCALL isAppStateRun();
167 static bool GRAYCALL isDebuggerPresent();
168 static bool GRAYCALL isRemoteSession();
169 static void GRAYCALL SetExecutionState(
bool bActiveCPU,
bool bActiveGUI);
171 static bool GRAYCALL isCurrentUserAdmin();
179 return ::GetCurrentProcessId();
180 #elif defined(__linux__)
188 static HMODULE
GRAYCALL get_HModule();
190 static UINT
GRAYCALL get_LibVersion();
212 void InitArgsF(
const FILECHAR_t* pszCommandArgs);
268 static void __cdecl ExitCatchProc();
270 virtual void ExitCatch();
#define _INC_GrayCore_H
0.0.3 Version stamp the API. Especially important to the Variant and Archive types.
Definition: GrayCore.h:7
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define HRESULT_WIN32_C(x)
a constant LSTATUS/error_status_t with no check, unlike HRESULT_FROM_WIN32()
Definition: HResult.h:79
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
#define UNITTEST2_PREDEF(x)
Definition: cUnitTestDecl.h:19
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cAppState.h:42
cArrayString< FILECHAR_t > m_asArgs
Array of parsed m_sArguments. [0]=appname.exe, [1]=first arg. NOT nullptr terminated like APP_ARGS_t....
Definition: cAppState.h:51
static bool IsArgSwitch(wchar_t ch) noexcept
Definition: cAppState.h:57
Definition: cAppState.h:263
Definition: cAppImpl.h:21
Definition: cAppState.h:222
cAppState & m_AppState
Definition: cAppState.h:228
~cAppStateMain() noexcept
Definition: cAppState.h:235
Definition: cAppState.h:242
cAppStateModuleLoad()
Definition: cAppState.h:248
~cAppStateModuleLoad()
Definition: cAppState.h:254
Definition: cAppState.h:82
THREADID_t m_nMainThreadId
The thread we started with. main().
Definition: cAppState.h:104
APPSTATE_TYPE_ get_AppState() const noexcept
Definition: cAppState.h:142
APPSTATE_TYPE_ m_eAppState
The main state of the application. use isInCInit() for loading DLL's.
Definition: cAppState.h:105
static PROCESSID_t __stdcall get_CurrentProcessId()
Definition: cAppState.h:175
void put_AppState(APPSTATE_TYPE_ eAppState) noexcept
Definition: cAppState.h:148
const cObjectSignature m_Sig
Used to check for compatible build/compile config and alignments. (_INC_GrayCore_H,...
Definition: cAppState.h:97
bool m_bTempDirWritable
I have test written to the temp directory. its good.
Definition: cAppState.h:109
static HRESULT CheckValidSignature(UINT32 nGrayCoreVer, size_t nSizeofThis)
Definition: cAppState.h:120
cAppArgs m_Args
Application Command line arguments. [0] = app name.
Definition: cAppState.h:99
cStringF m_sTempDir
Cache my temporary files directory path.
Definition: cAppState.h:108
cString m_sUserName
Applications assigned login/user name. Cache/Read this just once.
Definition: cAppState.h:107
cBitmask m_ArgsValid
Track which command line args are valid/used in m_Args. assume any left over are not.
Definition: cAppState.h:100
static HMODULE sm_hInstance
the current applications HINSTANCE handle/base address. _IMAGE_DOS_HEADER, HMODULE=HINSTANCE
Definition: cAppState.h:101
cThreadLocalSysT< bool > m_ThreadModuleLoading
any thread is currently loading a DLL/SO? isInCInit(). use cAppStateModuleLoad
Definition: cAppState.h:98
bool IsValidSignature(UINT32 nVer, size_t nSizeofThis) const
Definition: cObject.h:40
Definition: cSingleton.h:30
Definition: cSingleton.h:127
static cAppState &__stdcall I()
Definition: cSingleton.h:199
TYPE GetData() const noexcept
Definition: cThreadLocalSys.h:167
bool PutData(TYPE nData) noexcept
Definition: cThreadLocalSys.h:171
Definition: cUnitTest.h:123
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
constexpr PROCESSID_t PROCESSID_BAD
Invalid process id.
Definition: cOSProcess.h:46
APPSTATE_TYPE_
Definition: cAppState.h:28
@ APPSTATE_RunInit
not static init but still init. In main() but not main loop yet. InitInstance()
Definition: cAppState.h:32
@ APPSTATE_QTY
Definition: cAppState.h:36
@ APPSTATE_Exit
static classes are being cleaned up. destructors called.
Definition: cAppState.h:35
@ APPSTATE_Run
we are in main() main loop. Run() and OnTickApp()
Definition: cAppState.h:33
@ APPSTATE_Init
static class init time. constructors called for static stuff. maybe set for single thread loading DLL...
Definition: cAppState.h:31
@ APPSTATE_RunExit
classes are being cleaned up. destructors called. Trying to exit. ExitInstance().
Definition: cAppState.h:34
int ITERATE_t
like size_t but signed
Definition: Index.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
const FILECHAR_t *const * APP_ARGS_t
the args passed to main() nullptr terminated array.
Definition: cAppState.h:39
@ APP_EXITCODE_ABORT
3=Default error returned if "abort()" used (arbitrary?) App closed.
Definition: cOSProcess.h:56
static bool IsValidApp(const void *pData) noexcept
Definition: cMem.h:42