当前位置: 首页>>代码示例>>C++>>正文


C++ JArray::IsEmpty方法代码示例

本文整理汇总了C++中JArray::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ JArray::IsEmpty方法的具体用法?C++ JArray::IsEmpty怎么用?C++ JArray::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JArray的用法示例。


在下文中一共展示了JArray::IsEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getpwuid

static JBoolean
jGetUserInfo
	(
	const uid_t uid,
	jUIDInfo*	info
	)
{
	if (theUserInfoMap.IsEmpty())
		{
		theUserInfoMap.SetCompareFunction(jCompareUIDs);
		theUserInfoMap.SetSortOrder(JOrderedSetT::kSortAscending);
		atexit(jCleanUserInfoMap);
		}

	const jUIDInfo target = { uid, NULL, NULL };
	JIndex i;
	if (theUserInfoMap.SearchSorted(target, JOrderedSetT::kAnyMatch, &i))
		{
		*info = theUserInfoMap.GetElement(i);
		}
	else
		{
		passwd* pwbuf = getpwuid(uid);
		if (pwbuf != NULL)
			{
			info->userName = new JString(pwbuf->pw_name);
			assert( info->userName != NULL );

			info->realName = new JString(pwbuf->pw_gecos);
			assert( info->realName != NULL );

			info->homeDirectory = new JString(pwbuf->pw_dir);
			assert( info->homeDirectory != NULL );

			info->shell = new JString(pwbuf->pw_shell);
			assert( info->shell != NULL );

			info->id = uid;
			const JBoolean inserted = theUserInfoMap.InsertSorted(*info, kJFalse);
			assert( inserted );
			}
		else
			{
			info->userName = info->realName = info->homeDirectory = info->shell = NULL;
			}
		}

	return JI2B( info->userName != NULL );
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:49,代码来源:jSysUtil_UNIX.cpp

示例2: r

void
JXComposeRuleList::AddRule
	(
	const JArray<KeySym>&	inputSeq,
	const KeySym			outputKeySym
	)
{
	assert( !inputSeq.IsEmpty() );

	if (!IsInitialKeySym(inputSeq.GetFirstElement()))
		{
		itsInitialKeySymList->AppendElement(inputSeq.GetFirstElement());
		}

	Rule r(jnew JArray<KeySym>(inputSeq), outputKeySym);
	assert( r.inputSeq != NULL );
	itsRuleList->InsertSorted(r);
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:18,代码来源:JXComposeRuleList.cpp

示例3: getgrgid

static JBoolean
jGetGroupInfo
	(
	const gid_t	gid,
	jGIDInfo*	info
	)
{
	if (groupInfoMap.IsEmpty())
		{
		groupInfoMap.SetCompareFunction(jCompareGIDs);
		groupInfoMap.SetSortOrder(JOrderedSetT::kSortAscending);
		}

	const jGIDInfo target = { gid, NULL };
	JIndex i;
	if (groupInfoMap.SearchSorted(target, JOrderedSetT::kAnyMatch, &i))
		{
		*info = groupInfoMap.GetElement(i);
		}
	else
		{
		group* grpbuf = getgrgid(gid);
		if (grpbuf != NULL)
			{
			info->groupName = new JString(grpbuf->gr_name);
			assert( info->groupName != NULL );

			info->id = gid;
			const JBoolean inserted = groupInfoMap.InsertSorted(*info, kJFalse);
			assert( inserted );
			}
		else
			{
			info->groupName = NULL;
			}
		}

	return JI2B( info->groupName != NULL );
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:39,代码来源:jSysUtil_UNIX.cpp

示例4: if

JParseResult
JParseAsSummation
	(
	const JCharacter*		origExpr,
	const JSize				origLength,
	const JVariableList*	theVariableList,
	JFunction**				theFunction,
	const JBoolean			allowUIF
	)
{
	*theFunction = NULL;

	// remove enclosing parentheses

	const JCharacter* expr = origExpr;
	const JSize length     = JStripParentheses(&expr, origLength);

	// build a list of the locations of all visible + and - operators

	const JCharacter* plusStr  = JPGetAdditionString();
	const JSize plusLength     = JPGetAdditionStringLength();
	const JCharacter* minusStr = JPGetSubtractionString();
	const JSize minusLength    = JPGetSubtractionStringLength();

	JArray<JCharacter> opList;
	JArray<JSize> opOffsetList;
	JArray<JSize> argOffsetList;
	JSize lastOffset = 0;
	while (1)
		{
		JSize plusOffset;
		const JBoolean foundPlus =
			JFindFirstOperator(expr + lastOffset, length - lastOffset,
							   plusStr, &plusOffset);
		plusOffset += lastOffset;

		JSize minusOffset;
		const JBoolean foundMinus =
			JFindFirstOperator(expr + lastOffset, length - lastOffset,
							   minusStr, &minusOffset);
		minusOffset += lastOffset;

		JCharacter opType;
		JSize opOffset, argOffset;
		if (foundPlus && foundMinus && plusOffset < minusOffset)
			{
			opType = '+';
			opOffset  = plusOffset;
			argOffset = plusOffset + plusLength;
			}
		else if (foundPlus && foundMinus && minusOffset < plusOffset)
			{
			opType = '-';
			opOffset  = minusOffset;
			argOffset = minusOffset + minusLength;
			}
		else if (foundPlus)
			{
			opType = '+';
			opOffset  = plusOffset;
			argOffset = plusOffset + plusLength;
			}
		else if (foundMinus)
			{
			opType = '-';
			opOffset  = minusOffset;
			argOffset = minusOffset + minusLength;
			}
		else
			{
			break;
			}

		if (!JIsExponentSign(expr, opOffset, argOffset))
			{
			opList.AppendElement(opType);
			opOffsetList.AppendElement(opOffset);
			argOffsetList.AppendElement(argOffset);
			}

		lastOffset = argOffset;
		}

	if (opList.IsEmpty())
		{
		return kJNotMyProblem;
		}
	else if (opList.GetElementCount() == 1 && opOffsetList.GetElement(1) == 0)
		{
		const JSize argOffset = argOffsetList.GetElement(1);
		JFunction* arg = NULL;
		if (!JRecurseFunction(expr + argOffset, length - argOffset, theVariableList,
							  &arg, allowUIF))
			{
			return kJParseError;
			}

		if (opList.GetElement(1) == '-')
			{
			*theFunction = new JNegation(arg);
//.........这里部分代码省略.........
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:101,代码来源:jParseFunction.cpp

示例5: JXTextButton

TestWidget::TestWidget
(
    const JBoolean		isMaster,
    const JBoolean		isImage,
    const JBoolean		allocDynamicColors,
    JXMenuBar*			menuBar,
    JXScrollbarSet*		scrollbarSet,
    JXContainer*		enclosure,
    const HSizingOption	hSizing,
    const VSizingOption	vSizing,
    const JCoordinate	x,
    const JCoordinate	y,
    const JCoordinate	w,
    const JCoordinate	h
)
    :
    JXScrollableWidget(scrollbarSet, enclosure, hSizing, vSizing, x,y, w,h),
    itsRNG()
{
    JIndex i;

    itsFillFlag       = kJFalse;
    itsNextAnimColor  = (GetColormap())->GetGreenColor();
    itsRandPointCount = 10;
    itsResizeDialog   = NULL;

    // cursors

    JXDisplay* display = GetDisplay();
    itsTrekCursor      = display->CreateBuiltInCursor("XC_trek",     XC_trek);
    itsGumbyCursor     = display->CreateBuiltInCursor("XC_gumby",    XC_gumby);
    itsBogosityCursor  = display->CreateBuiltInCursor("XC_bogosity", XC_bogosity);
    itsFleurCursor     = display->CreateBuiltInCursor("XC_fleur",    XC_fleur);
    SetDefaultCursor(itsTrekCursor);

    // dynamic colors

    itsAnimColorList = new JArray<JColorIndex>(kAnimColorCount);
    assert( itsAnimColorList != NULL );

    JArray<JDynamicColorInfo>* colorList =
        new JArray<JDynamicColorInfo>(kAnimColorCount);
    assert( colorList != NULL );

    JXColormap* colormap = GetColormap();
    if (allocDynamicColors)
    {
        for (i=1; i<=kAnimColorCount; i++)
        {
            JDynamicColorInfo info;
            if (colormap->AllocateDynamicColor(0,0,0, &(info.index)))
            {
                colorList->AppendElement(info);
                itsAnimColorList->AppendElement(info.index);
            }
            else
            {
                cerr << "Unable to allocate dynamic color " << i << endl;
                break;
            }
        }
    }

    if (!colorList->IsEmpty())
    {
        itsAnimColorTask = new AnimateColorTask(colormap, colorList);
        assert( itsAnimColorTask != NULL );
    }
    else
    {
        delete colorList;
        itsAnimColorTask = NULL;
    }

    ListenTo(GetWindow());		// remove AnimateColorTask when iconified

    // menus

    itsActionsMenu = menuBar->AppendTextMenu(kActionsMenuTitleStr);
    itsActionsMenu->SetTitleFontStyle((GetColormap())->GetWhiteColor());
    itsActionsMenu->SetShortcuts(kActionsMenuShortcutStr);
    itsActionsMenu->SetMenuItems(kActionsMenuStr);
    itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone);
    ListenTo(itsActionsMenu);

    itsPointMenu = new JXTextMenu(itsActionsMenu, kPointMenuCmd, menuBar);
    assert( itsPointMenu != NULL );
    itsPointMenu->SetMenuItems(kPointMenuStr);
    itsPointMenu->SetUpdateAction(JXMenu::kDisableNone);
    ListenTo(itsPointMenu);

    // This tests the JX response to an empty menu.
    JXTextMenu* emptyMenu = new JXTextMenu(itsActionsMenu, kEmptyMenuCmd, menuBar);
    assert( emptyMenu != NULL );

    JXMenu* prevMenu     = itsActionsMenu;
    JIndex prevMenuIndex = kAdviceMenuCmd;
    for (i=1; i<=kAdviceMenuCount; i++)
    {
        JXTextMenu* adviceMenu = new JXTextMenu(prevMenu, prevMenuIndex, menuBar);
//.........这里部分代码省略.........
开发者ID:mta1309,项目名称:mulberry-lib-jx,代码行数:101,代码来源:TestWidget.cpp


注:本文中的JArray::IsEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。