void CLoader::CLoaderListener::Reset(const CHAR** pcPaths, UINT uCount) { ALCHEMY_DEBUG_DELETE_ARRAY(m_puDataIndices); m_uDataCount = uCount; CVector<UINT> Indices; Indices.Add(0); m_IndexMap.Clear(); CVector<UINT>* pIndices; for(UINT i = 0; i < uCount; ++ i) { pIndices = m_IndexMap.Get(pcPaths[i]); if(pIndices) pIndices->Add(i); else { Indices.Set(i, 0); m_IndexMap.Insert(pcPaths[i], Indices); } } m_uLoadedCount = 0; }
bool CDomainNameService :: WalkHostent( struct hostent * hp, CVector<CString>& PeerAddresses, CVector<CString>& PeerAliases) { Trace(tagDns, levInfo, ("CDnsPeer :: WalkHostEnt - entering.")); if (! hp) return false; for (char ** l_P = hp->h_addr_list; * l_P != 0; l_P++) { struct in_addr l_IN; memcpy(&l_IN.s_addr, *l_P, sizeof (l_IN.s_addr)); PeerAddresses.Add(inet_ntoa(l_IN)); } PeerAliases.Add(hp->h_name); for (char ** l_Q = hp->h_aliases; * l_Q != 0; l_Q++) { PeerAliases.Add((char *) * l_Q); } Trace(tagDns, levInfo, ("CDnsPeer :: WalkHostEnt - leaving with %d addresses and %d aliases.", PeerAddresses.GetSize(), PeerAliases.GetSize())); return true; }
void CSceneListener::RegisterRenderGroup( CSceneManager& SceneManager, IRenderGroup& RenderGroup ) { CVector<IRenderGroup*>* pRenderGroups = m_RenderGroupsMap.Get(&SceneManager); if(pRenderGroups) { UINT uIndex; if( !pRenderGroups->GetIndexOf(uIndex, &RenderGroup) ) { RenderGroup.AddRef(); pRenderGroups->Add(&RenderGroup); } } else { static CVector<IRenderGroup*> s_EmptyGroups; m_RenderGroupsMap.Insert(&SceneManager, s_EmptyGroups); pRenderGroups = m_RenderGroupsMap.Get(&SceneManager); RenderGroup.AddRef(); pRenderGroups->Add(&RenderGroup); UINT uEventType; if( ALCHEMY_GET_EVENT_TYPE(uEventType, RESET_SCENE, CSceneManager) ) SceneManager.AddEventListener(uEventType, *this); } }
bool SIMPLEAPI SlxEnumProfileSections(const wchar_t* pszSection, CVector<CUniString>& vec) { if (g_bFileBased) { CProfileSection* pSection=g_ProfileFile.FindSection(pszSection); for (int i=0; i<pSection->GetSubSectionCount(); i++) { vec.Add(pSection->GetSubSection(i)->GetName()); } return true; } else { return RegEnumAllKeys(HKEY_CURRENT_USER, SlxGetProfileKey(pszSection), vec)==ERROR_SUCCESS; } }
// Split a command line, removing quotes as we go... void SIMPLEAPI SplitCommandLine(const wchar_t* pszCommandLine, CVector<CUniString>& Args) { const wchar_t* p=pszCommandLine; while (p[0]) { // Skip white space while (iswspace(p[0])) p++; // Read next argument, handling quoted strings CUniString strArg; bool bInQuotes=false; while (p[0] && (!iswspace(p[0]) || bInQuotes)) { if (p[0]==L'\"') { if (p[1]==L'\"') { strArg+=L"\""; p++; } else { bInQuotes=!bInQuotes; } } else { // Append character strArg.Append(p,1); } p++; } // Only interested in non-blank args if (!strArg.IsEmpty()) Args.Add(strArg); } }
bool SIMPLEAPI SlxEnumProfileValues(const wchar_t* pszSection, CVector<CUniString>& vec) { if (g_bFileBased) { CProfileSection* pSection=g_ProfileFile.FindSection(pszSection); if (pSection) { for (int i=0; i<pSection->GetSize(); i++) { vec.Add(pSection->GetAt(i)->GetName()); } } return true; } else { CSmartHandle<HKEY> Key; if (RegCreateKey(HKEY_CURRENT_USER, Format(L"Software\\%s\\%s\\%s", g_strCompanyName, g_strAppName, pszSection), &Key)!=ERROR_SUCCESS) return false; return RegEnumAllValues(HKEY_CURRENT_USER, SlxGetProfileKey(pszSection), vec)==ERROR_SUCCESS; } }
/* load a vector of vectors of strings */ bool CIndexManager::LoadStringVectorVector(const CString& FileName, CVector< CVector<CString> >& Target, bool Verbose) { Target.RemoveAll(); CMMapFile FastFile(FileName); if (! FastFile.MMap(MMAP_READOPENMODE)) return false; long fSize = FastFile.GetSize(); if (fSize && FastFile.GetMem()) { m_Progress.Init(10, Verbose); CString Line; while (FastFile.ReadLine(&Line) >= 0) { if (g_pHandler->GetSignalSigterm()) return false; m_Progress.Show(FastFile.GetOffset(), fSize, Verbose); CVector<CString> TmpVector; CString::StrToVector(Line, '\t', &TmpVector); Target.Add(TmpVector); } m_Progress.Finish(Verbose); } cout << "[" << Target.GetSize() << " lines]" << endl; return true; }