diff --git a/Source/AllProjects/CIDBuild/CIDBuild_GCCDriver.cpp b/Source/AllProjects/CIDBuild/CIDBuild_GCCDriver.cpp index 61fc5790..1a9c27b6 100644 --- a/Source/AllProjects/CIDBuild/CIDBuild_GCCDriver.cpp +++ b/Source/AllProjects/CIDBuild/CIDBuild_GCCDriver.cpp @@ -527,7 +527,7 @@ tCIDLib::TVoid TGCCDriver::Link() { do { - TBldStr* pstrNew = new TBldStr(L"-lCIDKernel"); + TBldStr* pstrNew = new TBldStr(cursLibs.tCurElement().strFileName()); listParms.Add(pstrNew); } while (cursLibs.bNext()); } diff --git a/Source/AllProjects/CIDBuild/Linux/CIDBuild_FindInfo_Linux.cpp b/Source/AllProjects/CIDBuild/Linux/CIDBuild_FindInfo_Linux.cpp index cbace09a..65b06cbb 100644 --- a/Source/AllProjects/CIDBuild/Linux/CIDBuild_FindInfo_Linux.cpp +++ b/Source/AllProjects/CIDBuild/Linux/CIDBuild_FindInfo_Linux.cpp @@ -173,4 +173,9 @@ TFindInfo::SetFromHostInfo( const tCIDLib::TVoid* const pHostFindBuf // any platform can represent its time easily in a common format. // m_tmLastWrite = double(pFileInfo->StatBuf.st_mtime); + + if (S_ISDIR(pFileInfo->StatBuf.st_mode)) + m_bIsDir = kCIDLib::True; + else + m_bIsDir = kCIDLib::False; } diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Console_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Console_Linux.cpp index 29f38477..13f9d34c 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Console_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Console_Linux.cpp @@ -578,6 +578,24 @@ TConsoleHandle::FormatToStr( tCIDLib::TCh* const pszToFill // TKrnlConIn: Public, non-virtual methods // --------------------------------------------------------------------------- +tCIDLib::TBoolean +TKrnlConIn::bReadCharMS( tCIDLib::EConKeys& eKeyType + , tCIDLib::TCh& chGotten + , const tCIDLib::TCard4 c4Wait + , TIdleCB pfnCallback + , TObject* const pobjCBData) +{ + // Just call the end time based one with the calculated end time + return bReadChar + ( + eKeyType + , chGotten + , TKrnlTimeStamp::enctNow() + (c4Wait * kCIDLib::enctOneMilliSec) + , pfnCallback + , pobjCBData + ); +} + tCIDLib::TBoolean TKrnlConIn::bReadChar( tCIDLib::EConKeys& keyType , tCIDLib::TCh& chGotten @@ -728,18 +746,28 @@ tCIDLib::TVoid TKrnlConIn::TermPlatform() // --------------------------------------------------------------------------- // TKrnlConOut: Public, non-virtual methods // --------------------------------------------------------------------------- -tCIDLib::TBoolean TKrnlConOut::bClearScr() +static inline tCIDLib::TBoolean bWriteTermCap(const tCIDLib::TSCh* pszTermCapName) { - tCIDLib::TSCh* pszClear = ::tigetstr("clear"); - if (!pszClear) + tCIDLib::TSCh* pszTermCapVal = ::tigetstr(pszTermCapName); + if (!pszTermCapVal) { TKrnlError::SetLastKrnlError(kKrnlErrs::errcData_ZeroSizedBuffer); return kCIDLib::False; } - ::tputs(pszClear, 1, putchar); + ::tputs(pszTermCapVal, 1, putchar); return kCIDLib::True; } +tCIDLib::TBoolean TKrnlConOut::bBackspace() +{ + return bWriteTermCap("cursor_left"); +} + +tCIDLib::TBoolean TKrnlConOut::bClearScr() +{ + return bWriteTermCap("clear"); +} + tCIDLib::TBoolean TKrnlConOut::bPutChar(const tCIDLib::TCh chToWrite) { tCIDLib::TSCh szMultiByte[MB_LEN_MAX]; diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Error_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Error_Linux.cpp index 960fef5d..66991a9b 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Error_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Error_Linux.cpp @@ -237,6 +237,19 @@ const TKrnlError& TKrnlError::kerrLast() } +// Load the message text for the indicated OS error code +tCIDLib::TBoolean +TKrnlError::bQuerySysErrMsg(const tCIDLib::TOSErrCode errcGet + , tCIDLib::TCh* const pszToFill + , const tCIDLib::TCard4 c4MaxChars) +{ + char schErrorNarrow[c4MaxChars] = {0}; + ::strerror_r(errcGet, schErrorNarrow, sizeof(schErrorNarrow)); + ::swprintf(pszToFill, c4MaxChars, L"%s", schErrorNarrow); + return kCIDLib::True; +} + + tCIDLib::TVoid TKrnlError::ThrowHostError(const tCIDLib::TOSErrCode errcHostId) { diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Event_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Event_Linux.cpp index 89113b1b..04638ff1 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Event_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Event_Linux.cpp @@ -118,6 +118,21 @@ TEventHandle::FormatToStr( tCIDLib::TCh* const pszToFill // PREFIX: kev // --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// TKrnlEvent: Public, static methods +// --------------------------------------------------------------------------- +tCIDLib::TBoolean +TKrnlEvent::bWaitMultiple( TKrnlEvent& kevOne + , TKrnlEvent& kevTwo + , tCIDLib::TCard4& c4Which + , const tCIDLib::TCard4 c4Wait) +{ + // + TKrnlError::SetLastKrnlError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + // --------------------------------------------------------------------------- // TKrnlEvent: Constructors and Destructor // --------------------------------------------------------------------------- @@ -346,6 +361,14 @@ tCIDLib::TBoolean TKrnlEvent::bOpen() } +tCIDLib::TBoolean TKrnlEvent::bPulse() +{ + // + TKrnlError::SetLastKrnlError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + tCIDLib::TBoolean TKrnlEvent::bReset() { if (!m_hevThis.bIsValid()) diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_ExternalProcess_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_ExternalProcess_Linux.cpp index 0e677219..82dec48d 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_ExternalProcess_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_ExternalProcess_Linux.cpp @@ -869,3 +869,36 @@ TKrnlExtProcess::bWaitForDeath( tCIDLib::TBoolean& bState } +tCIDLib::TBoolean TKrnlExtProcess::bWaitInit(const tCIDLib::TCard4 c4WaitFor) +{ + // + TKrnlError::SetLastKrnlError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + +tCIDLib::TVoid +TKrnlExtProcess::FormatAttachData( tCIDLib::TCh* const pszToFill + , const tCIDLib::TCard4 c4MaxChars) +{ + // + TKrnlError::SetLastKrnlError(kKrnlErrs::errcGen_NotSupported); +} + + +tCIDLib::TProcessId TKrnlExtProcess::pidThis() const +{ + // Get the running state. If it fails, return the invalid handle + tCIDLib::TBoolean bRun; + if (!bIsRunning(bRun)) + return kCIDLib::pidInvalid; + + // If not running, also return the invalid handle + if (!bRun) + return kCIDLib::pidInvalid; + + // Looks ok, so return the id + return m_hprocThis.m_phprociThis->pidThis; +} + + diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_FileSystem_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_FileSystem_Linux.cpp index 60c8612f..0d938935 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_FileSystem_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_FileSystem_Linux.cpp @@ -716,6 +716,135 @@ tCIDLib::TBoolean TKrnlDirSearch::bSearchIsOpen() const +// --------------------------------------------------------------------------- +// CLASS: TKrnlDirChangeInfo +// PREFIX: kdchi +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// TKrnlDirChangeInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +TKrnlDirChangeInfo::TKrnlDirChangeInfo() : + + m_eChange(tCIDLib::EDirChanges::None) +{ +} + + +// --------------------------------------------------------------------------- +// TKrnlDirChangeInfo: Public operators +// --------------------------------------------------------------------------- +TKrnlDirChangeInfo& TKrnlDirChangeInfo::operator=(const TKrnlDirChangeInfo& kdchiSrc) +{ + if (&kdchiSrc != this) + { + m_eChange = kdchiSrc.m_eChange; + m_kstrName = kdchiSrc.m_kstrName; + m_kstrNew = kdchiSrc.m_kstrNew; + } + return *this; +} + + + +// --------------------------------------------------------------------------- +// CLASS: TKrnlDirChangeMon +// PREFIX: kdchm +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// TKrnlDirChangeMon: Public data +// --------------------------------------------------------------------------- +constexpr tCIDLib::TCard4 c4DirMonBufSz = 32 * 1024; +struct TKrnlDirChangeMon::TDirChangeMonitorData +{ + int empty; // +}; + + +// --------------------------------------------------------------------------- +// TKrnlDirChangeMon: Constructors and Destructor +// --------------------------------------------------------------------------- +TKrnlDirChangeMon::TKrnlDirChangeMon() : + + m_bDoSubDirs(kCIDLib::False) + , m_eFilters(tCIDLib::EDirChFilters::None) + , m_pData(nullptr) +{ + // Allocate our internal structure + m_pData = new TDirChangeMonitorData{0}; +} + +TKrnlDirChangeMon::~TKrnlDirChangeMon() +{ + // Clean up our data if not already + if (m_pData) + { + bCleanup(); + delete m_pData; + m_pData = nullptr; + } +} + + +// --------------------------------------------------------------------------- +// TKrnlDirChangeMon: Public, non-virtual methods +// --------------------------------------------------------------------------- + +// Do a cancel on the directory handle, to break out any thread that is blocked on it +tCIDLib::TBoolean TKrnlDirChangeMon::bCancel() +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + +// Clean up anything that got created +tCIDLib::TBoolean TKrnlDirChangeMon::bCleanup() +{ + m_bDoSubDirs = kCIDLib::False; + m_eFilters = tCIDLib::EDirChFilters::None; + m_kstrTargetDir.Clear(); + return kCIDLib::True; +} + + + +// Indicate whether we currently are monitoring or not +tCIDLib::TBoolean TKrnlDirChangeMon::bIsReady() const +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + +tCIDLib::TBoolean +TKrnlDirChangeMon::bReadChanges(TChangeList& kllstToFill, tCIDLib::TCard4& c4ValidCnt) +{ + // Make sure we return zero unless proven otherwise + c4ValidCnt = 0; + + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + +tCIDLib::TBoolean +TKrnlDirChangeMon::bStartMonitor(const tCIDLib::TCh* const pszTargetDir + , const tCIDLib::EDirChFilters eFilters + , const tCIDLib::TBoolean bDoSubDirs) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + + + // --------------------------------------------------------------------------- // TKrnlFileSys functions // --------------------------------------------------------------------------- diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_File_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_File_Linux.cpp index 60043dc7..d84cab22 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_File_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_File_Linux.cpp @@ -201,6 +201,17 @@ tCIDLib::TBoolean TKrnlFile::bClose() } +tCIDLib::TBoolean TKrnlFile::bFlush() +{ + if (::fsync(m_hflThis.m_phfliThis->iFd)) + { + TKrnlError::SetLastHostError(errno); + return kCIDLib::False; + } + return kCIDLib::True; +} + + tCIDLib::TBoolean TKrnlFile::bQueryCurSize(tCIDLib::TCard8& c8ToFill) const { struct stat StatBuf; @@ -499,6 +510,20 @@ TKrnlFile::bReadBuffer( tCIDLib::TVoid* const pBuffer } +tCIDLib::TBoolean +TKrnlFile::bReadBufferTO( tCIDLib::TVoid* const pBuffer + , const tCIDLib::TCard4 c4ToRead + , tCIDLib::TCard4& c4BytesRead + , const tCIDLib::TCard4 c4MaxWait + , TKrnlEvent& kevToPost) +{ + // + c4BytesRead = 0; + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + tCIDLib::TBoolean TKrnlFile::bSetFilePointer(const tCIDLib::TCard8& c8ToSet) { // @@ -509,7 +534,7 @@ tCIDLib::TBoolean TKrnlFile::bSetFilePointer(const tCIDLib::TCard8& c8ToSet) off_t offActualPos = c8ToSet; tCIDLib::TSInt iSeekType = SEEK_SET; - if (c8ToSet == kCIDLib::c4MaxCard) + if (c8ToSet == kCIDLib::c8MaxCard) { offActualPos = 0; iSeekType = SEEK_END; @@ -629,3 +654,17 @@ TKrnlFile::bWriteBuffer(const tCIDLib::TVoid* const pBuffer return kCIDLib::True; } + + +tCIDLib::TBoolean +TKrnlFile::bWriteBufferTO( const tCIDLib::TVoid* const pBuffer + , const tCIDLib::TCard4 c4ToWrite + , tCIDLib::TCard4& c4BytesWritten + , const tCIDLib::TCard4 c4MaxWait + , TKrnlEvent& kevToPost) +{ + // + c4BytesWritten = 0; + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_InternalHelpers.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_InternalHelpers.cpp index 03969fb6..cdd13790 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_InternalHelpers.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_InternalHelpers.cpp @@ -308,7 +308,10 @@ tCIDLib::TBoolean TKrnlLinux::TThreadTimer::bTriggered() const tCIDLib::TVoid TKrnlLinux::TThreadTimer::Cancel() { - ::pthread_cancel(m_tidThis); + if (m_tidThis != kCIDLib::tidInvalid) + { + ::pthread_cancel(m_tidThis); + } } sigjmp_buf& TKrnlLinux::TThreadTimer::JumpEnvironment() const diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Module_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Module_Linux.cpp index f00e52c9..2d25e77b 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Module_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Module_Linux.cpp @@ -208,7 +208,7 @@ namespace CIDKernel_Module_Linux // a time. while (::fgets(szLine, iLineSize, Maps)) { - if (::sscanf(szLine, " %*s %*s %*s %lu:%lu %lu" + if (::sscanf(szLine, " %*s %*s %*s %lx:%lx %lu" , &c4DevMajor , &c4DevMinor , &c4Inode) != 3) @@ -843,4 +843,4 @@ TKrnlModule::MakePlatNames( const tCIDLib::TCh* const pszModName , L"Only shared lib and exes are supported for name building" ); } -} \ No newline at end of file +} diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformConstants.hpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformConstants.hpp index 59aa6995..e10397f1 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformConstants.hpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformConstants.hpp @@ -95,6 +95,16 @@ namespace kCIDLib // that we can have a slot for our own internal use. // ----------------------------------------------------------------------- constexpr tCIDLib::TCard4 c4MaxWaitHandles = 63; + + // ----------------------------------------------------------------------- + // Since we currently allow each platform to use its own wide character + // format in memory, we need to have this + // ----------------------------------------------------------------------- + #if defined(CIDLIB_LITTLEENDIAN) + constexpr tCIDLib::EBaseTextFmts eWCCharFmt = tCIDLib::EBaseTextFmts::FourByte_LE; + #else + constexpr tCIDLib::EBaseTextFmts eWCCharFmt = tCIDLib::EBaseTextFmts::FourByte_BE; + #endif } diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformDefines.hpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformDefines.hpp index c7fa544f..5f2eb00d 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformDefines.hpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformDefines.hpp @@ -73,6 +73,15 @@ #define CIDLIB_POPPACK pack(pop) +// --------------------------------------------------------------------------- +// Declare the global variables for argc and argv +// --------------------------------------------------------------------------- +namespace CIDKernel_SystemInfo_Linux +{ + extern int argc; + extern char** argv; +} + // --------------------------------------------------------------------------- // Define our version of the magic main module macro. We need to grab argc @@ -83,10 +92,8 @@ #define CIDLib_MainModule(thrCtor) \ int main(int argc, char** argv) \ { \ - extern int CIDKernel_SystemInfo_Linux_argc; \ - extern char** CIDKernel_SystemInfo_Linux_argv; \ - CIDKernel_SystemInfo_Linux_argc = argc; \ - CIDKernel_SystemInfo_Linux_argv = argv; \ + CIDKernel_SystemInfo_Linux::argc = argc; \ + CIDKernel_SystemInfo_Linux::argv = argv; \ TThread* pthrToStart = new thrCtor; \ CIDLib_MakePrimary(pthrToStart); \ CIDLib_Init(); \ @@ -110,3 +117,8 @@ int main(int argc, char** argv) \ #define CID_DEBUG_OFF 1 #endif +// --------------------------------------------------------------------------- +// Suppress a single line MSVC warning - since MSVC is not used on Linux, +// this does nothing here. +// --------------------------------------------------------------------------- +#define CIDLib_Suppress(wid) diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformTypes.hpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformTypes.hpp index 4b31ac03..d7c37594 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformTypes.hpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_PlatformTypes.hpp @@ -160,7 +160,7 @@ namespace tCIDLib tCIDLib::TCard1 c1Red; tCIDLib::TCard1 c1Green; tCIDLib::TCard1 c1Blue; - tCIDLib::TCard1 c1Dummy; + tCIDLib::TCard1 c1Alpha; }; #pragma CIDLIB_POPPACK } diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Process_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Process_Linux.cpp index 9ac179fd..8c6618c9 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Process_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Process_Linux.cpp @@ -140,6 +140,27 @@ const TProcessHandleImpl& TProcessHandle::hprociThis() const // --------------------------------------------------------------------------- // TKrnlProcess functions // --------------------------------------------------------------------------- +tCIDLib::TBoolean +TKrnlProcess::bActivateProcess(const tCIDLib::TProcessId pidToActivate) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + +tCIDLib::TBoolean +TKrnlProcess::bCheckSingleInstanceInfo( const tCIDLib::TCh* const pszResName + , tCIDLib::TBoolean& bFound + , TKrnlExtProcess* const pkextpTarget) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + bFound = kCIDLib::False; + return kCIDLib::False; +} + + tCIDLib::TBoolean TKrnlProcess::bSetPriorityClass(const tCIDLib::EPrioClasses eClass) { @@ -176,6 +197,17 @@ TKrnlProcess::bSetPriorityClass(const tCIDLib::EPrioClasses eClass) } +tCIDLib::TBoolean +TKrnlProcess::bSetSingleInstanceInfo( const tCIDLib::TCh* const pszResName + , const tCIDLib::TBoolean bBringOldForward + , tCIDLib::TBoolean& bFoundOld) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + tCIDLib::TVoid TKrnlProcess::ExitProcess(const tCIDLib::EExitCodes eExitCode) { ::exit(tCIDLib::c4EnumOrd(eExitCode)); diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_RawMemory_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_RawMemory_Linux.cpp index 74129b01..0a99181a 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_RawMemory_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_RawMemory_Linux.cpp @@ -261,6 +261,55 @@ TRawMem::c4Exchange( tCIDLib::TCard4& c4ToFill } +// +// We do a safe inc/dec of the passed reference. Just to be safe we don't allow ref +// counts beyond i4MaxCard, since the interlocked stuff really works on signed +// values. It would be psychotic to expect such a thing anyway. And we check for an +// underflow in the release since that means something went really wrong. +// +tCIDLib::TCard4 +TRawMem::c4SafeRefAcquire(tCIDLib::TCard4& c4Ref, tCIDLib::TBoolean& bRes) +{ + if (c4Ref > tCIDLib::TCard4(kCIDLib::i4MaxInt)) + { + TKrnlError::SetLastKrnlError(kKrnlErrs::errcMem_BadRefCntRel); + bRes = kCIDLib::False; + return 0; + } + bRes = kCIDLib::True; + return tCIDLib::TCard4(__sync_add_and_fetch(&c4Ref, 1)); +} + +tCIDLib::TCard4 +TRawMem::c4SafeRefRelease(tCIDLib::TCard4& c4Ref, tCIDLib::TBoolean& bRes) +{ + if (c4Ref > tCIDLib::TCard4(kCIDLib::i4MaxInt)) + { + TKrnlError::SetLastKrnlError(kKrnlErrs::errcMem_BadRefCntRel); + bRes = kCIDLib::False; + return 0; + } + + if (!c4Ref) + { + TKrnlError::SetLastKrnlError(kKrnlErrs::errcMem_ZeroRefCntRel); + bRes = kCIDLib::False; + return 0; + } + + tCIDLib::TInt4 iRes = __sync_sub_and_fetch(&c4Ref, 1); + if (iRes < 0) + { + // The ref count management must be wrong + TKrnlError::SetLastKrnlError(kKrnlErrs::errcMem_RefCntUnderflow); + bRes = kCIDLib::False; + return 0; + } + bRes = kCIDLib::True; + return tCIDLib::TCard4(iRes); +} + + // // Returns the original value in ppToFill. If that's the same as pCompare, // then the exchange occurred. diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Signals_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Signals_Linux.cpp index f3c99b57..196d7cd9 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Signals_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Signals_Linux.cpp @@ -241,3 +241,10 @@ tCIDLib::TVoid TKrnlSignals::PlatformInit() ::sigaction(aProgramErrors[c4Idx], &SigAction, 0); } } + + +tCIDLib::TVoid TKrnlSignals::GenerateCtrlCSignal() +{ + ::raise(SIGINT); +} + diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_SystemInfo_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_SystemInfo_Linux.cpp index 7316f550..0a3ede62 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_SystemInfo_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_SystemInfo_Linux.cpp @@ -415,7 +415,7 @@ TCIDKrnlModule::bInitTermSysInfo(const tCIDLib::EInitTerm eInitTerm) // --------------------------------------------------------------------------- tCIDLib::TBoolean TKrnlSysInfo::bCmdLineArg( const tCIDLib::TCard4 c4Index - , const tCIDLib::TCh*& pszToFill) + , TKrnlString& kstrToFill) { if (CIDKernel_SystemInfo_Linux::argc != -1) CIDKernel_SystemInfo_Linux::InitArgArray(); @@ -425,7 +425,7 @@ TKrnlSysInfo::bCmdLineArg( const tCIDLib::TCard4 c4Index TKrnlError::SetLastKrnlError(kKrnlErrs::errcGen_IndexError); return kCIDLib::False; } - pszToFill = CIDKernel_SystemInfo_Linux::CachedInfo.apszArgList[c4Index]; + kstrToFill = CIDKernel_SystemInfo_Linux::CachedInfo.apszArgList[c4Index]; return kCIDLib::True; } @@ -456,8 +456,7 @@ TKrnlSysInfo::bQueryMachineID( tCIDLib::TCh* const pchBuffer tCIDLib::TBoolean -TKrnlSysInfo::bQuerySpecialPath( tCIDLib::TCh* const pszBuffer - , const tCIDLib::TCard4 c4MaxChars +TKrnlSysInfo::bQuerySpecialPath( TKrnlString& kstrToFill , const tCIDLib::ESpecialPaths ePath) { // Figure this out @@ -468,8 +467,7 @@ TKrnlSysInfo::bQuerySpecialPath( tCIDLib::TCh* const pszBuffer tCIDLib::TBoolean -TKrnlSysInfo::bQueryUserName( tCIDLib::TCh* const pszBuffer - , const tCIDLib::TCard4 c4MaxChars) +TKrnlSysInfo::bQueryUserName(TKrnlString& kstrToFill) { struct passwd* pwd = ::getpwuid(::getuid()); @@ -479,13 +477,7 @@ TKrnlSysInfo::bQueryUserName( tCIDLib::TCh* const pszBuffer return kCIDLib::False; } - if (c4MaxChars < ::strlen(pwd->pw_name)) - { - TKrnlError::SetLastKrnlError(kKrnlErrs::errcData_InsufficientBuffer); - return kCIDLib::False; - } - - TRawStr::pszConvert(pwd->pw_name, pszBuffer, c4MaxChars); + kstrToFill = pwd->pw_name; return kCIDLib::True; } diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Thread_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Thread_Linux.cpp index 218db3f3..1b8aabe4 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Thread_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Thread_Linux.cpp @@ -66,6 +66,17 @@ namespace CIDKernel_Thread_Linux tCIDLib::TThreadId tidPrimary; + // ----------------------------------------------------------------------- + // Our per-thread info structure and storage per thread + // ----------------------------------------------------------------------- + struct TPerThreadInfo + { + tCIDLib::TBoolean bIsGUIThread = kCIDLib::False; + }; + + thread_local TPerThreadInfo ptiThread; + + // --------------------------------------------------------------------------- // Local methods // --------------------------------------------------------------------------- @@ -244,6 +255,13 @@ tCIDLib::TBoolean TKrnlThread::bIsCaller(const TKrnlThread& kthrToTest) } +// Return whether the callng thread is a GUI marked thread +tCIDLib::TBoolean TKrnlThread::bIsCallerGUIThread() +{ + return CIDKernel_Thread_Linux::ptiThread.bIsGUIThread; +} + + tCIDLib::TBoolean TKrnlThread::bPriorityOf(const TKrnlThread& kthrToQuery , tCIDLib::EPrioLevels& eToFill) @@ -400,11 +418,19 @@ tCIDLib::TBoolean TKrnlThread::bAdoptCaller() tCIDLib::TBoolean TKrnlThread::bIsRunning(tCIDLib::TBoolean& bToFill) const { - bToFill = (::pthread_kill(m_hthrThis.m_phthriThis->tidThis, 0) == 0); + bToFill = (m_hthrThis.m_phthriThis->tidThis != kCIDLib::tidInvalid) + && (::pthread_kill(m_hthrThis.m_phthriThis->tidThis, 0) == 0); return kCIDLib::True; } +// Return whether we are marked as the GUI thread, which is in the per-thread data +tCIDLib::TBoolean TKrnlThread::bIsGUIThread() const +{ + return CIDKernel_Thread_Linux::ptiThread.bIsGUIThread; +} + + tCIDLib::TBoolean TKrnlThread::bBeginThread( const TKrnlThread::TCallBack pfnFunc , const tCIDLib::TCard4 c4StackSize @@ -627,15 +653,36 @@ tCIDLib::TBoolean TKrnlThread::bUnblock() } -// Deal with new bState parameter +// +// Wait for up to a given time for this thread to die. If the return is true, then +// the bDied parameter is updated with the died or not state. +// +// This one has to do a two-object wait, for either this thread to die, or for this +// thread to post the passed event, which is a very useful thing to b eable to do. +// +tCIDLib::TBoolean +TKrnlThread::bWaitEvOrDeath( TKrnlEvent& kevWait + , tCIDLib::TBoolean& bDied + , const tCIDLib::TCard4 c4MilliSecs) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + bDied = kCIDLib::False; + return kCIDLib::False; +} + + tCIDLib::TBoolean TKrnlThread::bWaitForDeath( tCIDLib::TBoolean& bState , tCIDLib::EExitCodes& eToFill , const tCIDLib::TCard4 c4MilliSeconds) const { + bState = kCIDLib::False; + if (m_hthrThis.m_phthriThis->bJoined) { eToFill = m_hthrThis.m_phthriThis->eExit; + bState = kCIDLib::True; return kCIDLib::True; } @@ -665,8 +712,8 @@ TKrnlThread::bWaitForDeath( tCIDLib::TBoolean& bState } else { - TKrnlError::SetLastKrnlError(kKrnlErrs::errcGen_Timeout); - return kCIDLib::False; + // Timeout now returns true while setting bState to false. + return kCIDLib::True; } m_hthrThis.m_phthriThis->eExit = tCIDLib::EExitCodes(tCIDLib::TSInt(pHostExit)); @@ -675,13 +722,26 @@ TKrnlThread::bWaitForDeath( tCIDLib::TBoolean& bState eToFill = m_hthrThis.m_phthriThis->eExit; + bState = kCIDLib::True; return kCIDLib::True; } +// +// Sets the GUI thread marker flag. This is set in a per thread memory location so that +// we can get back to it without the outside world having to pass it in to all of the +// handle waiting methods. +// +tCIDLib::TVoid TKrnlThread::MarkAsGUIThread() +{ + CIDKernel_Thread_Linux::ptiThread.bIsGUIThread = kCIDLib::True; +} + + tCIDLib::TVoid TKrnlThread::Orphan() { - if (!::pthread_kill(m_hthrThis.m_phthriThis->tidThis, 0)) + if (m_hthrThis.bIsValid() + && !::pthread_kill(m_hthrThis.m_phthriThis->tidThis, 0)) ::pthread_detach(m_hthrThis.m_phthriThis->tidThis); } diff --git a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Time_Linux.cpp b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Time_Linux.cpp index bb49fdec..dbe27581 100644 --- a/Source/AllProjects/CIDKernel/Linux/CIDKernel_Time_Linux.cpp +++ b/Source/AllProjects/CIDKernel/Linux/CIDKernel_Time_Linux.cpp @@ -313,6 +313,72 @@ TKrnlTimeStamp::bDayOfWeek(tCIDLib::EWeekDays& eToFill) const } +// +// Expand out all of the information from our current timestamp. Calling +// the separate methods might create an inconsistency in some uses. +// +tCIDLib::TBoolean +TKrnlTimeStamp::bExpandDetails( tCIDLib::TCard4& c4Year + , tCIDLib::EMonths& eMonth + , tCIDLib::TCard4& c4Day + , tCIDLib::EWeekDays& eWeekDay + , tCIDLib::TCard4& c4Hour + , tCIDLib::TCard4& c4Minute + , tCIDLib::TCard4& c4Second + , tCIDLib::TCard4& c4Millis + , tCIDLib::TEncodedTime& enctStamp) const +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + + +// +// Moves the time forward a number of days dealing with the issues of DST, +// leap years and so forth. For days, we convert to UTC where a day is +// always 24 hours and then convert back to the local time zone, so that +// one is easy enough. +// +tCIDLib::TBoolean +TKrnlTimeStamp::bForwardByDays(const tCIDLib::TCard4 c4Count) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + +// +// For months we pull out the details, move the month forward, adding years +// if they go more than 12 months, then we check the date to see if we hit +// a leap day and adjust if so. Here, we don't have to deal with DST since +// we are dealing in years, months, days, so when we convert back, DST will +// have been taken care of. +// +tCIDLib::TBoolean +TKrnlTimeStamp::bForwardByMonths(const tCIDLib::TCard4 c4Count) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + +// +// For years, we do similarly to months above. WE break out the details and +// move the year forward. We see if we hit a leap day and adjust forward if +// so. Then we convert back and that deals with the DST issues for us. +// +tCIDLib::TBoolean +TKrnlTimeStamp::bForwardByYears(const tCIDLib::TCard4 c4Count) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + tCIDLib::TBoolean TKrnlTimeStamp::bFromDetails(const tCIDLib::TCard4 c4Year , const tCIDLib::EMonths eMonth @@ -347,6 +413,22 @@ TKrnlTimeStamp::bFromDetails(const tCIDLib::TCard4 c4Year } +// +// Set our stamp from the passed time values. The date will be the base +// time stamp date. +// +tCIDLib::TBoolean +TKrnlTimeStamp::bFromTimeDetails(const tCIDLib::TCard4 c4Hour + , const tCIDLib::TCard4 c4Minute + , const tCIDLib::TCard4 c4Second + , const tCIDLib::TCard4 c4MilliSecs) +{ + // + TKrnlError::SetLastError(kKrnlErrs::errcGen_NotSupported); + return kCIDLib::False; +} + + tCIDLib::TBoolean TKrnlTimeStamp::bSetTo(const tCIDLib::TEncodedTime& enctNew) { m_enctTime = enctNew; diff --git a/Source/AllProjects/CIDLib/CIDLib.cpp b/Source/AllProjects/CIDLib/CIDLib.cpp index e58d8f10..457e81c0 100644 --- a/Source/AllProjects/CIDLib/CIDLib.cpp +++ b/Source/AllProjects/CIDLib/CIDLib.cpp @@ -251,7 +251,6 @@ template class TBag; template class TBasicTreeCol; template class TBasicDLinkedCol; template class TBasicDLinkedRefCol; -template class TBasicTreeCol; template class TEnumBitset; template class TCircularBuf; template class TCIDCacheItem; @@ -266,7 +265,6 @@ template class TKeyObjPair; template class TMngPtr; template class TNamedValMap; template class TObjArray; -template class TQueue; template class TPolyStreamer; template class TRefBag; template class TRefDeque; @@ -288,7 +286,7 @@ eCompTest(const tCIDLib::TCard4& c41, const tCIDLib::TCard4& c42) return tCIDLib::ESortComps::FirstLess; else if (c41 > c42) return tCIDLib::ESortComps::FirstGreater; - tCIDLib::ESortComps::Equal; + return tCIDLib::ESortComps::Equal; } static tCIDLib::TVoid DummyFunc() @@ -604,6 +602,15 @@ TFacCIDLib& facCIDLib() return *pfacCIDLib; } +// +// This function does the same thing as above but is able to be +// forward-declared before the definition of TFacCIDLib. +// +TModule& facCIDLibEarly() +{ + return facCIDLib(); +} + // // This is called from the magic main thread macro in CIDLib.Hpp. Its called diff --git a/Source/AllProjects/CIDLib/CIDLib.hpp b/Source/AllProjects/CIDLib/CIDLib.hpp index daba5827..27de2fa9 100644 --- a/Source/AllProjects/CIDLib/CIDLib.hpp +++ b/Source/AllProjects/CIDLib/CIDLib.hpp @@ -98,16 +98,18 @@ StdEnumTricks(tCIDLib::ELogFlags) #include "CIDLib_CollectCursor.hpp" #include "CIDLib_Collection.hpp" +extern CIDLIBEXP TModule& facCIDLibEarly(); + +#include "CIDLib_FundStack.hpp" +#include "CIDLib_BinOutStream.hpp" +#include "CIDLib_BinInStream.hpp" +#include "CIDLib_FundStackStrmOps.hpp" #include "CIDLib_CircularBuf.hpp" #include "CIDLib_FundArray.hpp" #include "CIDLib_FundDeque.hpp" #include "CIDLib_FundQueue.hpp" -#include "CIDLib_FundStack.hpp" #include "CIDLib_FundVector.hpp" -#include "CIDLib_BinInStream.hpp" -#include "CIDLib_BinOutStream.hpp" - // --------------------------------------------------------------------------- // Because of the special nature of this facility at the base of the system, order of @@ -219,6 +221,7 @@ EnumBinStreamMacros(tCIDCtrls::EExtKeys) #include "CIDLib_BinaryFile.hpp" #include "CIDLib_FileStreamImpl.hpp" #include "CIDLib_LogEvent.hpp" +#include "CIDLib_FundVectorDestructor.hpp" #include "CIDLib_VolumeInfo.hpp" #include "CIDLib_Locale.hpp" #include "CIDLib_Logger.hpp" @@ -252,6 +255,7 @@ EnumBinStreamMacros(tCIDCtrls::EExtKeys) #include "CIDLib_TextFileStream.hpp" #include "CIDLib_TextMBufStream.hpp" #include "CIDLib_TextStringStream.hpp" +#include "CIDLib_KeyedHashSet.hpp" #include "CIDLib_PolyStreamer.hpp" #include "CIDLib_StreamLexer.hpp" @@ -284,7 +288,6 @@ extern CIDLIBEXP TFacCIDLib& facCIDLib(); #include "CIDLib_Queue.hpp" #include "CIDLib_Stack.hpp" #include "CIDLib_HashSet.hpp" -#include "CIDLib_KeyedHashSet.hpp" #include "CIDLib_HashMap.hpp" #include "CIDLib_SortedBag.hpp" #include "CIDLib_FindBuf.hpp" diff --git a/Source/AllProjects/CIDLib/CIDLib_Atomic.hpp b/Source/AllProjects/CIDLib/CIDLib_Atomic.hpp index 3ec7de79..b8f708c1 100644 --- a/Source/AllProjects/CIDLib/CIDLib_Atomic.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_Atomic.hpp @@ -244,6 +244,6 @@ template class TSingleton // The pointer to our instance object we fault in. It has to be cache // aligned. Has to be mutable so we can fault it in from const methods. // ------------------------------------------------------------------- - mutable alignas(kCIDLib::c4CacheAlign) T* m_ptInstance; + mutable T* m_ptInstance alignas(kCIDLib::c4CacheAlign); }; diff --git a/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedCol.hpp b/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedCol.hpp index 0d4338f9..074f492b 100644 --- a/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedCol.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedCol.hpp @@ -56,7 +56,7 @@ template class TBasicDLinkedCol : public TCollection // ------------------------------------------------------------------- // Our nested read-only cursor class // ------------------------------------------------------------------- - template class TConstCursor : public TBiColCursor + template class TConstCursor : public TBiColCursor { public : // ----------------------------------------------------------- @@ -78,7 +78,7 @@ template class TBasicDLinkedCol : public TCollection , m_pcolCursoring(pcolToCursor) , m_pnodeCur(nullptr) { - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -191,7 +191,7 @@ template class TBasicDLinkedCol : public TCollection return (m_pnodeCur != nullptr); } - const TElem& objRCur() const override + const TElem2& objRCur() const override { this->CheckInitialized(CID_FILE, CID_LINE); @@ -230,7 +230,7 @@ template class TBasicDLinkedCol : public TCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; private : @@ -259,8 +259,8 @@ template class TBasicDLinkedCol : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TBasicDLinkedCol::TConstCursor - , TBiColCursor + TBasicDLinkedCol::TConstCursor + , TBiColCursor ) }; @@ -268,7 +268,7 @@ template class TBasicDLinkedCol : public TCollection // ------------------------------------------------------------------- // Our nested non-const cursor class // ------------------------------------------------------------------- - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -301,20 +301,20 @@ template class TBasicDLinkedCol : public TCollection // ----------------------------------------------------------- // Public operators // ----------------------------------------------------------- - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &const_cast(this->pnodeCur()->objData()); + return &const_cast(this->pnodeCur()->objData()); } TNonConstCursor& operator=(const TNonConstCursor& cursSrc) @@ -345,7 +345,7 @@ template class TBasicDLinkedCol : public TCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); @@ -353,7 +353,7 @@ template class TBasicDLinkedCol : public TCollection TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } @@ -372,8 +372,8 @@ template class TBasicDLinkedCol : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TBasicDLinkedCol::TNonConstCursor - , TBasicDLinkedCol::TConstCursor + TBasicDLinkedCol::TNonConstCursor + , TBasicDLinkedCol::TConstCursor ) }; @@ -381,8 +381,8 @@ template class TBasicDLinkedCol : public TCollection // ------------------------------------------------------------------- // More aliases for the nested cursor classes // ------------------------------------------------------------------- - using TCursor = typename TConstCursor; - using TNCCursor = typename TNonConstCursor; + using TCursor = TConstCursor; + using TNCCursor = TNonConstCursor; // ------------------------------------------------------------------- diff --git a/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedRefCol.hpp b/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedRefCol.hpp index 6938ee3e..28ce343f 100644 --- a/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedRefCol.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_BasicDLinkedRefCol.hpp @@ -57,7 +57,7 @@ template class TBasicDLinkedRefCol : public TRefCollection class TConstCursor : public TBiColCursor + template class TConstCursor : public TBiColCursor { public : // ----------------------------------------------------------- @@ -78,7 +78,7 @@ template class TBasicDLinkedRefCol : public TRefCollection*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -156,7 +156,7 @@ template class TBasicDLinkedRefCol : public TRefCollectionCheckSerialNum(m_pcolCursoring->c4SerialNum(), CID_FILE, CID_LINE); if (!m_pnodeCur) return kCIDLib::False; - m_pnodeCur = static_cast*>(m_pnodeCur->pnodeNext()); + m_pnodeCur = static_cast*>(m_pnodeCur->pnodeNext()); return (m_pnodeCur != nullptr); } @@ -169,7 +169,7 @@ template class TBasicDLinkedRefCol : public TRefCollectionCheckSerialNum(m_pcolCursoring->c4SerialNum(), CID_FILE, CID_LINE); if (!m_pnodeCur) return kCIDLib::False; - m_pnodeCur = static_cast*>(m_pnodeCur->pnodePrev()); + m_pnodeCur = static_cast*>(m_pnodeCur->pnodePrev()); return (m_pnodeCur != nullptr); } @@ -179,7 +179,7 @@ template class TBasicDLinkedRefCol : public TRefCollection*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeTail() ); @@ -195,7 +195,7 @@ template class TBasicDLinkedRefCol : public TRefCollection*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -205,7 +205,7 @@ template class TBasicDLinkedRefCol : public TRefCollectionCheckInitialized(CID_FILE, CID_LINE); @@ -245,7 +245,7 @@ template class TBasicDLinkedRefCol : public TRefCollection class TBasicDLinkedRefCol : public TRefCollection - , TBiColCursor + TBasicDLinkedRefCol::TConstCursor + , TBiColCursor ) }; - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -323,20 +323,20 @@ template class TBasicDLinkedRefCol : public TRefCollectionCheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return *const_cast(this->pnodeCur()->pobjData()); + return *const_cast(this->pnodeCur()->pobjData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->pobjData()); + return const_cast(this->pnodeCur()->pobjData()); } TNonConstCursor& operator++() @@ -356,14 +356,14 @@ template class TBasicDLinkedRefCol : public TRefCollectionCheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return *const_cast(this->pnodeCur()->pobjData()); + return *const_cast(this->pnodeCur()->pobjData()); } @@ -382,8 +382,8 @@ template class TBasicDLinkedRefCol : public TRefCollection - , TBasicDLinkedRefCol::TConstCursor + TBasicDLinkedRefCol::TNonConstCursor + , TBasicDLinkedRefCol::TConstCursor ) }; @@ -391,8 +391,8 @@ template class TBasicDLinkedRefCol : public TRefCollection; - using TNCCursor = typename TNonConstCursor; + using TCursor = TConstCursor; + using TNCCursor = TNonConstCursor; // ------------------------------------------------------------------- @@ -790,8 +790,8 @@ template class TBasicDLinkedRefCol : public TRefCollection; - friend class TNonConstCursor; + friend TConstCursor; + friend TNonConstCursor; // ------------------------------------------------------------------- diff --git a/Source/AllProjects/CIDLib/CIDLib_BasicTreeCol.hpp b/Source/AllProjects/CIDLib/CIDLib_BasicTreeCol.hpp index 828e7c85..4433a31c 100644 --- a/Source/AllProjects/CIDLib/CIDLib_BasicTreeCol.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_BasicTreeCol.hpp @@ -893,7 +893,7 @@ template class TBasicTreeCol : public TCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : public TColCursor + template class TConstCursor : public TColCursor { public : // ----------------------------------------------------------- @@ -1006,7 +1006,7 @@ template class TBasicTreeCol : public TCollection return (m_pnodeCur != nullptr); } - const TElem& objRCur() const override + const TElem2& objRCur() const override { this->CheckInitialized(CID_FILE, CID_LINE); @@ -1078,7 +1078,7 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; private : @@ -1107,12 +1107,12 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TBasicTreeCol::TConstCursor - , TColCursor + TBasicTreeCol::TConstCursor + , TColCursor ) }; - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -1156,20 +1156,20 @@ template class TBasicTreeCol : public TCollection return *this; } - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &const_cast(this->pnodeCur()->objData()); + return &const_cast(this->pnodeCur()->objData()); } TNonConstCursor& operator++() @@ -1189,7 +1189,7 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); @@ -1198,7 +1198,7 @@ template class TBasicTreeCol : public TCollection this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } @@ -1217,13 +1217,13 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TBasicTreeCol::TNonConstCursor - , TBasicTreeCol::TConstCursor + TBasicTreeCol::TNonConstCursor + , TBasicTreeCol::TConstCursor ) }; - template class TConstScopeCursor : public TColCursor + template class TConstScopeCursor : public TColCursor { public : // ----------------------------------------------------------- @@ -1349,7 +1349,7 @@ template class TBasicTreeCol : public TCollection return (m_pnodeCur != nullptr); } - const TElem& objRCur() const override + const TElem2& objRCur() const override { this->CheckInitialized(CID_FILE, CID_LINE); @@ -1448,11 +1448,11 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- // Do any needed magic macros // ----------------------------------------------------------- - TemplateRTTIDefs(TConstScopeCursor,TColCursor) + TemplateRTTIDefs(TConstScopeCursor,TColCursor) }; - template class TNonConstScopeCursor : public TConstScopeCursor + template class TNonConstScopeCursor : public TConstScopeCursor { public : // ----------------------------------------------------------- @@ -1464,7 +1464,7 @@ template class TBasicTreeCol : public TCollection { } - TNonConstScopeCursor( TBasicTreeCol* const pcolToCursor + TNonConstScopeCursor( TBasicTreeCol* const pcolToCursor , const TString& strStartNode) : TParent(pcolToCursor, strStartNode) @@ -1473,7 +1473,7 @@ template class TBasicTreeCol : public TCollection } // We have to lock first, so we can't use member init! - TNonConstScopeCursor(const TNonConstScopeCursor& cursSrc) + TNonConstScopeCursor(const TNonConstScopeCursor& cursSrc) { TNonConstScopeCursor::operator=(cursSrc); } @@ -1506,7 +1506,7 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() + TElem2& objWCur() { this->CheckInitialized(CID_FILE, CID_LINE); @@ -1535,8 +1535,8 @@ template class TBasicTreeCol : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyTpye::TNonConstScopeCursor - , TMyType::TConstScopeCursor + TMyTpye::TNonConstScopeCursor + , TMyType::TConstScopeCursor ) }; diff --git a/Source/AllProjects/CIDLib/CIDLib_ColAlgo.hpp b/Source/AllProjects/CIDLib/CIDLib_ColAlgo.hpp index fab07d25..fa1d47cc 100644 --- a/Source/AllProjects/CIDLib/CIDLib_ColAlgo.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_ColAlgo.hpp @@ -54,12 +54,12 @@ namespace tCIDColAlgo // template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> tCIDLib::TBoolean bAddIfNew( TCol& colTar , const TElem& objToAdd , TComp pfnComp = TComp()) { - TCol::TCursor cursTar(&colTar); + typename TCol::TCursor cursTar(&colTar); for (; cursTar; ++cursTar) { // If we find a match, return false, didn't add it @@ -79,11 +79,11 @@ namespace tCIDColAlgo // This only works for a collection that has a RemoveAt(cursor) method, but // most do. // - template + template tCIDLib::TBoolean bRemoveIf(TCol& colTar, TTest pfnTest) { tCIDLib::TBoolean bRet = kCIDLib::False; - TCol::TCursor cursTar(&colTar); + typename TCol::TCursor cursTar(&colTar); while (cursTar) { // Test this one, if a match remove it, else move forward @@ -112,14 +112,14 @@ namespace tCIDColAlgo // template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> tCIDLib::TBoolean bRemoveMatches( TCol& colTar , const TElem& objToRem , const tCIDLib::TBoolean bRemoveAll , TComp pfnComp = TComp()) { tCIDLib::TBoolean bRet = kCIDLib::False; - TCol::TCursor cursTar(&colTar); + typename TCol::TCursor cursTar(&colTar); while (cursTar) { // If we find a match, remove it @@ -147,7 +147,7 @@ namespace tCIDColAlgo // collection, adding them to the incoming value, which we return as the // new value. // - template + template TElem tAccumulate(const TCol& colSrc, const TElem& tInitVal) { TElem retVal = tInitVal; @@ -180,12 +180,12 @@ namespace tCIDColAlgo // template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> typename TCol::TCursor cursFind(const TCol& colSrc , const TElem& objToFind , TComp pfnComp = TComp()) { - TCol::TCursor cursSrc(&colSrc); + typename TCol::TCursor cursSrc(&colSrc); for (; cursSrc; ++cursSrc) { if (pfnComp(*cursSrc, objToFind)) @@ -203,12 +203,12 @@ namespace tCIDColAlgo // template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> typename TCol::TCursor cursFindNot( const TCol& colSrc , const TElem& objToFind , TComp pfnComp = TComp()) { - TCol::TCursor cursSrc(&colSrc); + typename TCol::TCursor cursSrc(&colSrc); for (; cursSrc; ++cursSrc) { if (!pfnComp(*cursSrc, objToFind)) @@ -225,12 +225,12 @@ namespace tCIDColAlgo // template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> typename TCol::TCursor cursFirstGreater(const TCol& colSrc , const TElem& objComp , TComp pfnComp = TComp()) { - TCol::TCursor cursSrc(&colSrc); + typename TCol::TCursor cursSrc(&colSrc); for (; cursSrc; ++cursSrc) { if (pfnComp(*cursSrc, objComp) == tCIDLib::ESortComps::FirstGreater) @@ -241,12 +241,12 @@ namespace tCIDColAlgo template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> typename TCol::TCursor cursFirstLess(const TCol& colSrc , const TElem& objComp , TComp pfnComp = TComp()) { - TCol::TCursor cursSrc(&colSrc); + typename TCol::TCursor cursSrc(&colSrc); for (; cursSrc; ++cursSrc) { if (pfnComp(*cursSrc, objComp) == tCIDLib::ESortComps::FirstLess) @@ -314,14 +314,14 @@ namespace tCIDColAlgo // template - , typename TElem = TCol::TMyElemType> + , typename TElem = typename TCol::TMyElemType> tCIDLib::TCard4 c4RemoveSeqDups(TCol& colSrc, TComp pfnComp = TComp()) { if (colSrc.bIsEmpty()) return 0; tCIDLib::TCard4 c4RemCount = 0; - TCol::TNCCursor cursCur(&colSrc); + typename TCol::TNCCursor cursCur(&colSrc); TElem& objLast = *cursCur; ++cursCur; while (cursCur.bIsValid()) @@ -346,7 +346,7 @@ namespace tCIDColAlgo // this guy will find the value that has the most dups. If not sorted it will // not collect them all up, it's just looking for sequential dups. // - template + template TElem tFindMaxFundSeqDup(const TCol& fcolSrc) { TElem tLastBest = TElem(0); diff --git a/Source/AllProjects/CIDLib/CIDLib_Enum.hpp b/Source/AllProjects/CIDLib/CIDLib_Enum.hpp index 1695a132..1422d780 100644 --- a/Source/AllProjects/CIDLib/CIDLib_Enum.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_Enum.hpp @@ -239,13 +239,13 @@ class CIDLIBEXP TEnumMap // generated enums as long as they have the standard three magic values, without // any extra overhead. // -#define eMinEnumVal(E) E##::Min -#define eMaxEnumVal(E) E##::Max -#define eEnumValCount(E) E##::Count +#define eMinEnumVal(E) E::Min +#define eMaxEnumVal(E) E::Max +#define eEnumValCount(E) E::Count -#define c4MinEnumVal(E) tCIDLib::TCard4(E##::Min) -#define c4MaxEnumVal(E) tCIDLib::TCard4(E##::Max) -#define c4EnumValCount(E) tCIDLib::TCard4(E##::Count) +#define c4MinEnumVal(E) tCIDLib::TCard4(E::Min) +#define c4MaxEnumVal(E) tCIDLib::TCard4(E::Max) +#define c4EnumValCount(E) tCIDLib::TCard4(E::Count) // @@ -264,7 +264,7 @@ namespace tCIDLib typename E , E eStart = eMinEnumVal(E) , E eEnd = eMaxEnumVal(E) - , typename IterCB = tCIDLib::TVoid (*IterCB)(const E) + , typename IterCB = tCIDLib::TVoid (*)(const E) > tCIDLib::TVoid ForEachE(IterCB iterCB) { for (E eInd = eStart; eInd <= eEnd; eInd++) @@ -276,7 +276,7 @@ namespace tCIDLib // A variation that can be broken out of, and returns the value it stopped on. // If it goes to the end, the return will be the ::Count value. // - template + template E eForEachE(IterCB iterCB) { E eInd = eMinEnumVal(E); diff --git a/Source/AllProjects/CIDLib/CIDLib_FundArray.hpp b/Source/AllProjects/CIDLib/CIDLib_FundArray.hpp index 2157e8bd..58bb0ec1 100644 --- a/Source/AllProjects/CIDLib/CIDLib_FundArray.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_FundArray.hpp @@ -36,6 +36,7 @@ #pragma CIDLIB_PACK(CIDLIBPACK) + // --------------------------------------------------------------------------- // CLASS: TFundArray // PREFIX: fcol @@ -412,22 +413,40 @@ class TFundArray : public TFundColBase, public MDuplicable ); } + TBinOutStream& WriteToStream(TBinOutStream& strmToWriteTo) const + { + // + // Store the element count and then the elements. We stream out + // a stream maker to add a little safety. + // + strmToWriteTo << tCIDLib::EStreamMarkers::StartObject << m_c4ElemCount; + TBinOutStream_WriteArray(strmToWriteTo, m_ptElements, m_c4ElemCount); + return strmToWriteTo; + } - protected : - // ------------------------------------------------------------------- - // Declare our friends - // ------------------------------------------------------------------- - friend TBinOutStream& operator<< - ( - TBinOutStream& strmOut - , const TMyType& fcolToStream - ); + TBinInStream& ReadFromStream(TBinInStream& strmToReadFrom) + { + strmToReadFrom.CheckForMarker + ( + tCIDLib::EStreamMarkers::StartObject + , CID_FILE + , CID_LINE + ); + + // Pull the element count out + tCIDLib::TCard4 c4NewCount; + strmToReadFrom >> c4NewCount; - friend TBinInStream& operator>> - ( - TBinInStream& strmIn - , TMyType& fcolToStream - ); + if (m_c4ElemCount != c4NewCount) + { + m_c4ElemCount = c4NewCount; + delete [] m_ptElements; + m_ptElements = nullptr; + m_ptElements = new TElem[m_c4ElemCount]; + } + TBinInStream_ReadArray(strmToReadFrom, m_ptElements, m_c4ElemCount); + return strmToReadFrom; + } private : @@ -457,37 +476,12 @@ class TFundArray : public TFundColBase, public MDuplicable template TBinOutStream& operator<<(TBinOutStream& strmToWriteTo, const TFundArray& colToStream) { - // - // Store the element count and then the elements. We stream out - // a stream maker to add a little safety. - // - strmToWriteTo << tCIDLib::EStreamMarkers::StartObject << colToStream.m_c4ElemCount; - TBinOutStream_WriteArray(strmToWriteTo, colToStream.m_ptElements, colToStream.m_c4ElemCount); - return strmToWriteTo; + return colToStream.WriteToStream(strmToWriteTo); } template TBinInStream& operator>>(TBinInStream& strmToReadFrom, TFundArray& colToStream) { - strmToReadFrom.CheckForMarker - ( - tCIDLib::EStreamMarkers::StartObject - , CID_FILE - , CID_LINE - ); - - // Pull the element count out - tCIDLib::TCard4 c4NewCount; - strmToReadFrom >> c4NewCount; - - if (colToStream.m_c4ElemCount != c4NewCount) - { - colToStream.m_c4ElemCount = c4NewCount; - delete [] colToStream.m_ptElements; - colToStream.m_ptElements = nullptr; - colToStream.m_ptElements = new TElem[colToStream.m_c4ElemCount]; - } - TBinInStream_ReadArray(strmToReadFrom, colToStream.m_ptElements, colToStream.m_c4ElemCount); - return strmToReadFrom; + return colToStream.ReadFromStream(strmToReadFrom); } diff --git a/Source/AllProjects/CIDLib/CIDLib_FundDeque.hpp b/Source/AllProjects/CIDLib/CIDLib_FundDeque.hpp index 5488ffa0..7aa6fe33 100644 --- a/Source/AllProjects/CIDLib/CIDLib_FundDeque.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_FundDeque.hpp @@ -443,22 +443,79 @@ template class TFundDeque : public TFundColBase, public MDuplicable return m_ptElements[m_c4Head]; } + TBinInStream& ReadFromStream(TBinInStream& strmToReadFrom) + { + // First we should get a stream marker + strmToReadFrom.CheckForMarker + ( + tCIDLib::EStreamMarkers::StartObject + , CID_FILE + , CID_LINE + ); - protected : - // ------------------------------------------------------------------- - // Declare our friends - // ------------------------------------------------------------------- - friend TBinOutStream& operator<< - ( - TBinOutStream& strmOut - , const TFundDeque& fcolToStream - ); + // Get out the new max and count + tCIDLib::TCard4 c4NewCount; + tCIDLib::TCard4 c4NewMax; + strmToReadFrom >> c4NewMax >> c4NewCount; + + // Validate these + if ((c4NewCount > c4NewMax) || !c4NewMax) + { + facCIDLibEarly().ThrowErr + ( + CID_FILE + , CID_LINE + , kCIDErrs::errcFData_BadExtData + , tCIDLib::ESeverities::Failed + , tCIDLib::EErrClasses::Format + ); + } + + // + // If the current max size and the new max size are not the + // same, then reallocate. + // + if (m_c4MaxElements != c4NewMax) + { + delete [] m_ptElements; + m_ptElements = 0; + m_ptElements = new T[c4NewMax]; + m_c4MaxElements = c4NewMax; + } + + // Set the head to zero and the tail to the new count + m_c4Head = 0; + m_c4Tail = c4NewCount; + + // And load up the data + strmToReadFrom.ReadArray(m_ptElements, c4NewCount); + return strmToReadFrom; + } + + TBinOutStream& WriteToStream(TBinOutStream& strmToWriteTo) const + { + // Store a stream marker for safety, then the max and current sizes + strmToWriteTo << tCIDLib::EStreamMarkers::StartObject + << m_c4MaxElements + << c4ElemCount(); + + // + // NOTE: Because of the wraparound, we cannot do a bulk write + // here, even if the elements are byte sized. + // + tCIDLib::TCard4 c4CurInd = m_c4Head; + while (c4CurInd != m_c4Tail) + { + // Write out the current element + strmToWriteTo << m_ptElements[c4CurInd]; - friend TBinInStream& operator>> - ( - TBinInStream& strmIn - , TFundDeque& fcolToStream - ); + // Bump the index and wrap around if required + c4CurInd++; + if (c4CurInd == m_c4MaxElements) + c4CurInd = 0; + } + return strmToWriteTo; + } private : @@ -500,77 +557,13 @@ template class TFundDeque : public TFundColBase, public MDuplicable template TBinInStream& operator>>(TBinInStream& strmToReadFrom, TFundDeque& fcolToStream) { - // First we should get a stream marker - strmToReadFrom.CheckForMarker - ( - tCIDLib::EStreamMarkers::StartObject - , CID_FILE - , CID_LINE - ); - - // Get out the new max and count - tCIDLib::TCard4 c4NewCount; - tCIDLib::TCard4 c4NewMax; - strmToReadFrom >> c4NewMax >> c4NewCount; - - // Validate these - if ((c4NewCount > c4NewMax) || !c4NewMax) - { - facCIDLib().ThrowErr - ( - CID_FILE - , CID_LINE - , kCIDErrs::errcFData_BadExtData - , tCIDLib::ESeverities::Failed - , tCIDLib::EErrClasses::Format - ); - } - - // - // If the current max size and the new max size are not the - // same, then reallocate. - // - if (fcolToStream.m_c4MaxElements != c4NewMax) - { - delete [] fcolToStream.m_ptElements; - fcolToStream.m_ptElements = 0; - fcolToStream.m_ptElements = new T[c4NewMax]; - fcolToStream.m_c4MaxElements = c4NewMax; - } - - // Set the head to zero and the tail to the new count - fcolToStream.m_c4Head = 0; - fcolToStream.m_c4Tail = c4NewCount; - - // And load up the data - strmToReadFrom.ReadArray(fcolToStream.m_ptElements, c4NewCount); - return strmToReadFrom; + return fcolToStream.ReadFromStream(strmToReadFrom); } template TBinOutStream& operator<<(TBinOutStream& strmToWriteTo, const TFundDeque& fcolToStream) { - // Store a stream marker for safety, then the max and current sizes - strmToWriteTo << tCIDLib::EStreamMarkers::StartObject - << fcolToStream.m_c4MaxElements - << fcolToStream.c4ElemCount(); - - // - // NOTE: Because of the wraparound, we cannot do a bulk write - // here, even if the elements are byte sized. - // - tCIDLib::TCard4 c4CurInd = fcolToStream.m_c4Head; - while (c4CurInd != fcolToStream.m_c4Tail) - { - // Write out the current element - strmToWriteTo << fcolToStream.m_ptElements[c4CurInd]; - - // Bump the index and wrap around if required - c4CurInd++; - if (c4CurInd == fcolToStream.m_c4MaxElements) - c4CurInd = 0; - } - return strmToWriteTo; + return fcolToStream.WriteToStream(strmToWriteTo); } diff --git a/Source/AllProjects/CIDLib/CIDLib_FundQueue.hpp b/Source/AllProjects/CIDLib/CIDLib_FundQueue.hpp index 8477542b..133aa34d 100644 --- a/Source/AllProjects/CIDLib/CIDLib_FundQueue.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_FundQueue.hpp @@ -298,22 +298,85 @@ template class TFundQueue : public TFundColBase, public MDuplicable return tRet; } + TBinOutStream& WriteToStream(TBinOutStream& strmToWriteTo) const + { + // Store a stream marker for safety + strmToWriteTo << tCIDLib::EStreamMarkers::StartObject; - protected : - // ------------------------------------------------------------------- - // Declare our friends - // ------------------------------------------------------------------- - friend TBinOutStream& operator<< - ( - TBinOutStream& strmOut - , const TFundQueue& colToStream - ); + // Store the maximum element size + strmToWriteTo << m_c4MaxElements; + + // Write out the current number of elements + const tCIDLib::TCard4 c4CurCount = c4ElemCount(); + strmToWriteTo << c4CurCount; + + // + // NOTE: Because of the wraparound, we cannot do a bulk write + // here, even if the elements are byte sized. + // + tCIDLib::TCard4 c4CurInd = m_c4Head; + while (c4CurInd != m_c4Tail) + { + // Write out the current element + strmToWriteTo << m_ptElements[c4CurInd]; - friend TBinInStream& operator>> - ( - TBinInStream& strmIn - , TFundQueue& colToStream - ); + // Bump the index and wrap around if required + c4CurInd++; + if (c4CurInd == m_c4MaxElements) + c4CurInd = 0; + } + + return strmToWriteTo; + } + TBinInStream& ReadFromStream(TBinInStream& strmToReadFrom) + { + // First we should get a stream marker + strmToReadFrom.CheckForMarker + ( + tCIDLib::EStreamMarkers::StartObject + , CID_FILE + , CID_LINE + ); + + // Get out the new max and count + tCIDLib::TCard4 c4NewCount; + tCIDLib::TCard4 c4NewMax; + strmToReadFrom >> c4NewMax >> c4NewCount; + + // Validate these + if ((c4NewCount > c4NewMax) || !c4NewMax) + { + facCIDLibEarly().ThrowErr + ( + CID_FILE + , CID_LINE + , kCIDErrs::errcFData_BadExtData + , tCIDLib::ESeverities::Failed + , tCIDLib::EErrClasses::Format + ); + } + + // + // If the current max size and the new max size are not the + // same, then reallocate. + // + if (m_c4MaxElements != c4NewMax) + { + delete [] m_ptElements; + m_ptElements = 0; + m_ptElements = new T[c4NewMax]; + m_c4MaxElements = c4NewMax; + } + + // Set the head to zero and the tail to the new count + m_c4Head = 0; + m_c4Tail = c4NewCount; + + // And read in the data + strmToReadFrom.ReadArray(m_ptElements, c4NewCount); + + return strmToReadFrom; + } private : @@ -353,85 +416,14 @@ template class TFundQueue : public TFundColBase, public MDuplicable template TBinInStream& operator>>(TBinInStream& strmToReadFrom, TFundQueue& colToStream) { - // First we should get a stream marker - strmToReadFrom.CheckForMarker - ( - tCIDLib::EStreamMarkers::StartObject - , CID_FILE - , CID_LINE - ); - - // Get out the new max and count - tCIDLib::TCard4 c4NewCount; - tCIDLib::TCard4 c4NewMax; - strmToReadFrom >> c4NewMax >> c4NewCount; - - // Validate these - if ((c4NewCount > c4NewMax) || !c4NewMax) - { - facCIDLib().ThrowErr - ( - CID_FILE - , CID_LINE - , kCIDErrs::errcFData_BadExtData - , tCIDLib::ESeverities::Failed - , tCIDLib::EErrClasses::Format - ); - } - - // - // If the current max size and the new max size are not the - // same, then reallocate. - // - if (colToStream.m_c4MaxElements != c4NewMax) - { - delete [] colToStream.m_ptElements; - colToStream.m_ptElements = 0; - colToStream.m_ptElements = new T[c4NewMax]; - colToStream.m_c4MaxElements = c4NewMax; - } - - // Set the head to zero and the tail to the new count - colToStream.m_c4Head = 0; - colToStream.m_c4Tail = c4NewCount; - - // And read in the data - strmToReadFrom.ReadArray(colToStream.m_ptElements, c4NewCount); - - return strmToReadFrom; + return colToStream.ReadFromStream(strmToReadFrom); } template TBinOutStream& operator<<(TBinOutStream& strmToWriteTo, const TFundQueue& colToStream) { - // Store a stream marker for safety - strmToWriteTo << tCIDLib::EStreamMarkers::StartObject; - - // Store the maximum element size - strmToWriteTo << colToStream.m_c4MaxElements; - - // Write out the current number of elements - const tCIDLib::TCard4 c4CurCount = colToStream.c4ElemCount(); - strmToWriteTo << c4CurCount; - - // - // NOTE: Because of the wraparound, we cannot do a bulk write - // here, even if the elements are byte sized. - // - tCIDLib::TCard4 c4CurInd = colToStream.m_c4Head; - while (c4CurInd != colToStream.m_c4Tail) - { - // Write out the current element - strmToWriteTo << colToStream.m_ptElements[c4CurInd]; - - // Bump the index and wrap around if required - c4CurInd++; - if (c4CurInd == colToStream.m_c4MaxElements) - c4CurInd = 0; - } - - return strmToWriteTo; + return colToStream.WriteToStream(strmToWriteTo); } diff --git a/Source/AllProjects/CIDLib/CIDLib_FundStack.hpp b/Source/AllProjects/CIDLib/CIDLib_FundStack.hpp index b2eac9d1..22007ae4 100644 --- a/Source/AllProjects/CIDLib/CIDLib_FundStack.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_FundStack.hpp @@ -33,6 +33,14 @@ #pragma CIDLIB_PACK(CIDLIBPACK) +template class TFundStack; + +template TBinInStream& +operator>>(TBinInStream& strmToReadFrom, TFundStack& colToStream); + +template TBinOutStream& +operator<<(TBinOutStream& strmToWriteTo, const TFundStack& colToStream); + // ----------------------------------------------------------------------------- // CLASS: TFundStack // PREFIX: fcol @@ -262,77 +270,14 @@ template class TFundStackJan T tValue() const { - return m_fcolStack->tPeek(); + return m_pfcolStack->tPeek(); } private : TFundStackJan(const TFundStackJan&); tCIDLib::TVoid operator=(const TFundStackJan&); + TFundStack* m_pfcolStack; }; #pragma CIDLIB_POPPACK - -template TBinInStream& -operator>>(TBinInStream& strmToReadFrom, TFundStack& colToStream) -{ - // First we should get a stream marker - strmToReadFrom.CheckForMarker - ( - tCIDLib::EStreamMarkers::StartObject - , CID_FILE - , CID_LINE - ); - - // Get out the new max and count - tCIDLib::TCard4 c4NewCount; - tCIDLib::TCard4 c4NewMax; - strmToReadFrom >> c4NewMax >> c4NewCount; - - // Validate these - if ((c4NewCount > c4NewMax) || !c4NewMax) - { - facCIDLib().ThrowErr - ( - CID_FILE - , CID_LINE - , kCIDErrs::errcFData_BadExtData - , tCIDLib::ESeverities::Failed - , tCIDLib::EErrClasses::Format - ); - } - - // - // If the current max size and the new max size are not the - // same, then reallocate. - // - if (colToStream.m_c4MaxElements != c4NewMax) - { - delete [] colToStream.m_ptElements; - colToStream.m_ptElements = 0; - colToStream.m_ptElements = new T[c4NewMax]; - colToStream.m_c4MaxElements = c4NewMax; - } - - // Store the new top - colToStream.m_c4Top = c4NewCount; - - // And read in the elements themselves. - TBinInStream_ReadArray(strmToReadFrom, colToStream.m_ptElements, colToStream.m_c4Top); - return strmToReadFrom; -} - -template TBinOutStream& -operator<<(TBinOutStream& strmToWriteTo, const TFundStack& colToStream) -{ - // Stream out our start marker, max elements and current element count - strmToWriteTo << tCIDLib::EStreamMarkers::StartObject - << colToStream.m_c4MaxElements - << colToStream.m_c4Top; - - // And write out the elements themselves - TBinOutStream_WriteArray(strmToWriteTo, colToStream.m_ptElements, colToStream.m_c4Top); - return strmToWriteTo; -} - - diff --git a/Source/AllProjects/CIDLib/CIDLib_FundStackStrmOps.hpp b/Source/AllProjects/CIDLib/CIDLib_FundStackStrmOps.hpp new file mode 100644 index 00000000..48d9b794 --- /dev/null +++ b/Source/AllProjects/CIDLib/CIDLib_FundStackStrmOps.hpp @@ -0,0 +1,88 @@ +// +// FILE NAME: CIDLib_FundStackStrmOps.hpp +// +// AUTHOR: Dean Roddey +// +// CREATED: 09/25/2020 +// +// COPYRIGHT: Charmed Quark Systems, Ltd @ 2019 +// +// This software is copyrighted by 'Charmed Quark Systems, Ltd' and +// the author (Dean Roddey.) It is licensed under the MIT Open Source +// license: +// +// https://opensource.org/licenses/MIT +// +// DESCRIPTION: +// +// This header implements the stream operators for TFundStack. +// +// CAVEATS/GOTCHAS: +// +// LOG: +// +// $_CIDLib_Log_$ +// + +template TBinInStream& +operator>>(TBinInStream& strmToReadFrom, TFundStack& colToStream) +{ + // First we should get a stream marker + strmToReadFrom.CheckForMarker + ( + tCIDLib::EStreamMarkers::StartObject + , CID_FILE + , CID_LINE + ); + + // Get out the new max and count + tCIDLib::TCard4 c4NewCount; + tCIDLib::TCard4 c4NewMax; + strmToReadFrom >> c4NewMax >> c4NewCount; + + // Validate these + if ((c4NewCount > c4NewMax) || !c4NewMax) + { + facCIDLibEarly().ThrowErr + ( + CID_FILE + , CID_LINE + , kCIDErrs::errcFData_BadExtData + , tCIDLib::ESeverities::Failed + , tCIDLib::EErrClasses::Format + ); + } + + // + // If the current max size and the new max size are not the + // same, then reallocate. + // + if (colToStream.m_c4MaxElements != c4NewMax) + { + delete [] colToStream.m_ptElements; + colToStream.m_ptElements = 0; + colToStream.m_ptElements = new T[c4NewMax]; + colToStream.m_c4MaxElements = c4NewMax; + } + + // Store the new top + colToStream.m_c4Top = c4NewCount; + + // And read in the elements themselves. + TBinInStream_ReadArray(strmToReadFrom, colToStream.m_ptElements, colToStream.m_c4Top); + return strmToReadFrom; +} + +template TBinOutStream& +operator<<(TBinOutStream& strmToWriteTo, const TFundStack& colToStream) +{ + // Stream out our start marker, max elements and current element count + strmToWriteTo << tCIDLib::EStreamMarkers::StartObject + << colToStream.m_c4MaxElements + << colToStream.m_c4Top; + + // And write out the elements themselves + TBinOutStream_WriteArray(strmToWriteTo, colToStream.m_ptElements, colToStream.m_c4Top); + return strmToWriteTo; +} + diff --git a/Source/AllProjects/CIDLib/CIDLib_FundVector.hpp b/Source/AllProjects/CIDLib/CIDLib_FundVector.hpp index 09b90f94..1edf6ae5 100644 --- a/Source/AllProjects/CIDLib/CIDLib_FundVector.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_FundVector.hpp @@ -108,20 +108,7 @@ class TFundVector : public TFundColBase, public MDuplicable *this = tCIDLib::ForceMove(fcolSrc); } - ~TFundVector() - { - try - { - delete [] m_ptElements; - m_ptElements = nullptr; - } - - catch(TError& errToCatch) - { - errToCatch.AddStackLevel(CID_FILE, CID_LINE); - TModule::LogEventObj(errToCatch); - } - } + ~TFundVector(); // ------------------------------------------------------------------- @@ -654,22 +641,43 @@ class TFundVector : public TFundColBase, public MDuplicable return tNotFound; } + TBinOutStream& WriteToStream(TBinOutStream& strmToWriteTo) const + { + // Store a stream marker for safety + strmToWriteTo << tCIDLib::EStreamMarkers::StartObject; - protected : - // ------------------------------------------------------------------- - // Declare our friends - // ------------------------------------------------------------------- - friend TBinOutStream& operator<< - ( - TBinOutStream& strmOut - , const TMyType& colToStream - ); + // Stream out the active element count and then the elements + strmToWriteTo << m_c4CurIndex; + TBinOutStream_WriteArray(strmToWriteTo, m_ptElements, m_c4CurIndex); + return strmToWriteTo; + } + TBinInStream& ReadFromStream(TBinInStream& strmToReadFrom) + { + // First we should get a stream marker + strmToReadFrom.CheckForMarker + ( + tCIDLib::EStreamMarkers::StartObject, CID_FILE, CID_LINE + ); + + // Stream in the stored element count + strmToReadFrom >> m_c4CurIndex; + + // + // If the new count is bigger than our current allocation size, + // we have to reallocate. We don't have to retain old content + // here. + // + if (m_c4CurIndex > m_c4AllocSize) + { + m_c4AllocSize = m_c4CurIndex + 32; + delete [] m_ptElements; + m_ptElements = new TElem[m_c4AllocSize]; + } - friend TBinInStream& operator>> - ( - TBinInStream& strmIn - , TMyType& colToStream - ); + // And read in the stored elements + TBinInStream_ReadArray(strmToReadFrom, m_ptElements, m_c4CurIndex); + return strmToReadFrom; + } private : @@ -741,41 +749,12 @@ class TFundVector : public TFundColBase, public MDuplicable template TBinInStream& operator>>(TBinInStream& strmToReadFrom, TFundVector& colToStream) { - // First we should get a stream marker - strmToReadFrom.CheckForMarker - ( - tCIDLib::EStreamMarkers::StartObject, CID_FILE, CID_LINE - ); - - // Stream in the stored element count - strmToReadFrom >> colToStream.m_c4CurIndex; - - // - // If the new count is bigger than our current allocation size, - // we have to reallocate. We don't have to retain old content - // here. - // - if (colToStream.m_c4CurIndex > colToStream.m_c4AllocSize) - { - colToStream.m_c4AllocSize = colToStream.m_c4CurIndex + 32; - delete [] colToStream.m_ptElements; - colToStream.m_ptElements = new TElem[colToStream.m_c4AllocSize]; - } - - // And read in the stored elements - TBinInStream_ReadArray(strmToReadFrom, colToStream.m_ptElements, colToStream.m_c4CurIndex); - return strmToReadFrom; + return colToStream.ReadFromStream(strmToReadFrom); } template TBinOutStream& operator<<(TBinOutStream& strmToWriteTo, const TFundVector& colToStream) { - // Store a stream marker for safety - strmToWriteTo << tCIDLib::EStreamMarkers::StartObject; - - // Stream out the active element count and then the elements - strmToWriteTo << colToStream.m_c4CurIndex; - TBinOutStream_WriteArray(strmToWriteTo, colToStream.m_ptElements, colToStream.m_c4CurIndex); - return strmToWriteTo; + return colToStream.WriteToStream(strmToWriteTo); } diff --git a/Source/AllProjects/CIDLib/CIDLib_FundVectorDestructor.hpp b/Source/AllProjects/CIDLib/CIDLib_FundVectorDestructor.hpp new file mode 100644 index 00000000..0aa9330d --- /dev/null +++ b/Source/AllProjects/CIDLib/CIDLib_FundVectorDestructor.hpp @@ -0,0 +1,46 @@ +// +// FILE NAME: CIDLib_FundVectorDestructor.hpp +// +// AUTHOR: Dean Roddey +// +// CREATED: 09/25/2020 +// +// COPYRIGHT: Charmed Quark Systems, Ltd @ 2019 +// +// This software is copyrighted by 'Charmed Quark Systems, Ltd' and +// the author (Dean Roddey.) It is licensed under the MIT Open Source +// license: +// +// https://opensource.org/licenses/MIT +// +// DESCRIPTION: +// +// This header defines the destructor of TFundVector. +// Since this depends on TError it has to be included after the rest +// of the class. +// +// CAVEATS/GOTCHAS: +// +// LOG: +// +// $_CIDLib_Log_$ +// +#pragma once + + +template +TFundVector::~TFundVector() +{ + try + { + delete [] m_ptElements; + m_ptElements = nullptr; + } + + catch(TError& errToCatch) + { + errToCatch.AddStackLevel(CID_FILE, CID_LINE); + TModule::LogEventObj(errToCatch); + } +} + diff --git a/Source/AllProjects/CIDLib/CIDLib_GenCacheItem.cpp b/Source/AllProjects/CIDLib/CIDLib_GenCacheItem.cpp index 494c9822..f740d730 100644 --- a/Source/AllProjects/CIDLib/CIDLib_GenCacheItem.cpp +++ b/Source/AllProjects/CIDLib/CIDLib_GenCacheItem.cpp @@ -274,7 +274,8 @@ tCIDLib::TVoid TCIDGenCacheItem::UpdateTimeStamp(const tCIDLib::TCard4 c4SecsFro // Generate a semi-random starting serial number tCIDLib::TCard4 TCIDGenCacheItem::c4GenInitSerialNum() { - tCIDLib::TCard4 c4Ret = tCIDLib::TCard4(TTime::enctNow() & 0xFFFFFFFF); + tCIDLib::TEncodedTime enctNow = TTime::enctNow(); + tCIDLib::TCard4 c4Ret = reinterpret_cast(enctNow); if (!c4Ret) c4Ret++; diff --git a/Source/AllProjects/CIDLib/CIDLib_HashMap.hpp b/Source/AllProjects/CIDLib/CIDLib_HashMap.hpp index 8f520c00..a555c5d9 100644 --- a/Source/AllProjects/CIDLib/CIDLib_HashMap.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_HashMap.hpp @@ -113,7 +113,7 @@ template class THashMapNode TPair& kobjPair(const TPair& kobjToSet) { - m_kobjPair = objToSet; + m_kobjPair = kobjToSet; return m_kobjPair; } @@ -205,7 +205,7 @@ template class THashMap // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : + template class TConstCursor : public TBiColCursor { @@ -226,7 +226,7 @@ template class THashMap { TBaseLock lockInit; if (!pclsThis) - pclsThis = new TClass(L"THashMap::TConstCursor"); + pclsThis = new TClass(L"THashMap::TConstCursor"); } return *pclsThis; } @@ -427,7 +427,7 @@ template class THashMap // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; private : @@ -454,15 +454,15 @@ template class THashMap }; - template class TNonConstCursor : + template class TNonConstCursor : - public TConstCursor + public TConstCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TConstCursor; + using TParent = TConstCursor; // ----------------------------------------------------------- // Public, static methods @@ -474,7 +474,7 @@ template class THashMap { TBaseLock lockInit; if (!pclsThis) - pclsThis = new TClass(L"THashMap::TNonConstCursor"); + pclsThis = new TClass(L"THashMap::TNonConstCursor"); } return *pclsThis; } @@ -755,7 +755,7 @@ template class THashMap TLocker lockrSrc(&colSrc); TLocker lockrThis(this); - TParent::operator=(tCIDLib::ForceMove(colSrc)); + TMapCollection::operator=(tCIDLib::ForceMove(colSrc)); // // We swap the element content. This has to include the modulus @@ -1259,8 +1259,8 @@ template class THashMap // ------------------------------------------------------------------- // Declare our friends // ------------------------------------------------------------------- - friend class TCursor; - friend class TNCCursor; + friend TCursor; + friend TNCCursor; // ------------------------------------------------------------------- @@ -1519,10 +1519,10 @@ TBinOutStream& operator<<( TBinOutStream& strmOut << colToStream.c4HashModulus(); // If there were any elements, then stream them - THashMap::TCursor cursOut(&colToStream); + typename THashMap::TCursor cursOut(&colToStream); while (cursOut.bIsValid()) { - const THashMap::TPair& kobjCur = cursOut.objRCur(); + const typename THashMap::TPair& kobjCur = cursOut.objRCur(); strmOut << kobjCur.objKey() << kobjCur.objValue(); ++cursOut; } @@ -1568,7 +1568,7 @@ TBinInStream& operator>>(TBinInStream& strmIn for (tCIDLib::TCard4 c4Index = 0; c4Index < c4Count; c4Index++) { strmIn >> objKey >> objValue; - colToStream.objAdd(THashMap::TPair(objKey, objValue)); + colToStream.objAdd(typename THashMap::TPair(objKey, objValue)); } } diff --git a/Source/AllProjects/CIDLib/CIDLib_HashSet.hpp b/Source/AllProjects/CIDLib/CIDLib_HashSet.hpp index d9d05d2b..c525401f 100644 --- a/Source/AllProjects/CIDLib/CIDLib_HashSet.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_HashSet.hpp @@ -184,15 +184,15 @@ template class THashSet : public TCollection class TConstCursor + template class TConstCursor - : public TBiColCursor + : public TBiColCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TBiColCursor; + using TParent = TBiColCursor; // ----------------------------------------------------------- @@ -205,7 +205,7 @@ template class THashSet : public TCollection"); + pclsThis = new TClass(L"THashSet::TConstCursor"); } return *pclsThis; } @@ -378,7 +378,7 @@ template class THashSet : public TCollectionCheckInitialized(CID_FILE, CID_LINE); @@ -424,7 +424,7 @@ template class THashSet : public TCollection class THashSet : public TCollection class TNonConstCursor + template class TNonConstCursor - : public TConstCursor + : public TConstCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TConstCursor; + using TParent = TConstCursor; // ----------------------------------------------------------- @@ -499,7 +499,7 @@ template class THashSet : public TCollection"); + pclsThis = new TClass(L"THashSet::TNonConstCursor"); } return *pclsThis; } @@ -544,20 +544,20 @@ template class THashSet : public TCollectionCheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &const_cast(this->pnodeCur()->objData()); + return &const_cast(this->pnodeCur()->objData()); } // ----------------------------------------------------------- @@ -584,14 +584,14 @@ template class THashSet : public TCollectionCheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } @@ -599,7 +599,7 @@ template class THashSet : public TCollection::TCursor cursOut(&colToStream); + typename THashSet::TCursor cursOut(&colToStream); for (; cursOut; ++cursOut) strmOut << *cursOut; diff --git a/Source/AllProjects/CIDLib/CIDLib_KeyOps.hpp b/Source/AllProjects/CIDLib/CIDLib_KeyOps.hpp index 33426437..7037c210 100644 --- a/Source/AllProjects/CIDLib/CIDLib_KeyOps.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_KeyOps.hpp @@ -119,11 +119,7 @@ template class TNumKeyOps tCIDLib::TBoolean bCompKeys(const T& t1 , const T& t2) const { - if (t1 < t2) - return tCIDLib::ESortComps::FirstLess; - else if (t1 > t2) - return tCIDLib::ESortComps::FirstGreater; - return tCIDLib::ESortComps::Equal; + return t1 == t2; } tCIDLib::THashVal hshKey(const T& tVal, const tCIDLib::TCard4 c4Modulus) const diff --git a/Source/AllProjects/CIDLib/CIDLib_KeyedHashSet.hpp b/Source/AllProjects/CIDLib/CIDLib_KeyedHashSet.hpp index f989b5ed..89857c28 100644 --- a/Source/AllProjects/CIDLib/CIDLib_KeyedHashSet.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_KeyedHashSet.hpp @@ -185,15 +185,15 @@ class TKeyedHashSet : public TCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : + template class TConstCursor : - public TBiColCursor + public TBiColCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TBiColCursor; + using TParent = TBiColCursor; // ----------------------------------------------------------- @@ -205,7 +205,7 @@ class TKeyedHashSet : public TCollection if (!pclsThis) { TBaseLock lockInit; - pclsThis = new TClass(L"TKeyedHashSet::TConstCursor"); + pclsThis = new TClass(L"TKey2edHashSet::TConstCursor"); } return *pclsThis; } @@ -391,7 +391,7 @@ class TKeyedHashSet : public TCollection return TParent::clsThis(); } - const TElem& objRCur() const override + const TElem2& objRCur() const override { this->CheckInitialized(CID_FILE, CID_LINE); @@ -438,7 +438,7 @@ class TKeyedHashSet : public TCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; // ----------------------------------------------------------- @@ -492,14 +492,14 @@ class TKeyedHashSet : public TCollection }; - template class TNonConstCursor : - public TConstCursor + template class TNonConstCursor : + public TConstCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TConstCursor; + using TParent = TConstCursor; // ----------------------------------------------------------- // Public, static methods @@ -510,7 +510,7 @@ class TKeyedHashSet : public TCollection if (!pclsThis) { TBaseLock lockInit; - pclsThis = new TClass(L"TKeyedHashSet::TNonConstCursor"); + pclsThis = new TClass(L"TKey2edHashSet::TNonConstCursor"); } return *pclsThis; } @@ -556,20 +556,20 @@ class TKeyedHashSet : public TCollection } - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &const_cast(this->pnodeCur()->objData()); + return &const_cast(this->pnodeCur()->objData()); } TNonConstCursor& operator++() @@ -610,7 +610,7 @@ class TKeyedHashSet : public TCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); @@ -618,7 +618,7 @@ class TKeyedHashSet : public TCollection TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } @@ -626,7 +626,7 @@ class TKeyedHashSet : public TCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; // ----------------------------------------------------------- @@ -1449,7 +1449,7 @@ class TKeyedHashSet : public TCollection if (!m_kopsToUse.bCompKeys( m_pfnKeyExtract(pnodeRep->objData()) , m_pfnKeyExtract(objNewValue))) { - facCIDLib().ThrowErr + facCIDLibEarly().ThrowErr ( CID_FILE , CID_LINE @@ -1801,7 +1801,7 @@ TBinOutStream& operator<<( TBinOutStream& strmOut << colToStream.c4HashModulus(); // If there were any elements, then stream them - TKeyedHashSet::TCursor cursOut(&colToStream); + typename TKeyedHashSet::TCursor cursOut(&colToStream); while (cursOut.bIsValid()) { strmOut << cursOut.objRCur(); diff --git a/Source/AllProjects/CIDLib/CIDLib_NamedValMap.hpp b/Source/AllProjects/CIDLib/CIDLib_NamedValMap.hpp index db44de48..34bfc890 100644 --- a/Source/AllProjects/CIDLib/CIDLib_NamedValMap.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_NamedValMap.hpp @@ -74,7 +74,7 @@ template class TNamedValMap : public TObject using TMyType = TNamedValMap; using TPair = TKeyObjPair; - template class TNVMItem + template class TNVMItem { public : // ----------------------------------------------------------- @@ -131,7 +131,7 @@ template class TNamedValMap : public TObject // Public, non-virtual methods // ----------------------------------------------------------- tCIDLib::TBoolean bAddValue(const TString& strSubKey - , const TVal& objToSet) + , const TVal2& objToSet) { // If it already exists, then don't do it const TPair* pkobjTar = m_colPairs.pobjFindByKey(strSubKey); @@ -149,7 +149,7 @@ template class TNamedValMap : public TObject } tCIDLib::TBoolean - bQueryValue(const TString& strSubKey, TVal& objToFill) const + bQueryValue(const TString& strSubKey, TVal2& objToFill) const { // If this subkey doesn't exist, we fail const TPair* pkobjTar = m_colPairs.pobjFindByKey(strSubKey); @@ -171,7 +171,7 @@ template class TNamedValMap : public TObject } tCIDLib::TBoolean bSetValue(const TString& strSubKey - , const TVal& objValToSet) + , const TVal2& objValToSet) { // If the sub-key doesn't exist, we fail TPair* pkobjTar = m_colPairs.pobjFindByKey(strSubKey); @@ -208,7 +208,7 @@ template class TNamedValMap : public TObject return m_strKey; } - TVal* pobjValue(const TString& strSubKey) + TVal2* pobjValue(const TString& strSubKey) { // If the sub-key doesn't exist, return nul for failiure TPair* pkobjRet = m_colPairs.pobjFindByKey(strSubKey); @@ -217,7 +217,7 @@ template class TNamedValMap : public TObject return &pkobjRet->objValue(); } - const TVal* pobjValue(const TString& strSubKey) const + const TVal2* pobjValue(const TString& strSubKey) const { // If the sub-key doesn't exist, return null for failure const TPair* pkobjRet = m_colPairs.pobjFindByKey(strSubKey); @@ -286,8 +286,8 @@ template class TNamedValMap : public TObject tCIDLib::TBoolean operator==(const TNamedValMap& nvmSrc) const { - TItemList::TCursor cursThis(&m_colItems); - TItemList::TCursor cursSrc(&nvmSrc.m_colItems); + typename TItemList::TCursor cursThis(&m_colItems); + typename TItemList::TCursor cursSrc(&nvmSrc.m_colItems); if (c4ElemCount() != nvmSrc.c4ElemCount()) return kCIDLib::False; @@ -657,15 +657,15 @@ operator<<(TBinOutStream& strmToWriteTo, const TNamedValMap& nvmToWrite) << tCIDLib::TCard4(c4Count ^ kCIDLib::c4MaxCard); // Iterate through the items and write them out - TNamedValMap::TItemList::TCursor cursItems(&nvmToWrite.colItems()); + typename TNamedValMap::TItemList::TCursor cursItems(&nvmToWrite.colItems()); while (cursItems.bIsValid()) { // Each one should start with a start object strmToWriteTo << tCIDLib::EStreamMarkers::StartObject; // Get the current item and get a cursor over it's pairs - const TNamedValMap::TNVMItem& nvmiCur = cursItems.objRCur(); - TNamedValMap::TNVMItem::TPairList::TCursor cursSubs(&nvmiCur.colPairs()); + const typename TNamedValMap::TNVMItem& nvmiCur = cursItems.objRCur(); + typename TNamedValMap::TNVMItem::TPairList::TCursor cursSubs(&nvmiCur.colPairs()); // Write out the key and the count of sub-keys strmToWriteTo << nvmiCur.strKey() @@ -678,7 +678,7 @@ operator<<(TBinOutStream& strmToWriteTo, const TNamedValMap& nvmToWrite) // Each one should start with a frame marker, followed // by the key and the value object // - const TNamedValMap::TPair& kobjCur + const typename TNamedValMap::TPair& kobjCur ( cursSubs.objRCur() ); diff --git a/Source/AllProjects/CIDLib/CIDLib_ObjLocker.hpp b/Source/AllProjects/CIDLib/CIDLib_ObjLocker.hpp index 693865c2..a4dd54a7 100644 --- a/Source/AllProjects/CIDLib/CIDLib_ObjLocker.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_ObjLocker.hpp @@ -130,7 +130,7 @@ template class TObjLock // ------------------------------------------------------------------- // Declare our friends // ------------------------------------------------------------------- - template friend class TObjLocker; + template friend class TObjLocker; // ------------------------------------------------------------------- diff --git a/Source/AllProjects/CIDLib/CIDLib_PolyStreamer.hpp b/Source/AllProjects/CIDLib/CIDLib_PolyStreamer.hpp index 1ebcd225..d7fd6d1d 100644 --- a/Source/AllProjects/CIDLib/CIDLib_PolyStreamer.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_PolyStreamer.hpp @@ -240,7 +240,7 @@ template class TPolyStreamer : public TObject // Make sure its a legal record type if (c1RecordType != tCIDLib::TCard1(0xEA)) { - facCIDLib().ThrowErr + facCIDLibEarly().ThrowErr ( CID_FILE , CID_LINE @@ -264,7 +264,7 @@ template class TPolyStreamer : public TObject // if (bNewClass && (c2NextId != c2NewId)) { - facCIDLib().ThrowErr + facCIDLibEarly().ThrowErr ( CID_FILE , CID_LINE @@ -395,7 +395,7 @@ template class TPolyStreamer : public TObject } // This should never happen - facCIDLib().ThrowErr + facCIDLibEarly().ThrowErr ( CID_FILE , CID_LINE diff --git a/Source/AllProjects/CIDLib/CIDLib_PubSub.cpp b/Source/AllProjects/CIDLib/CIDLib_PubSub.cpp index 044a8dc5..5fa52aaf 100644 --- a/Source/AllProjects/CIDLib/CIDLib_PubSub.cpp +++ b/Source/AllProjects/CIDLib/CIDLib_PubSub.cpp @@ -130,7 +130,7 @@ static tCIDLib::TVoid ScavengePubs() // calling topic must lock across the whole send operation, so that no one else // is modifying the subscriber list. // -static tCIDLib::TVoid SendMsg( const tCIDLib::TCard4 c4SubId +tCIDLib::TVoid SendMsg( const tCIDLib::TCard4 c4SubId , const TPubSubMsg& psmsgToSend) { // diff --git a/Source/AllProjects/CIDLib/CIDLib_PubSub.hpp b/Source/AllProjects/CIDLib/CIDLib_PubSub.hpp index 2f80a3dc..5aede42b 100644 --- a/Source/AllProjects/CIDLib/CIDLib_PubSub.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_PubSub.hpp @@ -209,13 +209,13 @@ class CIDLIBEXP MPubSubscription // ------------------------------------------------------------------- // Declare friends // ------------------------------------------------------------------- - friend static tCIDLib::TVoid SendMsg + friend tCIDLib::TVoid SendMsg ( const tCIDLib::TCard4 c4SubId , const TPubSubMsg& psmsgToSend ); - friend static tCIDLib::ESortComps eCompSubId + friend tCIDLib::ESortComps eCompSubId ( const tCIDLib::TCard4& c4ToComp , const MPubSubscription& mpsubToComp @@ -376,7 +376,7 @@ class CIDLIBEXP TPubSubTopic : public TObject // internally, and let the internal scavenger call have access to our // our subscription object. // ------------------------------------------------------------------- - friend static tCIDLib::TVoid DoScavenge(); + friend tCIDLib::TVoid DoScavenge(); friend class MPubSubscription; diff --git a/Source/AllProjects/CIDLib/CIDLib_Queue.hpp b/Source/AllProjects/CIDLib/CIDLib_Queue.hpp index e8dccb28..f1182dbb 100644 --- a/Source/AllProjects/CIDLib/CIDLib_Queue.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_Queue.hpp @@ -164,13 +164,13 @@ template class TQueue : public TCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : public TBiColCursor + template class TConstCursor : public TBiColCursor { public : // ----------------------------------------------------------- // Constructors and Destructor // ----------------------------------------------------------- - TConstCursor() : + TConstCursor() : m_pcolCursoring(nullptr) , m_pllstCursoring(nullptr) @@ -185,7 +185,7 @@ template class TQueue : public TCollection , m_pllstCursoring(&pcolToCursor->llstQueue()) , m_pnodeCur(nullptr) { - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -268,7 +268,7 @@ template class TQueue : public TCollection this->CheckSerialNum(m_pcolCursoring->c4SerialNum(), CID_FILE, CID_LINE); if (!m_pnodeCur) return kCIDLib::False; - m_pnodeCur = static_cast*>(m_pnodeCur->pnodeNext()); + m_pnodeCur = static_cast*>(m_pnodeCur->pnodeNext()); return (m_pnodeCur != nullptr); } @@ -280,7 +280,7 @@ template class TQueue : public TCollection this->CheckSerialNum(m_pcolCursoring->c4SerialNum(), CID_FILE, CID_LINE); if (!m_pnodeCur) return kCIDLib::False; - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pnodeCur->pnodePrev() ); @@ -293,7 +293,7 @@ template class TQueue : public TCollection TLocker lockrCol(m_pcolCursoring); this->c4SerialNum(m_pcolCursoring->c4SerialNum()); - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeTail() ); @@ -305,7 +305,7 @@ template class TQueue : public TCollection this->CheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolCursoring); - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -313,7 +313,7 @@ template class TQueue : public TCollection return (m_pnodeCur != nullptr); } - const TElem& objRCur() const final + const TElem2& objRCur() const final { this->CheckInitialized(CID_FILE, CID_LINE); @@ -344,7 +344,7 @@ template class TQueue : public TCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; private : @@ -372,13 +372,13 @@ template class TQueue : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TConstCursor - , TBiColCursor + TMyType::TConstCursor + , TBiColCursor ) }; - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -428,20 +428,20 @@ template class TQueue : public TCollection // Can't actually delete it since that causes problems // TNonConstCursor& operator=(TNonConstCursor&&) = delete; - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &const_cast(this->pnodeCur()->objData()); + return &const_cast(this->pnodeCur()->objData()); } TNonConstCursor& operator++() @@ -461,7 +461,7 @@ template class TQueue : public TCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); @@ -469,7 +469,7 @@ template class TQueue : public TCollection TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } @@ -489,8 +489,8 @@ template class TQueue : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TNonConstCursor - , TMyType::TConstCursor + TMyType::TNonConstCursor + , TMyType::TConstCursor ) }; diff --git a/Source/AllProjects/CIDLib/CIDLib_RTTI.hpp b/Source/AllProjects/CIDLib/CIDLib_RTTI.hpp index 06511c87..f31141f3 100644 --- a/Source/AllProjects/CIDLib/CIDLib_RTTI.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_RTTI.hpp @@ -99,7 +99,7 @@ const TClass& Class::clsThis() \ #define AdvRTTIDecls(Class,ParentClass) \ [[nodiscard]] TObject* pMakeNew_##Class() {return new Class;} \ -__pragma (warning(suppress : 26426)) \ +_Pragma("warning(suppress : 26426)") \ static const TTypeFactoryKicker Class##Kicker(CIDLib_MakeLStr2(Class), pMakeNew_##Class); \ const TClass& Class::clsThis() \ { \ diff --git a/Source/AllProjects/CIDLib/CIDLib_RefKeyedHashSet.hpp b/Source/AllProjects/CIDLib/CIDLib_RefKeyedHashSet.hpp index 01ca96bf..7bacfa46 100644 --- a/Source/AllProjects/CIDLib/CIDLib_RefKeyedHashSet.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_RefKeyedHashSet.hpp @@ -193,15 +193,15 @@ class TRefKeyedHashSet : public TRefCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : + template class TConstCursor : - public TBiColCursor + public TBiColCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TBiColCursor; + using TParent = TBiColCursor; // ----------------------------------------------------------- @@ -213,7 +213,7 @@ class TRefKeyedHashSet : public TRefCollection if (!pclsThis) { TBaseLock lockInit; - pclsThis = new TClass(L"TRefKeyedHashSet::TConstCursor"); + pclsThis = new TClass(L"TRefKeyedHashSet::TConstCursor"); } return *pclsThis; } @@ -405,7 +405,7 @@ class TRefKeyedHashSet : public TRefCollection return TParent::clsThis(); } - const TElem& objRCur() const final + const TElem2& objRCur() const final { this->CheckInitialized(CID_FILE, CID_LINE); @@ -452,7 +452,7 @@ class TRefKeyedHashSet : public TRefCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; // ----------------------------------------------------------- @@ -502,15 +502,15 @@ class TRefKeyedHashSet : public TRefCollection }; - template class TNonConstCursor : + template class TNonConstCursor : - public TConstCursor + public TConstCursor { public : // ----------------------------------------------------------- // Public types // ----------------------------------------------------------- - using TParent = TConstCursor; + using TParent = TConstCursor; // ----------------------------------------------------------- @@ -522,7 +522,7 @@ class TRefKeyedHashSet : public TRefCollection if (!pclsThis) { TBaseLock lockInit; - pclsThis = new TClass(L"TRefKeyedHashSet::TNonConstCursor"); + pclsThis = new TClass(L"TRefKeyedHashSet::TNonConstCursor"); } return *pclsThis; } @@ -573,20 +573,20 @@ class TRefKeyedHashSet : public TRefCollection // Can't actually delete it since that causes problems // TNonConstCursor& operator=(TNonConstCursor&&) = delete; - TElem& operator*() const + TElem2& operator*() const { TLocker lockCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &const_cast(this->pnodeCur()->objData()); + return &const_cast(this->pnodeCur()->objData()); } TNonConstCursor& operator++() @@ -627,14 +627,14 @@ class TRefKeyedHashSet : public TRefCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); TLocker lockCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->objData()); + return const_cast(this->pnodeCur()->objData()); } @@ -642,7 +642,7 @@ class TRefKeyedHashSet : public TRefCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; // ----------------------------------------------------------- diff --git a/Source/AllProjects/CIDLib/CIDLib_RefQueue.hpp b/Source/AllProjects/CIDLib/CIDLib_RefQueue.hpp index f7ed5e39..4548698a 100644 --- a/Source/AllProjects/CIDLib/CIDLib_RefQueue.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_RefQueue.hpp @@ -157,7 +157,7 @@ template class TRefQueue : public TRefCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : public TBiColCursor + template class TConstCursor : public TBiColCursor { public : // ----------------------------------------------------------- @@ -178,7 +178,7 @@ template class TRefQueue : public TRefCollection , m_pllstCursoring(&pcolToCursor->llstQueue()) , m_pnodeCur(nullptr) { - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -254,7 +254,7 @@ template class TRefQueue : public TRefCollection this->CheckSerialNum(m_pcolCursoring->c4SerialNum(), CID_FILE, CID_LINE); if (!m_pnodeCur) return kCIDLib::False; - m_pnodeCur = static_cast*>(m_pnodeCur->pnodeNext()); + m_pnodeCur = static_cast*>(m_pnodeCur->pnodeNext()); return (m_pnodeCur != nullptr); } @@ -266,7 +266,7 @@ template class TRefQueue : public TRefCollection this->CheckSerialNum(m_pcolCursoring->c4SerialNum(), CID_FILE, CID_LINE); if (!m_pnodeCur) return kCIDLib::False; - m_pnodeCur = static_cast*>(m_pnodeCur->pnodePrev()); + m_pnodeCur = static_cast*>(m_pnodeCur->pnodePrev()); return (m_pnodeCur != nullptr); } @@ -276,7 +276,7 @@ template class TRefQueue : public TRefCollection TLocker lockrCol(m_pcolCursoring); this->c4SerialNum(m_pcolCursoring->c4SerialNum()); - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeTail() ); @@ -288,7 +288,7 @@ template class TRefQueue : public TRefCollection this->CheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolCursoring); - m_pnodeCur = static_cast*> + m_pnodeCur = static_cast*> ( m_pllstCursoring->pnodeHead() ); @@ -296,7 +296,7 @@ template class TRefQueue : public TRefCollection return (m_pnodeCur != nullptr); } - const TElem& objRCur() const final + const TElem2& objRCur() const final { this->CheckInitialized(CID_FILE, CID_LINE); @@ -330,7 +330,7 @@ template class TRefQueue : public TRefCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; private : @@ -356,10 +356,10 @@ template class TRefQueue : public TRefCollection // ----------------------------------------------------------- // Do any needed magic macros // ----------------------------------------------------------- - TemplateRTTIDefs(TMyType::TConstCursor, TBiColCursor) + TemplateRTTIDefs(TMyType::TConstCursor, TBiColCursor) }; - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -403,20 +403,20 @@ template class TRefQueue : public TRefCollection return *this; } - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return *const_cast(this->pnodeCur()->pobjData()); + return *const_cast(this->pnodeCur()->pobjData()); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return const_cast(this->pnodeCur()->pobjData()); + return const_cast(this->pnodeCur()->pobjData()); } TNonConstCursor& operator++() @@ -436,14 +436,14 @@ template class TRefQueue : public TRefCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return *const_cast(this->pnodeCur()->pobjData()); + return *const_cast(this->pnodeCur()->pobjData()); } @@ -463,8 +463,8 @@ template class TRefQueue : public TRefCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TNonConstCursor - , TMyType::TConstCursor + TMyType::TNonConstCursor + , TMyType::TConstCursor ) }; @@ -977,8 +977,8 @@ template class TRefQueue : public TRefCollection // ------------------------------------------------------------------- // Declare our friends // ------------------------------------------------------------------- - friend class TConstCursor; - friend class TNonConstCursor; + friend TConstCursor; + friend TNonConstCursor; // ------------------------------------------------------------------- diff --git a/Source/AllProjects/CIDLib/CIDLib_RefSortedBag.hpp b/Source/AllProjects/CIDLib/CIDLib_RefSortedBag.hpp index 336fc5d1..31f69a08 100644 --- a/Source/AllProjects/CIDLib/CIDLib_RefSortedBag.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_RefSortedBag.hpp @@ -139,7 +139,7 @@ template class TRefSortedBag : public TRefBag // than if descending) the new object. We then insert the new // element before it. // - TBasicDLinkedRefCol::TCursor cursAdd(this); + typename TBasicDLinkedRefCol::TCursor cursAdd(this); while (cursAdd) { if (m_eDir == tCIDLib::ESortDirs::Ascending) diff --git a/Source/AllProjects/CIDLib/CIDLib_RefVector.hpp b/Source/AllProjects/CIDLib/CIDLib_RefVector.hpp index 94f72e86..d42db3c4 100644 --- a/Source/AllProjects/CIDLib/CIDLib_RefVector.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_RefVector.hpp @@ -66,7 +66,7 @@ class TRefVector : public TRefCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : public TBiColCursor + template class TConstCursor : public TBiColCursor { public : // ----------------------------------------------------------- @@ -201,7 +201,7 @@ class TRefVector : public TRefCollection return bIsValid(); } - const TElem& objRCur() const final + const TElem2& objRCur() const final { this->CheckInitialized(CID_FILE, CID_LINE); @@ -216,7 +216,7 @@ class TRefVector : public TRefCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; // ----------------------------------------------------------- @@ -257,13 +257,13 @@ class TRefVector : public TRefCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TConstCursor - , TBiColCursor + TMyType::TConstCursor + , TBiColCursor ) }; - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -283,7 +283,7 @@ class TRefVector : public TRefCollection } // We have to lock first, so we can't use member init! - TNonConstCursor(const TNonConstCursor& cursSrc) + TNonConstCursor(const TNonConstCursor& cursSrc) { operator=(cursSrc); } @@ -305,23 +305,23 @@ class TRefVector : public TRefCollection return *this; } - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return *static_cast + return *static_cast ( m_pcolNCCursoring->pobjAt(TIndex(this->i4CurIndex())) ); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return static_cast + return static_cast ( m_pcolNCCursoring->pobjAt(TIndex(this->i4CurIndex())) ); @@ -344,14 +344,14 @@ class TRefVector : public TRefCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return *static_cast + return *static_cast ( m_pcolNCCursoring->pobjAt(TIndex(this->i4CurIndex())) ); @@ -373,8 +373,8 @@ class TRefVector : public TRefCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TNonConstCursor - , TMyType::TConstCursor + TMyType::TNonConstCursor + , TMyType::TConstCursor ) }; @@ -609,7 +609,7 @@ class TRefVector : public TRefCollection return kCIDLib::True; } - template > + template > tCIDLib::TBoolean bAddIfNew(const TElem& objToAdd, TComp pfnComp = TComp()) { TLocker lockrThis(this); @@ -644,7 +644,7 @@ class TRefVector : public TRefCollection // it is, you can do much better by doing a binary search and removing it // yourself by located index. // - template > + template > tCIDLib::TBoolean bRemoveIfMember(const TElem& objToRemove, TComp pfnComp = TComp()) { diff --git a/Source/AllProjects/CIDLib/CIDLib_SearchNSort.hpp b/Source/AllProjects/CIDLib/CIDLib_SearchNSort.hpp index 7f8db70a..fe2bdfca 100644 --- a/Source/AllProjects/CIDLib/CIDLib_SearchNSort.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_SearchNSort.hpp @@ -1516,7 +1516,7 @@ namespace TArrayOps } - template > + template > tCIDLib::TBoolean bSearch( const TElem* const ptElems , const TKey tToFind , tCIDLib::TCard4& c4Index diff --git a/Source/AllProjects/CIDLib/CIDLib_SmartPointer.hpp b/Source/AllProjects/CIDLib/CIDLib_SmartPointer.hpp index 58a1e1c0..eb15d5df 100644 --- a/Source/AllProjects/CIDLib/CIDLib_SmartPointer.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_SmartPointer.hpp @@ -250,10 +250,10 @@ template class TUniquePtr // We need a base class to hold our object and a derived class that can hold // a deleter. Our base class is the default and just calls delete on it. // ------------------------------------------------------------------- - template struct TDataPtr + template struct TDataPtr { public : - TDataPtr(T* const pobjAdopt) : m_pobjData(pobjAdopt) {} + TDataPtr(T2* const pobjAdopt) : m_pobjData(pobjAdopt) {} virtual ~TDataPtr() {} virtual tCIDLib::TVoid DestroyData() @@ -261,14 +261,14 @@ template class TUniquePtr delete m_pobjData; } - T* m_pobjData; + T2* m_pobjData; }; - template struct TDataPtrDel : public TDataPtr + template struct TDataPtrDel : public TDataPtr { - TDataPtrDel(T* const pobjAdopt, TDeleter fnDelete) : + TDataPtrDel(T2* const pobjAdopt, TDeleter fnDelete) : - TDataPtr(pobjAdopt) + TDataPtr(pobjAdopt) , m_fnDeleter(fnDelete) { } @@ -856,7 +856,7 @@ template class TCntPtr // ------------------------------------------------------------------- // Friend declaration // ------------------------------------------------------------------- - template friend class TWeakPtr; + template friend class TWeakPtr; // ------------------------------------------------------------------- @@ -1344,28 +1344,28 @@ template class TMemberPtr // We need a base class to hold our object and a derived class that can hold // a deleter. Our base class is the default and just called delete on it. // ------------------------------------------------------------------- - template struct TDataPtr + template struct TDataPtr { - TDataPtr(T* const pobjAdopt) : m_pobjData(pobjAdopt) {} - virtual TDataPtr* pdpDuplicate() = 0; + TDataPtr(T2* const pobjAdopt) : m_pobjData(pobjAdopt) {} + virtual TDataPtr* pdpDuplicate() = 0; virtual tCIDLib::TVoid DestroyData() = 0; - T* m_pobjData; + T2* m_pobjData; }; - template - struct TDataPtrDefDC : public TDataPtr + template + struct TDataPtrDefDC : public TDataPtr { - TDataPtrDefDC(T* const pobjAdopt) : TDataPtr(pobjAdopt) + TDataPtrDefDC(T2* const pobjAdopt) : TDataPtr(pobjAdopt) { } // Duplicate ourself and our contained data - [[nodiscard]] TDataPtr* pdpDuplicate() final + [[nodiscard]] TDataPtr* pdpDuplicate() final { - return new TDataPtrDefDC + return new TDataPtrDefDC ( - this->m_pobjData ? new T(*this->m_pobjData) : nullptr + this->m_pobjData ? new T2(*this->m_pobjData) : nullptr ); } @@ -1375,21 +1375,21 @@ template class TMemberPtr } }; - template - struct TDataPtrCustDC : public TDataPtr + template + struct TDataPtrCustDC : public TDataPtr { - TDataPtrCustDC(T* const pobjAdopt, TCopier fnCopy, TDeleter fnDelete) : + TDataPtrCustDC(T2* const pobjAdopt, TCopier fnCopy, TDeleter fnDelete) : - TDataPtr(pobjAdopt) + TDataPtr(pobjAdopt) , m_fnCopier(fnCopy) , m_fnDeleter(fnDelete) { } // Duplicate ourself and our contained data - [[nodiscard]] TDataPtr* pdpDuplicate() final + [[nodiscard]] TDataPtr* pdpDuplicate() final { - return new TDataPtrCustDC + return new TDataPtrCustDC ( this->m_pobjData ? m_fnCopier(this->m_pobjData) : nullptr , m_fnCopier diff --git a/Source/AllProjects/CIDLib/CIDLib_SortedBag.hpp b/Source/AllProjects/CIDLib/CIDLib_SortedBag.hpp index 2e0f6199..bbc2101f 100644 --- a/Source/AllProjects/CIDLib/CIDLib_SortedBag.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_SortedBag.hpp @@ -137,7 +137,7 @@ template class TSortedBag : public TBasicDLinkedCol return this->objAddAtTop(objNew); // If the cursor is invalid, it will go at the end - TParType::TCursor cursAt = cursFindInsert(objNew); + typename TParType::TCursor cursAt = cursFindInsert(objNew); TElem& objRet = this->objInsertAfter(objNew, cursAt); // Invalidate any cursors @@ -170,7 +170,7 @@ template class TSortedBag : public TBasicDLinkedCol return this->objAddAtTop(objNew); // If the cursor is invalid, it will go at the end - TParType::TCursor cursAt = cursFindInsert(objNew); + typename TParType::TCursor cursAt = cursFindInsert(objNew); TElem& objRet = this->objInsertAfter(tCIDLib::ForceMove(objNew), cursAt); // Invalidate any cursors @@ -196,7 +196,7 @@ template class TSortedBag : public TBasicDLinkedCol // If the cursor is invalid, it will go at the end TElem objNew(tCIDLib::Forward(Args)...); - TParType::TCursor cursAt(cursFindInsert(objNew)); + typename TParType::TCursor cursAt(cursFindInsert(objNew)); TElem& objRet = this->objInsertAfter(objNew, cursAt); // Invalidate any cursors @@ -210,9 +210,9 @@ template class TSortedBag : public TBasicDLinkedCol // ------------------------------------------------------------------- // Find the insertion point for a new object // ------------------------------------------------------------------- - TBasicDLinkedCol::TCursor cursFindInsert(const TElem& objNew) + typename TBasicDLinkedCol::TCursor cursFindInsert(const TElem& objNew) { - TBasicDLinkedCol::TCursor cursRet(this); + typename TBasicDLinkedCol::TCursor cursRet(this); // // Find the position to put the new element at. We just iterate diff --git a/Source/AllProjects/CIDLib/CIDLib_String.cpp b/Source/AllProjects/CIDLib/CIDLib_String.cpp index b908c80d..509fc600 100644 --- a/Source/AllProjects/CIDLib/CIDLib_String.cpp +++ b/Source/AllProjects/CIDLib/CIDLib_String.cpp @@ -2875,7 +2875,7 @@ TString::CopyInSubStr( const TString& strSource AppendSubStr(strSource, c4Start, c4Len); } -inline tCIDLib::TVoid +tCIDLib::TVoid TString::CopyOutSubStr( TString& strTarget , const tCIDLib::TCard4 c4Start , const tCIDLib::TCard4 c4Len) const @@ -4203,7 +4203,7 @@ tCIDLib::TVoid TString::Prepend(const TString& strPrepend) Insert(strPrepend, 0); } -inline tCIDLib::TVoid TString::Prepend(const tCIDLib::TCh* const pszPrepend) +tCIDLib::TVoid TString::Prepend(const tCIDLib::TCh* const pszPrepend) { Insert(pszPrepend, 0); } diff --git a/Source/AllProjects/CIDLib/CIDLib_TextOutStream.cpp b/Source/AllProjects/CIDLib/CIDLib_TextOutStream.cpp index f8f0de96..f6331f5a 100644 --- a/Source/AllProjects/CIDLib/CIDLib_TextOutStream.cpp +++ b/Source/AllProjects/CIDLib/CIDLib_TextOutStream.cpp @@ -1117,3 +1117,31 @@ const TBinOutStream& TTextOutStream::strmOut() const return *m_pstrmOut; } + +// --------------------------------------------------------------------------- +// TStreamJanitor: Constructors and Destructor +// --------------------------------------------------------------------------- +TStreamJanitor::TStreamJanitor(TTextOutStream* const pstrmToSanitize) : + m_pstrmToSanitize(pstrmToSanitize) + , m_strmfSave() +{ + if (m_pstrmToSanitize) + m_strmfSave.SetFrom(*pstrmToSanitize); +} + +TStreamJanitor::~TStreamJanitor() +{ + if (m_pstrmToSanitize) + m_pstrmToSanitize->SetFormat(m_strmfSave); +} + + + +// --------------------------------------------------------------------------- +// TStreamJanitor: Public, non-virtual methods +// --------------------------------------------------------------------------- +const TStreamFmt& TStreamJanitor::strmfSaved() const +{ + return m_strmfSave; +} + diff --git a/Source/AllProjects/CIDLib/CIDLib_TextOutStream.hpp b/Source/AllProjects/CIDLib/CIDLib_TextOutStream.hpp index 126857e2..9139519d 100644 --- a/Source/AllProjects/CIDLib/CIDLib_TextOutStream.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_TextOutStream.hpp @@ -46,6 +46,59 @@ #pragma CIDLIB_PACK(CIDLIBPACK) +class TTextOutStream; + + +// --------------------------------------------------------------------------- +// CLASS: TStreamJanitor +// PREFIX: jan +// --------------------------------------------------------------------------- +class CIDLIBEXP TStreamJanitor +{ + public : + // ------------------------------------------------------------------- + // Constructors and Destructor + // ------------------------------------------------------------------- + TStreamJanitor() = delete; + + TStreamJanitor(TTextOutStream* const pstrmToSanitize); + + TStreamJanitor(const TStreamJanitor&) = delete; + TStreamJanitor(TStreamJanitor&&) = delete; + + ~TStreamJanitor(); + + + // ------------------------------------------------------------------- + // Public operators + // ------------------------------------------------------------------- + TStreamJanitor& operator=(const TStreamJanitor&) = delete; + TStreamJanitor& operator=(TStreamJanitor&&) = delete; + tCIDLib::TVoid* operator new(size_t) = delete; + + + // ------------------------------------------------------------------- + // Public, non-virtual methods + // ------------------------------------------------------------------- + const TStreamFmt& strmfSaved() const; + + + private : + // ------------------------------------------------------------------- + // Private data members + // + // m_pstrmToSanitize + // This is the pointer to the text out stream we are providing + // janitorial services for. + // + // m_strmfSave + // This is the saved stream format state to be restored. + // ------------------------------------------------------------------- + TTextOutStream* m_pstrmToSanitize; + TStreamFmt m_strmfSave; +}; + + // --------------------------------------------------------------------------- // CLASS: TTextOutStream @@ -630,71 +683,6 @@ class CIDLIBEXP TTextOutStream : public TObject -// --------------------------------------------------------------------------- -// CLASS: TStreamJanitor -// PREFIX: jan -// --------------------------------------------------------------------------- -class CIDLIBEXP TStreamJanitor -{ - public : - // ------------------------------------------------------------------- - // Constructors and Destructor - // ------------------------------------------------------------------- - TStreamJanitor() = delete; - - #pragma warning(suppress : 26429) // It can legally be null - TStreamJanitor(TTextOutStream* const pstrmToSanitize) : - - m_pstrmToSanitize(pstrmToSanitize) - , m_strmfSave() - { - if (m_pstrmToSanitize) - m_strmfSave.SetFrom(*pstrmToSanitize); - } - - TStreamJanitor(const TStreamJanitor&) = delete; - TStreamJanitor(TStreamJanitor&&) = delete; - - ~TStreamJanitor() - { - if (m_pstrmToSanitize) - m_pstrmToSanitize->SetFormat(m_strmfSave); - } - - - // ------------------------------------------------------------------- - // Public operators - // ------------------------------------------------------------------- - TStreamJanitor& operator=(const TStreamJanitor&) = delete; - TStreamJanitor& operator=(TStreamJanitor&&) = delete; - tCIDLib::TVoid* operator new(size_t) = delete; - - - // ------------------------------------------------------------------- - // Public, non-virtual methods - // ------------------------------------------------------------------- - const TStreamFmt& strmfSaved() const - { - return m_strmfSave; - } - - - private : - // ------------------------------------------------------------------- - // Private data members - // - // m_pstrmToSanitize - // This is the pointer to the text out stream we are providing - // janitorial services for. - // - // m_strmfSave - // This is the saved stream format state to be restored. - // ------------------------------------------------------------------- - TTextOutStream* m_pstrmToSanitize; - TStreamFmt m_strmfSave; -}; - - // --------------------------------------------------------------------------- // CLASS: TStreamIndentJan // PREFIX: jan diff --git a/Source/AllProjects/CIDLib/CIDLib_Vector.hpp b/Source/AllProjects/CIDLib/CIDLib_Vector.hpp index ea853491..bfef4f07 100644 --- a/Source/AllProjects/CIDLib/CIDLib_Vector.hpp +++ b/Source/AllProjects/CIDLib/CIDLib_Vector.hpp @@ -61,7 +61,7 @@ class TVector : public TCollection // ------------------------------------------------------------------- // Our nested cursor classes // ------------------------------------------------------------------- - template class TConstCursor : public TBiColCursor + template class TConstCursor : public TBiColCursor { public : // ----------------------------------------------------------- @@ -118,13 +118,13 @@ class TVector : public TCollection return !TConstCursor::operator==(cursSrc); } - TConstCursor& operator++() + TConstCursor& operator++() { this->bNext(); return *this; } - TConstCursor operator++(int) + TConstCursor operator++(int) { TConstCursor cursTmp(*this); this->bNext(); @@ -196,7 +196,7 @@ class TVector : public TCollection return bIsValid(); } - const TElem& objRCur() const final + const TElem2& objRCur() const final { this->CheckInitialized(CID_FILE, CID_LINE); @@ -212,7 +212,7 @@ class TVector : public TCollection // ----------------------------------------------------------- // Declare our friends // ----------------------------------------------------------- - friend class TMyType; + friend TMyType; // ----------------------------------------------------------- @@ -247,11 +247,11 @@ class TVector : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TConstCursor, TBiColCursor + TMyType::TConstCursor, TBiColCursor ) }; - template class TNonConstCursor : public TConstCursor + template class TNonConstCursor : public TConstCursor { public : // ----------------------------------------------------------- @@ -293,35 +293,35 @@ class TVector : public TCollection return *this; } - TElem& operator*() const + TElem2& operator*() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return static_cast + return static_cast ( m_pcolNCCursoring->objAt(TIndex(this->i4CurIndex())) ); } - TElem* operator->() const + TElem2* operator->() const { TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return &static_cast + return &static_cast ( m_pcolNCCursoring->objAt(TIndex(this->i4CurIndex())) ); } - TNonConstCursor& operator++() + TNonConstCursor& operator++() { this->bNext(); return *this; } - TNonConstCursor operator++(int) + TNonConstCursor operator++(int) { TNonConstCursor cursTmp(*this); this->bNext(); @@ -332,14 +332,14 @@ class TVector : public TCollection // ----------------------------------------------------------- // Public, non-virtual methods // ----------------------------------------------------------- - TElem& objWCur() const + TElem2& objWCur() const { this->CheckInitialized(CID_FILE, CID_LINE); TLocker lockrCol(m_pcolNCCursoring); this->CheckSerialNum(m_pcolNCCursoring->c4SerialNum(), CID_FILE, CID_LINE); this->CheckValid(this->bIsValid(), CID_FILE, CID_LINE); - return static_cast + return static_cast ( m_pcolNCCursoring->objAt(TIndex(this->i4CurIndex())) ); @@ -364,8 +364,8 @@ class TVector : public TCollection // ----------------------------------------------------------- TemplateRTTIDefs ( - TMyType::TNonConstCursor - , TMyType::TConstCursor + TMyType::TNonConstCursor + , TMyType::TConstCursor ) }; @@ -703,7 +703,7 @@ class TVector : public TCollection // you'd do a lot better yourself doing a binary search and adding if not // found. // - template > + template > tCIDLib::TBoolean bAddIfNew(const TElem& objToAdd, TComp pfnComp = TComp()) { TLocker lockrThis(this); @@ -727,7 +727,7 @@ class TVector : public TCollection // sorted. If it is, you can do better by doing a binary search and // removing it yourself. // - template > + template > tCIDLib::TBoolean bRemoveIfMember(const TElem& objToRemove, TComp pfnComp = TComp()) { diff --git a/Source/AllProjects/Tests/TestCIDLib/TestCIDLib_CommonCollect.hpp b/Source/AllProjects/Tests/TestCIDLib/TestCIDLib_CommonCollect.hpp index f463a607..fb3f9e77 100644 --- a/Source/AllProjects/Tests/TestCIDLib/TestCIDLib_CommonCollect.hpp +++ b/Source/AllProjects/Tests/TestCIDLib/TestCIDLib_CommonCollect.hpp @@ -59,7 +59,7 @@ TestColBasics( TTextOutStream& strmOut } // Get a cursor and check the elements - TCol::TNCCursor cursTest(&colToTest); + typename TCol::TNCCursor cursTest(&colToTest); if (cursTest.c4ElemCount() != c4InitialCount) strmOut << CUR_LN << L"Element count not correct via cursor" << kCIDLib::NewLn; @@ -69,7 +69,7 @@ TestColBasics( TTextOutStream& strmOut strmOut << CUR_LN << L"Cursor reset failed" << kCIDLib::NewLn; // Create aanother cursor to test invalidation - TCol::TCursor cursTest2(&colToTest); + typename TCol::TCursor cursTest2(&colToTest); // // Delete the first element. We have to reset the cursor, which leaves it diff --git a/Source/AllProjects/Tests/TestKernel/TestKernel_Environment.cpp b/Source/AllProjects/Tests/TestKernel/TestKernel_Environment.cpp index 0a515e1a..f3feecf1 100644 --- a/Source/AllProjects/Tests/TestKernel/TestKernel_Environment.cpp +++ b/Source/AllProjects/Tests/TestKernel/TestKernel_Environment.cpp @@ -129,7 +129,7 @@ static tCIDLib::TVoid SpecialTests() const tCIDLib::TCard4 c4OrgLen = kstrTmp1.c4Length(); // A simple test path to add - TKrnlString kstrAdd(kCIDLib::szPathSep, L"Test"); + TKrnlString kstrAdd(kCIDLib::pszPathSep, L"Test"); // Append and prepend a path to it if (!TKrnlEnvironment::bAddToLibPath(kstrAdd.pszValue(), tCIDLib::EStartEnd::End))