本文整理汇总了C++中OBJLIST::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ OBJLIST::insert方法的具体用法?C++ OBJLIST::insert怎么用?C++ OBJLIST::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBJLIST
的用法示例。
在下文中一共展示了OBJLIST::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Nudge_AddAccount
void Nudge_AddAccount(PROTOACCOUNT *proto)
{
char str[MAXMODULELABELLENGTH + 10];
mir_snprintf(str, "%s/Nudge", proto->szModuleName);
HANDLE hevent = HookEvent(str, NudgeReceived);
if (hevent == NULL)
return;
nProtocol++;
// Add a specific sound per protocol
CNudgeElement *p = new CNudgeElement();
mir_snprintf(p->NudgeSoundname, "%s: Nudge", proto->szModuleName);
strcpy_s(p->ProtocolName, proto->szModuleName);
_tcscpy_s(p->AccountName, proto->tszAccountName);
p->Load();
p->hEvent = hevent;
TCHAR soundDesc[MAXMODULELABELLENGTH + 10];
mir_sntprintf(soundDesc, LPGENT("Nudge for %s"), proto->tszAccountName);
SkinAddNewSoundExT(p->NudgeSoundname, LPGENT("Nudge"), soundDesc);
arNudges.insert(p);
}
示例2: fclose
MIR_CORE_DLL(HANDLE) mir_createLog(const char* pszName, const TCHAR *ptszDescr, const TCHAR *ptszFile, unsigned options)
{
if (ptszFile == NULL)
return NULL;
Logger *result = new Logger(pszName, ptszDescr, ptszFile, options);
if (result == NULL)
return NULL;
int idx = arLoggers.getIndex(result);
if (idx != -1) {
delete result;
return &arLoggers[idx];
}
FILE *fp = _tfopen(ptszFile, _T("ab"));
if (fp == NULL) {
TCHAR tszPath[MAX_PATH];
_tcsncpy_s(tszPath, ptszFile, _TRUNCATE);
CreatePathToFileT(tszPath);
}
else fclose(fp);
DeleteFile(ptszFile);
arLoggers.insert(result);
return result;
}
示例3: CallMainThread
void CallMainThread(MirApcFunc func, void* param)
{
WaitForSingleObject(hApcMutex, INFINITE);
APCCallQueue.insert(new APCCall(func, param));
ReleaseMutex(hApcMutex);
PostMessage(hAPCWindow, WM_NULL, 0, 0);
}
示例4: getCacheItem
// преобразует mode в HICON который НЕ НУЖНО разрушать в конце
static ICON_CACHE& getCacheItem(int mode, int type)
{
int m = mode & 0x0f, s = (mode & SECURED)>>4, i; // разобрали на части - режим и состояние
HICON icon;
for (i=0; i < arIcoList.getCount(); i++)
if (arIcoList[i].mode == ((type<<8) | mode))
return arIcoList[i];
i = s;
switch(type) {
case 1: i += IEC_CL_DIS; break;
case 2: i += ICO_CM_DIS; break;
case 3: i += ICO_MW_DIS; break;
}
if (type == 1)
icon = BindOverlayIcon(g_hIEC[i], g_hICO[ICO_OV_NAT+m]);
else
icon = BindOverlayIcon(g_hICO[i], g_hICO[ICO_OV_NAT+m]);
ICON_CACHE *p = new ICON_CACHE;
p->icon = icon;
p->mode = (type << 8) | mode;
p->hCLIcon = NULL;
arIcoList.insert(p);
return *p;
}
示例5: getContactCache
CContactCache* CContactCache::getContactCache(HANDLE hContact)
{
CContactCache *cc = arContacts.find((CContactCache*)&hContact);
if (cc == NULL) {
cc = new CContactCache(hContact);
arContacts.insert(cc);
}
return cc;
}
示例6: InitTimeZones
void InitTimeZones(void)
{
REG_TZI_FORMAT tzi;
HKEY hKey;
const TCHAR *tszKey = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones");
/*
* use GetDynamicTimeZoneInformation() on Vista+ - this will return a structure with
* the registry key name, so finding our own time zone later will be MUCH easier for
* localized systems or systems with a MUI pack installed
*/
if (IsWinVerVistaPlus())
pfnGetDynamicTimeZoneInformation = (pfnGetDynamicTimeZoneInformation_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetDynamicTimeZoneInformation");
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, tszKey, 0, KEY_ENUMERATE_SUB_KEYS, &hKey)) {
DWORD dwIndex = 0;
HKEY hSubKey;
TCHAR tszName[MIM_TZ_NAMELEN];
DWORD dwSize = _countof(tszName);
while (ERROR_NO_MORE_ITEMS != RegEnumKeyEx(hKey, dwIndex++, tszName, &dwSize, NULL, NULL, 0, NULL)) {
if (ERROR_SUCCESS == RegOpenKeyEx(hKey, tszName, 0, KEY_QUERY_VALUE, &hSubKey)) {
dwSize = sizeof(tszName);
DWORD dwLength = sizeof(tzi);
if (ERROR_SUCCESS != RegQueryValueEx(hSubKey, _T("TZI"), NULL, NULL, (unsigned char *)&tzi, &dwLength))
continue;
MIM_TIMEZONE *tz = new MIM_TIMEZONE;
tz->tzi.Bias = tzi.Bias;
tz->tzi.StandardDate = tzi.StandardDate;
tz->tzi.StandardBias = tzi.StandardBias;
tz->tzi.DaylightDate = tzi.DaylightDate;
tz->tzi.DaylightBias = tzi.DaylightBias;
mir_tstrcpy(tz->tszName, tszName);
tz->hash = mir_hashstrT(tszName);
tz->offset = INT_MIN;
GetLocalizedString(hSubKey, _T("Display"), tz->szDisplay, _countof(tz->szDisplay));
GetLocalizedString(hSubKey, _T("Std"), tz->tzi.StandardName, _countof(tz->tzi.StandardName));
GetLocalizedString(hSubKey, _T("Dlt"), tz->tzi.DaylightName, _countof(tz->tzi.DaylightName));
g_timezones.insert(tz);
g_timezonesBias.insert(tz);
RegCloseKey(hSubKey);
}
dwSize = _countof(tszName);
}
RegCloseKey(hKey);
}
RecalculateTime();
}
示例7: xpt_AddThemeHandle
XPTHANDLE xpt_AddThemeHandle(HWND hwnd, LPCWSTR className)
{
mir_cslock lck(xptCS);
XPTObject* xptObject = new XPTObject;
xptObject->lpcwClassObject = className;
xptObject->hOwnerWindow = hwnd;
_sttXptReloadThemeData(xptObject);
xptObjectList.insert(xptObject);
return (XPTHANDLE)xptObject;
}
示例8: AddProtoIconIndex
static void AddProtoIconIndex(PROTOACCOUNT *pa)
{
ProtoIconIndex *pii = new ProtoIconIndex;
pii->szProto = pa->szModuleName;
for (int i = 0; i < _countof(statusModeList); i++) {
int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i]);
if (i == 0)
pii->iIconBase = iImg;
}
protoIconIndex.insert(pii);
}
示例9: SetChatTimer
void CIrcProto::SetChatTimer(UINT_PTR &nIDEvent,UINT uElapse, TIMERPROC lpTimerFunc)
{
if (nIDEvent)
KillChatTimer(nIDEvent);
nIDEvent = SetTimer( NULL, NULL, uElapse, lpTimerFunc);
EnterCriticalSection( &timers_cs );
timers.insert( new TimerPair( this, nIDEvent ));
LeaveCriticalSection( &timers_cs );
}
示例10: xpt_AddThemeHandle
XPTHANDLE xpt_AddThemeHandle(HWND hwnd, LPCWSTR className)
{
XPTHANDLE res = NULL;
xptlock();
{
XPTObject* xptObject = new XPTObject;
xptObject->lpcwClassObject = className;
xptObject->hOwnerWindow = hwnd;
_sttXptReloadThemeData(xptObject);
xptObjectList.insert(xptObject);
res = (XPTHANDLE)xptObject;
}
xptunlock();
return res;
}
示例11: QueueAdd
static void QueueAdd(MCONTACT hContact, int waitTime)
{
if (fei == NULL || g_shutDown)
return;
mir_cslock lck(cs);
// Only add if not exists yet
for (int i = queue.getCount() - 1; i >= 0; i--)
if (queue[i].hContact == hContact)
return;
QueueItem *item = new QueueItem;
item->hContact = hContact;
item->check_time = GetTickCount() + waitTime;
queue.insert(item);
}
示例12: FindProto
static ProtoInfo* FindProto(const char *proto)
{
ProtoInfo *p = arProtos.find((ProtoInfo*)&proto);
if (p)
return p;
HICON hIcon = LoadSkinnedProtoIcon(proto, ID_STATUS_ONLINE);
if (hIcon == NULL)
return NULL;
HANDLE hImage = ExtraIcon_Add(hIcon);
if (hImage == INVALID_HANDLE_VALUE)
return NULL;
p = new ProtoInfo(proto, hImage);
arProtos.insert(p);
return p;
}
示例13: GetSmileyFile
bool GetSmileyFile(CMString& url, const CMString& packstr)
{
_TPattern *urlsplit = _TPattern::compile(_T(".*/(.*)"));
_TMatcher *m0 = urlsplit->createTMatcher(url);
m0->findFirstMatch();
CMString filename;
filename.AppendFormat(_T("%s\\%s\\"), cachepath, packstr.c_str());
int pathpos = filename.GetLength();
filename += m0->getGroup(1);
delete m0;
delete urlsplit;
bool needext = filename.Find('.') == -1;
if (needext)
filename += _T(".*");
_tfinddata_t c_file;
INT_PTR hFile = _tfindfirst((TCHAR*)filename.c_str(), &c_file);
if (hFile > -1) {
_findclose(hFile);
filename.Truncate(pathpos);
filename += c_file.name;
url = filename;
return false;
}
if (needext)
filename.Truncate(filename.GetLength() - 1);
WaitForSingleObject(g_hDlMutex, 3000);
dlQueue.insert(new QueueElem(url, filename, needext));
ReleaseMutex(g_hDlMutex);
if (!threadRunning) {
threadRunning = true;
mir_forkthread(SmileyDownloadThread, NULL);
}
url = filename;
return false;
}
示例14: AddCacheImage
ImageBase* AddCacheImage(const CMString& file, int index)
{
CMString tmpfile(file); tmpfile.AppendFormat(_T("#%d"), index);
unsigned id = mir_hash(tmpfile.c_str(), tmpfile.GetLength() * sizeof(TCHAR));
WaitForSingleObject(g_hMutexIm, 3000);
ImageBase srch(id);
ImageBase *img = g_imagecache.find(&srch);
if (img == NULL) {
int ind = file.ReverseFind('.');
if (ind == -1)
return NULL;
CMString ext = file.Mid(ind+1);
ext.MakeLower();
if (ext == _T("dll") || ext == _T("exe"))
img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, index, icoDll) : (ImageBase*)new IconType(id, file, index, icoDll);
else if (ext == _T("ico"))
img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, 0, icoFile) : (ImageBase*)new IconType(id, file, 0, icoFile);
else if (ext == _T("icl"))
img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, index, icoIcl) : (ImageBase*)new IconType(id, file, index, icoIcl);
else if (ext == _T("gif"))
img = new ImageType(id, file, NULL);
else if (fei == NULL || ext == _T("tif") || ext == _T("tiff"))
img = new ImageType(id, file, NULL);
else
img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, NULL) : (ImageBase*)new ImageFType(id, file);
g_imagecache.insert(img);
if (timerId == 0) {
timerId = 0xffffffff;
CallFunctionAsync(sttMainThreadCallback, NULL);
}
}
else img->AddRef();
ReleaseMutex(g_hMutexIm);
return img;
}
示例15: VoiceRegister
static INT_PTR VoiceRegister(WPARAM wParam, LPARAM lParam)
{
VOICE_MODULE *in = (VOICE_MODULE *) wParam;
if (in == NULL || in->cbSize < sizeof(VOICE_MODULE) || in->name == NULL || in->description == NULL)
return -1;
if (FindModule(in->name) != NULL)
return -2;
if (!ProtoServiceExists(in->name, PS_VOICE_CALL)
|| !ProtoServiceExists(in->name, PS_VOICE_ANSWERCALL)
|| !ProtoServiceExists(in->name, PS_VOICE_DROPCALL))
return -3;
modules.insert(new VoiceProvider(in->name, in->description, in->flags, in->icon));
if (hwnd_frame != NULL)
PostMessage(hwnd_frame, WMU_REFRESH, 0, 0);
return 0;
}