u32 CRestrictions::GetItemCount(const shared_str& item_sect) const
{
	VERIFY							(m_bInited);

	const shared_str& group_name	= GetItemGroup(item_sect);
	VERIFY3		(group_name.size(), "item has no group", item_sect.c_str());
	const restr_item* res			= find_restr_item(m_rank, group_name);
	
	VERIFY4		(res,				"group has no restrictions for rank", group_name.c_str(), GetRankName(m_rank).c_str());

	return							res->second;
}
void CRestrictions::AddGroup(LPCSTR group, LPCSTR lst)
{// private
	VERIFY							(m_bInited);

	VERIFY(m_goups.find(group) == m_goups.end());

	group_items& _new	= m_goups[group];
	string256			singleItem;
	u32 count			= _GetItemCount(lst);
	for (u32 j = 0; j < count; ++j)
	{
		_GetItem(lst, j, singleItem);
#ifdef DEBUG
		const shared_str& _exist = GetItemGroup(singleItem);
		VERIFY3(_exist.size()==0, "item has duplicate record in groups", singleItem);
#endif
		_new.push_back	(singleItem);
	}
}
示例#3
0
BOOL COptionListBox::AddPage(COptionPage *page, COptionPage *pGroupPage)
{
    ASSERT(NULL != page);

    int i;
    int count;
    CString caption;

    if(NULL != pGroupPage) {
        // Find the group
        count = GetCount();
        if(LB_ERR == count) {
            return FALSE;
        }
        ASSERT(count > 0);

        for(i = 0; i < count; i++) {

            COptionPage *itemPage = GetItemPage(i);

            if(pGroupPage == itemPage) {
                //	We found a group page, Skip past the last page associated with this
                //	group so the page may be inserted there.
                if(++i < count) {
                    while(i < count) {
                        if(pGroupPage != GetItemGroup(i)) {
                            break;
                        }
                        i++;
                    }
                }
                return AddItem(page, pGroupPage, i, FALSE);
            }
        }
    } else {
        return AddItem(page);
    }

    return FALSE;
}