![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cAppConsole.h>
Public Member Functions | |
| virtual | ~cAppConsole () |
| bool | HasConsoleParent () noexcept |
| AppCon_TYPE | get_ConsoleMode () noexcept |
| bool | isConsoleMode () noexcept |
| bool | AttachOrAllocConsole (bool bAttachElseAlloc=true) |
| make printf() go to the console. create console if needed. More... | |
| void | ReleaseConsole () |
| HRESULT | WriteStrErr (const char *pszText) |
| HRESULT | WriteStrOut (const char *pszText) |
| HRESULT | SetKeyModes (bool bEchoMode=true, bool bEnterMode=true) |
| int | get_KeyReadQty () const |
| int | ReadKeyWait () |
| Get a single char. -1 = block/wait for char failed. More... | |
| int | ReadKey () |
| Get a single char. -1 = none avail. non blocking,. More... | |
| HRESULT | WriteString (const char *pszStr) override |
| HRESULT | WriteString (const wchar_t *pszStr) override |
| const void * | get_HeapPtr () const noexcept override |
| Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More... | |
Public Member Functions inherited from Gray::CObject | |
| virtual | ~CObject () |
| virtual bool | isValidCheck () const noexcept |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | AssertValid () const |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | Serialize (cArchive &a) |
Public Member Functions inherited from Gray::cHeapObject | |
| cHeapObject () | |
| virtual | ~cHeapObject () |
| bool | IsValidInsideN (INT_PTR index) const |
| bool | IsValidInsidePtr (void const *pTest) const |
| virtual size_t | GetHeapStatsThis (OUT ITERATE_t &iAllocCount) const |
| virtual bool | isValidCheck () const noexcept |
Public Member Functions inherited from Gray::cStreamOutput | |
| cStreamOutput () noexcept | |
| virtual | ~cStreamOutput () |
| virtual HRESULT | WriteX (const void *pData, size_t nDataSize) |
| HRESULT | WriteT (const void *pVal, size_t nDataSize) |
| template<typename TYPE > | |
| HRESULT | WriteT (TYPE val) |
| HRESULT | WriteSize (size_t nSize) |
| HRESULT | WriteHashCode (HASHCODE_t nHashCode) |
| HRESULT | WriteN (const void *pBuffer, size_t nSize) |
| template<typename _CH > | |
| HRESULT | WriteStringN (const _CH *pszStr) |
| template<typename _CH > | |
| HRESULT | WriteCharRepeat (_CH nChar, int nCount=1) |
| StrLen_t | VPrintf (const char *pszFormat, va_list args) |
| StrLen_t | VPrintf (const wchar_t *pszFormat, va_list args) |
| StrLen_t _cdecl | Printf (const char *pszFormat,...) |
| StrLen_t _cdecl | Printf (const wchar_t *pszFormat,...) |
| HRESULT | WriteStream (cStreamInput &sInp, STREAM_POS_t nSizeMax=k_FILE_BLOCK_SIZE, IStreamProgressCallback *pProgress=nullptr, TIMESYSD_t nTimeout=0) |
| Copy cStreamInput to this stream. More... | |
| virtual HRESULT | FlushX () |
Public Member Functions inherited from Gray::cStreamBase | |
| virtual | ~cStreamBase () |
| virtual STREAM_SEEKRET_t | Seek (STREAM_OFFSET_t iOffset, SEEK_ORIGIN_TYPE eSeekOrigin=SEEK_Set) |
| void | SeekToBegin () |
| STREAM_POS_t | SeekToEnd () |
| virtual STREAM_POS_t | GetPosition () const |
| virtual STREAM_POS_t | GetLength () const |
Static Public Attributes | |
| static const COUNT_t | k_MAX_CONSOLE_LINES = 500 |
| arbitrary max lines shown at once. More... | |
Static Public Attributes inherited from Gray::cSingletonRegister | |
| static cThreadLockFast | sm_LockSingle |
| common lock for all cSingleton. More... | |
Static Public Attributes inherited from Gray::cStreamBase | |
| static const BYTE | k_SIZE_MASK = 0x80 |
| Used for WriteSize() More... | |
| static const size_t | k_FILE_BLOCK_SIZE = (32 * 1024) |
| default arbitrary transfer block size. more than this is NOT more efficient. More... | |
Protected Member Functions | |
| cAppConsole () | |
| void | CheckConsoleMode () noexcept |
| bool | AttachConsoleSync () |
Protected Member Functions inherited from Gray::cSingleton< cAppConsole > | |
| cSingleton (cAppConsole *pObject, const TYPEINFO_t &rAddrCode=typeid(cAppConsole)) noexcept | |
| virtual | ~cSingleton () |
Protected Member Functions inherited from Gray::cSingletonStatic< TYPE > | |
| cSingletonStatic (TYPE *pObject) noexcept | |
| virtual | ~cSingletonStatic () noexcept |
Protected Member Functions inherited from Gray::cSingletonRegister | |
| cSingletonRegister (const TYPEINFO_t &rAddrCode) noexcept | |
| virtual | ~cSingletonRegister () |
| void | RegisterSingleton () |
Protected Member Functions inherited from Gray::cHeapObject | |
| const void * | get_HeapPtr () const noexcept override |
| Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More... | |
Friends | |
| class | cSingleton< cAppConsole > |
| class | cAppConsoleTests |
Additional Inherited Members | |
Static Public Member Functions inherited from Gray::cSingleton< cAppConsole > | |
| static cAppConsole *__stdcall | get_Single () |
| static TYPE2 *__stdcall | get_SingleT () |
| static cAppConsole &__stdcall | I () |
Static Public Member Functions inherited from Gray::cSingletonStatic< TYPE > | |
| static bool | isSingleCreated () noexcept |
| static TYPE * | get_SingleU () noexcept |
| static TYPE * | get_Single () |
| template<class TYPE2 > | |
| static TYPE2 *__stdcall | get_SingleCast () |
| static TYPE & | I () noexcept |
Static Public Member Functions inherited from Gray::cSingletonRegister | |
| static void __stdcall | ReleaseModule (HMODULE hMod) |
Protected Attributes inherited from Gray::cSingletonRegister | |
| HMODULE | m_hModuleLoaded |
| What modules loaded this ? So singletons can be destroyed if DLL/SO unloads. More... | |
Static Protected Attributes inherited from Gray::cSingletonStatic< TYPE > | |
| static TYPE * | sm_pThe = nullptr |
| pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr. More... | |
Singleton to Manage console output/input for this app. use of printf() etc This allows apps not compiled in _CONSOLE mode to attach to a console if they are started in one (or create one if not).
|
protected |
|
virtual |
|
protected |
Synchronize the C std* buffers (needs USE_CRT) with _WIN32 Console. NOTE: Not sure why this isn't just handled by AllocConsole() Similar to std::ios::sync_with_stdio()
make printf() go to the console. create console if needed.
|
protectednoexcept |
Is the process already running from a console window? _CONSOLE Was process started by a console ? e.g. Linux applications started from GNOME desktop have no console window.
|
inlinenoexcept |
|
inlineoverridevirtualnoexcept |
Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr().
Implements Gray::IHeapObject.
| int Gray::cAppConsole::get_KeyReadQty | ( | ) | const |
|
inlinenoexcept |
started from command line ? Call AllocConsole to start using console.
|
inlinenoexcept |
Is the app already running in console mode? can i use printf() ?
| int Gray::cAppConsole::ReadKey | ( | ) |
Get a single char. -1 = none avail. non blocking,.
Get ASCII_TYPE Key char produced by possibly multiple keys pressed (shift). Don't wait. similar to INPUTKEY_TYPE and VK_TYPE -> VK_ESCAPE = INPUTKEY_ESCAPE
| int Gray::cAppConsole::ReadKeyWait | ( | ) |
Get a single char. -1 = block/wait for char failed.
Read a single key from conio stdin. block/wait for char. Arrows and escape key are sometimes special purpose here.
| void Gray::cAppConsole::ReleaseConsole | ( | ) |
| HRESULT Gray::cAppConsole::WriteStrErr | ( | const char * | pszText | ) |
Does not support UNICODE ?
|
inlineoverridevirtual |
support cStreamOutput Do not assume line termination with
Reimplemented from Gray::cStreamOutput.
|
inlineoverridevirtual |
support cStreamOutput Do not assume line termination with
Reimplemented from Gray::cStreamOutput.
| HRESULT Gray::cAppConsole::WriteStrOut | ( | const char * | pszText | ) |
Write to console. Does not support UNICODE ?
|
friend |
|
friend |
|
static |
arbitrary max lines shown at once.