本文整理汇总了C++中LIST类的典型用法代码示例。如果您正苦于以下问题:C++ LIST类的具体用法?C++ LIST怎么用?C++ LIST使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LIST类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadNewPluginsModule
int LoadNewPluginsModule(void)
{
TCHAR exe[MAX_PATH];
TCHAR* slice;
pluginEntry* p;
pluginEntry* clist = NULL;
int useWhiteList, i;
bool msgModule = false;
// make full path to the plugin
GetModuleFileName(NULL, exe, SIZEOF(exe));
slice = _tcsrchr(exe, '\\');
if (slice) *slice = 0;
// remember some useful options
askAboutIgnoredPlugins=(UINT) GetPrivateProfileInt( _T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
// if Crash Dumper is present, load it to provide Crash Reports
if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname))
{
if ( pluginList_crshdmp->bpi.Load(&pluginCoreLink) == 0 )
pluginList_crshdmp->pclass |= PCLASS_LOADED | PCLASS_LAST;
else
Plugin_Uninit( pluginList_crshdmp );
}
// if freeimage is present, load it to provide the basic core functions
if ( pluginList_freeimg != NULL ) {
BASIC_PLUGIN_INFO bpi;
mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\Plugins\\%s"), pluginList_freeimg->pluginname);
if ( checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE, NULL) ) {
pluginList_freeimg->bpi = bpi;
pluginList_freeimg->pclass |= PCLASS_OK | PCLASS_BASICAPI;
if ( bpi.Load(&pluginCoreLink) == 0 )
pluginList_freeimg->pclass |= PCLASS_LOADED;
else
Plugin_Uninit( pluginList_freeimg );
} }
// first load the clist cos alot of plugins need that to be present at Load()
for ( useWhiteList = 1; useWhiteList >= 0 && clist == NULL; useWhiteList-- )
clist=getCListModule(exe, slice, useWhiteList);
/* the loop above will try and get one clist DLL to work, if all fail then just bail now */
if ( clist == NULL ) {
// result = 0, no clist_* can be found
if ( pluginListUI )
MessageBox(NULL, TranslateT("Unable to start any of the installed contact list plugins, I even ignored your preferences for which contact list couldn't load any."), _T("Miranda IM"), MB_OK | MB_ICONINFORMATION);
else
MessageBox(NULL, TranslateT("Can't find a contact list plugin! you need clist_classic or any other clist plugin.") , _T("Miranda IM"), MB_OK | MB_ICONINFORMATION);
return 1;
}
/* enable and disable as needed */
p = pluginListUI;
while ( p != NULL ) {
SetPluginOnWhiteList(p->pluginname, clist != p ? 0 : 1 );
p = p->nextclass;
}
/* now loop thru and load all the other plugins, do this in one pass */
for ( i=0; i < pluginList.getCount(); i++ ) {
p = pluginList[i];
CharLower(p->pluginname);
if (!(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST)))
{
if (isPluginOnWhiteList(p->pluginname))
{
BASIC_PLUGIN_INFO bpi;
mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\Plugins\\%s"), p->pluginname);
if ( checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE, NULL) ) {
int rm = bpi.pluginInfo->replacesDefaultModule;
p->bpi = bpi;
p->pclass |= PCLASS_OK | PCLASS_BASICAPI;
if ( pluginDefModList[rm] == NULL ) {
pluginListAddr.insert( p );
if ( bpi.Load(&pluginCoreLink) == 0 ) {
p->pclass |= PCLASS_LOADED;
msgModule |= (bpi.pluginInfo->replacesDefaultModule == DEFMOD_SRMESSAGE);
}
else {
Plugin_Uninit( p );
i--;
}
if ( rm ) pluginDefModList[rm]=p;
} //if
else {
SetPluginOnWhiteList( p->pluginname, 0 );
Plugin_Uninit( p );
i--;
}
}
else p->pclass |= PCLASS_FAILED;
}
else {
Plugin_Uninit( p );
i--;
}
}
else if ( p->bpi.hInst != NULL )
//.........这里部分代码省略.........
示例2: ExtraIcon_Register
INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
{
if (wParam == 0)
return 0;
EXTRAICON_INFO *ei = (EXTRAICON_INFO *)wParam;
if (ei->cbSize < (int)sizeof(EXTRAICON_INFO))
return 0;
if (ei->type != EXTRAICON_TYPE_CALLBACK && ei->type != EXTRAICON_TYPE_ICOLIB)
return 0;
if (IsEmpty(ei->name) || IsEmpty(ei->description))
return 0;
if (ei->type == EXTRAICON_TYPE_CALLBACK && (ei->ApplyIcon == NULL || ei->RebuildIcons == NULL))
return 0;
ptrT tszDesc(mir_a2t(ei->description));
TCHAR *desc = TranslateTH(lParam, tszDesc);
BaseExtraIcon *extra = GetExtraIconByName(ei->name);
if (extra != NULL) {
if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_ICOLIB)
return 0;
// Found one, now merge it
if (_tcsicmp(extra->getDescription(), desc)) {
CMString newDesc = extra->getDescription();
newDesc += _T(" / ");
newDesc += desc;
extra->setDescription(newDesc.c_str());
}
if (!IsEmpty(ei->descIcon))
extra->setDescIcon(ei->descIcon);
if (ei->OnClick != NULL)
extra->setOnClick(ei->OnClick, ei->onClickParam);
if (extra->getSlot() > 0) {
if (clistRebuildAlreadyCalled)
extra->rebuildIcons();
if (clistApplyAlreadyCalled)
extraIconsByHandle[extra->getID() - 1]->applyIcons();
}
return extra->getID();
}
int id = registeredExtraIcons.getCount() + 1;
switch (ei->type) {
case EXTRAICON_TYPE_CALLBACK:
extra = new CallbackExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon,
ei->RebuildIcons, ei->ApplyIcon, ei->OnClick, ei->onClickParam);
break;
case EXTRAICON_TYPE_ICOLIB:
extra = new IcolibExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->OnClick,
ei->onClickParam);
break;
default:
return 0;
}
char setting[512];
mir_snprintf(setting, SIZEOF(setting), "Position_%s", ei->name);
extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000));
mir_snprintf(setting, SIZEOF(setting), "Slot_%s", ei->name);
int slot = db_get_w(NULL, MODULE_NAME, setting, 1);
if (slot == (WORD)-1)
slot = -1;
extra->setSlot(slot);
extra->hLangpack = (int)lParam;
registeredExtraIcons.insert(extra);
extraIconsByHandle.insert(extra);
LIST<ExtraIconGroup> groups(1);
LoadGroups(groups);
ExtraIconGroup *group = IsInGroup(groups, extra);
if (group != NULL)
RebuildListsBasedOnGroups(groups);
else {
for (int i = 0; i < groups.getCount(); i++)
delete groups[i];
extraIconsBySlot.insert(extra);
}
if (slot >= 0 || group != NULL) {
if (clistRebuildAlreadyCalled)
extra->rebuildIcons();
slot = 0;
for (int i = 0; i < extraIconsBySlot.getCount(); i++) {
ExtraIcon *ex = extraIconsBySlot[i];
if (ex->getSlot() < 0)
continue;
//.........这里部分代码省略.........
示例3: DlgProcPopupActions
INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static bool windowInitialized = false;
int i;
switch (msg) {
case WM_INITDIALOG:
windowInitialized = false;
TranslateDialogDefault(hwnd);
SendMessage(GetDlgItem(hwnd, IDC_ICO_INFO), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY,0), 0);
CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopupOptions.actions&ACT_ENABLE ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopupOptions.actions&ACT_DEF_IMONLY ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_CHK_CONTACTSONLY, PopupOptions.actions&ACT_DEF_NOGLOBAL ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_CHK_DONTCLOSE, PopupOptions.actions&ACT_DEF_KEEPWND ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_CHK_LARGEICONS, PopupOptions.actions&ACT_LARGE ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_RD_TEXT, PopupOptions.actions&ACT_TEXT ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_RD_LEFTICONS, PopupOptions.actions&ACT_LEFTICONS ? TRUE : FALSE);
CheckDlgButton(hwnd, IDC_RD_RIGHTICONS, PopupOptions.actions&ACT_RIGHTICONS ? TRUE : FALSE);
{
DWORD dwActiveItem = 0;
HWND hCombo = GetDlgItem(hwnd, IDC_CB_LEFT);
dwActiveItem = MouseOverride(hCombo, PopupOptions.overrideLeft);
SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_SETCURSEL, dwActiveItem, 0);
dwActiveItem = 0;
hCombo = GetDlgItem(hwnd, IDC_CB_MIDDLE);
dwActiveItem = MouseOverride(hCombo, PopupOptions.overrideMiddle);
SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_SETCURSEL, dwActiveItem, 0);
dwActiveItem = 0;
hCombo = GetDlgItem(hwnd, IDC_CB_RIGHT);
dwActiveItem = MouseOverride(hCombo, PopupOptions.overrideRight);
SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_SETCURSEL, dwActiveItem, 0);
HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES|LVS_EX_LABELTIP);
HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 10, 1);
ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL);
LVCOLUMN column = {0};
column.mask = LVCF_TEXT|LVCF_WIDTH;
column.pszText = TranslateT("Action");
column.cx = 175;
ListView_InsertColumn(hwndList, 0, &column);
ListView_EnableGroupView(hwndList, TRUE);
LIST<char> groups(1, strcmp);
for (i = 0; i < gActions.getCount(); ++i) {
char szGroup[64];
char *szName = strchr(gActions[i]->lpzTitle, '/');
if (!szName) szName = gActions[i]->lpzTitle;
else ++szName;
lstrcpynA(szGroup, gActions[i]->lpzTitle, szName - gActions[i]->lpzTitle);
int grpId = 0;
if ((grpId = groups.getIndex(szGroup)) < 0)
{
LVGROUP group = {0};
group.cbSize = sizeof(group);
group.mask = LVGF_HEADER|LVGF_GROUPID;
LPWSTR wszGroup = mir_a2u(szGroup);
group.pszHeader = TranslateW(wszGroup);
group.cchHeader = lstrlenW(wszGroup);
grpId = group.iGroupId = groups.getCount();
int grpId = ListView_InsertGroup(hwndList, -1, &group);
mir_free(wszGroup);
groups.insert(mir_strdup(szGroup), groups.getCount());
}
LVITEM item = {0};
item.mask = LVIF_IMAGE|LVIF_PARAM|LVIF_TEXT|LVIF_STATE|LVIF_INDENT;
item.iItem = i;
ptrT tszName( mir_a2t(szName));
item.pszText = TranslateTS(tszName);
item.iImage = ImageList_AddIcon(hImgList, gActions[i]->lchIcon);
item.lParam = i;
item.mask |= LVIF_GROUPID;
item.iGroupId = grpId;
item.iIndent = 0;
ListView_InsertItemW(hwndList, &item);
ListView_SetItemState(hwndList, i, (gActions[i]->flags & PAF_ENABLED) ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK);
}
BOOL enabled = (PopupOptions.actions&ACT_ENABLE) ? TRUE : FALSE;
for (i = 0; i < SIZEOF(controls); ++i)
EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
}
windowInitialized = true;
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
//.........这里部分代码省略.........
示例4: DlgProcOptions
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_MODULES);
CDbxMmapSA *p_Db = (CDbxMmapSA*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
LVITEM item;
int i, iRow, iIndex;
NMLISTVIEW * hdr = (NMLISTVIEW *)lParam;
WORD uid;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
p_Db = (CDbxMmapSA*)lParam;
{
HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 0);
ImageList_AddIcon(hIml, LoadSkinnedIcon(SKINICON_OTHER_LOADED));
ImageList_AddIcon(hIml, LoadSkinnedIcon(SKINICON_OTHER_NOTLOADED));
ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
LVCOLUMN col;
col.pszText = NULL;
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.fmt = LVCFMT_LEFT;
col.cx = 50;
ListView_InsertColumn(hwndList, 1, &col);
col.pszText = TranslateT("Dll");
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.fmt = LVCFMT_LEFT;
col.cx = 1000;
ListView_InsertColumn(hwndList, 2, &col);
col.pszText = TranslateT("Name");
col.cx = 1000;
ListView_InsertColumn(hwndList, 3, &col);
col.pszText = TranslateT("Version");
col.cx = 1000;
ListView_InsertColumn(hwndList, 4, &col);
}
ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);
uid = db_get_w(NULL, "SecureMMAP", "CryptoModule", 0);
for (i = 0; i < arCryptors.getCount(); i++) {
TCHAR buf[100];
item.mask = LVIF_TEXT;
item.iItem = i;
item.iSubItem = 0;
item.pszText = NULL;
iRow = ListView_InsertItem(hwndList, &item);
ListView_SetItemText(hwndList, iRow, 1, arCryptors[i]->dllname);
_tcsncpy(buf, _A2T(arCryptors[i]->cryptor->Name), SIZEOF(buf));
ListView_SetItemText(hwndList, iRow, 2, buf);
mir_sntprintf(buf, SIZEOF(buf), _T("%d.%d.%d.%d"), HIBYTE(HIWORD(arCryptors[i]->cryptor->Version)), LOBYTE(HIWORD(arCryptors[i]->cryptor->Version)), HIBYTE(LOWORD(arCryptors[i]->cryptor->Version)), LOBYTE(LOWORD(arCryptors[i]->cryptor->Version)));
ListView_SetItemText(hwndList, iRow, 3, buf);
if (uid == arCryptors[i]->cryptor->uid && p_Db->m_bEncoding)
ListView_SetCheckState(hwndList, i, 1);
item.mask = LVIF_IMAGE;
item.iItem = iRow;
item.iSubItem = 0;
item.iImage = (CryptoEngine == arCryptors[i]->cryptor && p_Db->m_bEncoding) ? 0 : 1;
ListView_SetItem(hwndList, &item);
}
ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE);
return TRUE;
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) {
switch (LOWORD(wParam)) {
case IDC_EMAIL:
case IDC_SITE:
char buf[512];
char *p = &buf[7];
lstrcpyA(buf, "mailto:");
if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7))
CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_EMAIL ? buf : p));
break;
}
}
break;
case WM_NOTIFY:
if (hdr && hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom) && hdr->iItem != (-1)) {
iIndex = hdr->iItem;
if (hdr->uNewState & 0x2000) {
for (i = 0; i < arCryptors.getCount(); i++)
if (i != iIndex)
ListView_SetCheckState(hwndList, i, 0);
//.........这里部分代码省略.........
示例5: GetWeatherDataFromDB
//============ MANAGE THE ITEMS STORED IN DB ============
// get single setting that is found
// szSetting = the setting name
// lparam = the counter
int GetWeatherDataFromDB(const char *szSetting, LPARAM lparam)
{
LIST<char> *pList = (LIST<char>*)lparam;
pList->insert(mir_strdup(szSetting));
return 0;
}
示例6: CSWindowProc
INT_PTR CALLBACK CSWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
CSWindow* csw = (CSWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
csw = (CSWindow*)lparam;
arWindows.insert(csw);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
csw->m_handle = hwnd;
csw->initIcons();
csw->initButtons();
csw->m_listview = new CSListView(GetDlgItem(hwnd, IDC_CSLIST), csw);
csw->m_listview->initItems(csw->m_itemslist->m_list->getListHead());
csw->toggleButtons();
csw->toggleEmptyListMessage();
csw->loadWindowPosition();
SetWindowText(hwnd, MODULENAME);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wparam)) {
case IDC_MODIFY:
case IDC_ADD:
csw->m_addModifyDlg = new CSAMWindow(LOWORD(wparam), csw);
csw->m_addModifyDlg->exec();
if (csw->m_addModifyDlg->m_bChanged) {
if (LOWORD(wparam) == IDC_MODIFY)
csw->m_itemslist->m_list->remove(csw->m_listview->getPositionInList());
int selection = csw->m_itemslist->m_list->add(csw->m_addModifyDlg->m_item);
csw->m_bSomethingChanged = TRUE;
csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead());
csw->m_listview->setFullFocusedSelection(selection);
csw->toggleButtons();
csw->toggleEmptyListMessage();
}
delete csw->m_addModifyDlg;
break;
case IDC_REMOVE:
if (getByte("ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION))
if (MessageBox(hwnd, TranslateT("Do you really want to delete selected item?"), TranslateW(MODULENAME), MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION) == IDNO)
break;
csw->m_itemslist->m_list->remove(csw->m_listview->getPositionInList());
csw->m_bSomethingChanged = TRUE;
csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead());
csw->toggleButtons();
csw->toggleEmptyListMessage();
break;
case IDC_FAVOURITE:
{
int selection = csw->m_listview->getPositionInList();
StatusItem* f = new StatusItem(*csw->m_itemslist->m_list->get(selection));
f->m_bFavourite = !f->m_bFavourite;
csw->m_itemslist->m_list->remove(selection);
selection = csw->m_itemslist->m_list->add(f);
csw->m_bSomethingChanged = TRUE;
csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead());
csw->m_listview->setFullFocusedSelection(selection);
csw->toggleButtons();
}
break;
case IDC_UNDO:
csw->m_itemslist->m_list->destroy();
csw->m_itemslist->loadItems(csw->m_protoName);
csw->m_bSomethingChanged = FALSE;
csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead());
csw->toggleButtons();
csw->toggleEmptyListMessage();
break;
case IDC_IMPORT:
{
int result = getByte("DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT);
if (result == TRUE)
result = IDYES;
else {
result = MessageBox(hwnd,
TranslateT("Do you want old database entries to be deleted after Import?"),
TranslateW(MODULENAME), MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONQUESTION);
if (result == IDCANCEL)
break;
}
importCustomStatuses(csw, result);
csw->m_bSomethingChanged = TRUE;
csw->toggleButtons();
csw->toggleEmptyListMessage();
}
break;
case IDC_FILTER:
csw->toggleFilter();
//.........这里部分代码省略.........
示例7: ListOfNonEmptyFields
void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_MAP * pmAllFields)
{
LIST<TCHAR> ListOfNonEmptyFields(20,(LIST<TCHAR>::FTSortFunc)TCharKeyCmp);
LIST<TCHAR> ListOfFields(20);
LIST<void>* plUsersInfo = (LIST<void>*)pvUsersInfo;
int i, nUsersFound = plUsersInfo->getCount();
// lets fill the ListOfNonEmptyFields but in users order
for (i=0; i < nUsersFound; i++) {
U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i);
int nUserFields = pmUserData->getCount();
for (int j=0; j < nUserFields; j++) {
TCHAR *var = pmUserData->getKeyName(j);
if (var && ListOfNonEmptyFields.getIndex(var) < 0)
ListOfNonEmptyFields.insert(var);
} }
// now fill the ListOfFields but order is from pmAllFields
int nAllCount = pmAllFields->getCount();
for (i=0; i < nAllCount; i++) {
TCHAR * var=pmAllFields->getUnOrderedKeyName(i);
if (var && ListOfNonEmptyFields.getIndex(var) < 0)
continue;
ListOfFields.insert(var);
}
// now lets transfer field names
int nFieldCount = ListOfFields.getCount();
JABBER_CUSTOMSEARCHRESULTS Results={0};
Results.nSize=sizeof(Results);
Results.pszFields=(TCHAR**)mir_alloc(sizeof(TCHAR*)*nFieldCount);
Results.nFieldCount=nFieldCount;
/* Sending Columns Titles */
for (i=0; i < nFieldCount; i++) {
TCHAR *var = ListOfFields[i];
if (var)
Results.pszFields[i] = pmAllFields->operator [](var);
}
Results.jsr.hdr.cbSize = 0; // sending column names
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results);
/* Sending Users Data */
Results.jsr.hdr.cbSize = sizeof(Results.jsr); // sending user data
for (i=0; i < nUsersFound; i++) {
TCHAR buff[200]=_T("");
Results.jsr.jid[0]=0;
U_TCHAR_MAP * pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i);
for (int j=0; j < nFieldCount; j++) {
TCHAR* var = ListOfFields[j];
TCHAR* value = pmUserData->operator [](var);
Results.pszFields[j] = value ? value : (TCHAR *)_T(" ");
if (!_tcsicmp(var,_T("jid")) && value)
_tcsncpy(Results.jsr.jid, value, SIZEOF(Results.jsr.jid));
}
{
TCHAR * nickfields[]={ _T("nick"), _T("nickname"),
_T("fullname"), _T("name"),
_T("given"), _T("first"),
_T("jid"), NULL };
TCHAR * nick=NULL;
int k=0;
while (nickfields[k] && !nick) nick=pmUserData->operator [](nickfields[k++]);
if (_tcsicmp(nick, Results.jsr.jid))
mir_sntprintf(buff, SIZEOF(buff), _T("%s (%s)"), nick, Results.jsr.jid);
else
_tcsncpy(buff, nick, SIZEOF(buff));
Results.jsr.hdr.nick = nick ? buff : NULL;
Results.jsr.hdr.flags = PSR_TCHAR;
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results);
Results.jsr.hdr.nick=NULL;
}
mir_free(Results.pszFields);
}
示例8: RDCColl
/*!
\brief 递归逐维分组碰撞算法
当分组到达最小组数量的时候,将最小组作为参数调用
SBC::SimpleColl
\param group 参与碰撞检测的BOX组
\param fData 帧数据指针
\param minGroupSize 最小分组
\param freeBlockList 空闲块链表
\param axis1 当前检测的坐标轴
\param axis2 下个递归检测的坐标轴
*/
void
RDCColl(LIST<BOX*> &group, const FRAMEDATA *fData, size_t minGroupSize, BUFFER *freeBlockList, AXIS axis1, AXIS axis2)
{
if(axis1 == AXIS_INVALID || group.SizeIfLessThan(minGroupSize))
{
SimpleColl(group, fData);
}
else
{
LIST<OPENCLOSEBOUNDARY> openCloseBoundaryList(&freeBlockList->m_collInfoBuffer);
_FindOpenCloseBoundaryList(axis1,
group, openCloseBoundaryList);
LIST<BOX*> subGroup(group.GetFreeBlockList());
unsigned int count = 0;
AXIS newAxis1 = axis2;
AXIS newAxis2 = AXIS_INVALID;
bool groupSubdivided = false;
OPENCLOSEBOUNDARY *thisBoundaryPtr;
for(LIST<OPENCLOSEBOUNDARY>::NOTE
*thisNote = openCloseBoundaryList.QSort();
thisNote; thisNote = thisNote->GetNext())
{
thisBoundaryPtr = &thisNote->Get();
if(thisBoundaryPtr->type == TYPE_OPEN)
{
++count;
subGroup.Create(thisBoundaryPtr->pBox);
}
else
{
--count;
if(count == 0)
{
if(thisNote != openCloseBoundaryList.GetLast())
{
groupSubdivided = true;
}
if(groupSubdivided)
{
if(newAxis1 == AXIS_X)
{
newAxis1 = AXIS_Y;
newAxis2 = AXIS_X;
}
if(newAxis1 == AXIS_Y)
{
newAxis1 = AXIS_X;
newAxis2 = AXIS_Y;
}
}
RDCColl(subGroup,
fData,
minGroupSize,
freeBlockList,
newAxis1,
newAxis2);
subGroup.Clear();
}
}
} // for loop - end
} // if - end
} // RDCColl - end
示例9: read_labels
/// \todo Make some assertion about # of constit. labels, and/or that
/// they are the lowest numbered ones?
void read_labels(const string filename) {
assert(!open_label_list);
ifstream fin(filename.c_str());
assert(fin.is_open());
_all_labels.clear();
_all_constituent_labels.clear();
_all_terminal_labels.clear();
_max_label = 0;
label_list.clear();
label_map.clear();
terminal_set.clear();
constituent_set.clear();
unsigned i, is_terminal, cnt;
string label;
while(!fin.eof()) {
fin >> i >> ws >> is_terminal >> ws >> cnt >> label >> ws;
if (i == NO_LABEL)
label = "";
label_list.push_back(label);
assert(label_list.at(i) == label);
label_map[label] = i; // FIXME: Don't use [] operator
if (i != NO_LABEL) {
_all_labels.push_back(i);
if (is_terminal) {
terminal_set.insert(i, true);
_all_terminal_labels.push_back(i);
} else {
constituent_set.insert(i, true);
_all_constituent_labels.push_back(i);
}
if (i > _max_label) _max_label = i+1;
}
}
assert(label_list.at(NO_LABEL) == "");
assert(label_map[""] == NO_LABEL); // FIXME: Don't use [] operator
assert(label_list.size() == label_map.size());
// assert(label_map.size() == terminal_set.size() + constituent_set.size() + 1);
terminal_set.lock();
constituent_set.lock();
/*
Debug::log(1) << "Read " << constituent_set.size() << " constituents, " << \
terminal_set.size() << " terminals from '" << filename << "'\n";
*/
fin.close();
open_label_list = true;
if (is_label_string("ADJP")) _Label_ADJP = string_to_label("ADJP");
if (is_label_string("ADVP")) _Label_ADVP = string_to_label("ADVP");
if (is_label_string("AUX")) _Label_AUX = string_to_label("AUX");
if (is_label_string("AUXG")) _Label_AUXG = string_to_label("AUXG");
if (is_label_string("CC")) _Label_CC = string_to_label("CC");
if (is_label_string("CD")) _Label_CD = string_to_label("CD");
if (is_label_string("COLON")) _Label_COLON = string_to_label(":");
if (is_label_string("COMMA")) _Label_COMMA = string_to_label(",");
if (is_label_string("CONJP")) _Label_CONJP = string_to_label("CONJP");
if (is_label_string("DOLLAR")) _Label_DOLLAR = string_to_label("$");
if (is_label_string("DT")) _Label_DT = string_to_label("DT");
if (is_label_string("EX")) _Label_EX = string_to_label("EX");
if (is_label_string("FRAG")) _Label_FRAG = string_to_label("FRAG");
if (is_label_string("FW")) _Label_FW = string_to_label("FW");
if (is_label_string("HASH")) _Label_HASH = string_to_label("#");
if (is_label_string("IN")) _Label_IN = string_to_label("IN");
if (is_label_string("INTJ")) _Label_INTJ = string_to_label("INTJ");
if (is_label_string("JJ")) _Label_JJ = string_to_label("JJ");
if (is_label_string("JJR")) _Label_JJR = string_to_label("JJR");
if (is_label_string("JJS")) _Label_JJS = string_to_label("JJS");
if (is_label_string("LS")) _Label_LS = string_to_label("LS");
if (is_label_string("LST")) _Label_LST = string_to_label("LST");
if (is_label_string("MD")) _Label_MD = string_to_label("MD");
if (is_label_string("NAC")) _Label_NAC = string_to_label("NAC");
if (is_label_string("NN")) _Label_NN = string_to_label("NN");
if (is_label_string("NNP")) _Label_NNP = string_to_label("NNP");
if (is_label_string("NNPS")) _Label_NNPS = string_to_label("NNPS");
if (is_label_string("NNS")) _Label_NNS = string_to_label("NNS");
if (is_label_string("NP")) _Label_NP = string_to_label("NP");
if (is_label_string("NPB")) _Label_NPB = string_to_label("NPB");
if (is_label_string("NX")) _Label_NX = string_to_label("NX");
if (is_label_string("POS")) _Label_POS = string_to_label("POS");
if (is_label_string("PP")) _Label_PP = string_to_label("PP");
if (is_label_string("PRN")) _Label_PRN = string_to_label("PRN");
if (is_label_string("PRP")) _Label_PRP = string_to_label("PRP");
if (is_label_string("PRPP")) _Label_PRPP = string_to_label("PRP$");
if (is_label_string("PRT")) _Label_PRT = string_to_label("PRT");
if (is_label_string("QP")) _Label_QP = string_to_label("QP");
if (is_label_string("RB")) _Label_RB = string_to_label("RB");
if (is_label_string("RBR")) _Label_RBR = string_to_label("RBR");
if (is_label_string("RBS")) _Label_RBS = string_to_label("RBS");
if (is_label_string("RP")) _Label_RP = string_to_label("RP");
if (is_label_string("RRC")) _Label_RRC = string_to_label("RRC");
//.........这里部分代码省略.........
示例10: findUinKey
// find user in the list of secureIM users and add him, if unknow
pUinKey findUinKey(HANDLE hContact)
{
return arClist.find((pUinKey)&hContact);
}
示例11: UnloadDatabase
static int UnloadDatabase(MIDatabase *db)
{
g_Dbs.remove((CDbxKyoto*)db);
delete (CDbxKyoto*)db;
return 0;
}
示例12: Unload
extern "C" int __declspec(dllexport) Unload()
{
g_Instances.destroy();
return 0;
}
示例13: Player_GetFirst
//******************************************************************************
PLAYER* Player_GetFirst()
{
return PlayerList.GetFirst();
}
示例14: sametime_proto_init
static CSametimeProto* sametime_proto_init(const char* pszProtoName, const TCHAR* tszUserName)
{
CSametimeProto* proto = new CSametimeProto(pszProtoName, tszUserName);
g_Instances.insert(proto);
return proto;
}
示例15:
MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR ***pProtos)
{
if (nProtos) *nProtos = protos.getCount();
if (pProtos) *pProtos = protos.getArray();
}