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


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

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


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

示例1:

JBoolean
GetEnclosure
	(
	const JArray<JRect>&	rectList,
	const JIndex			rectIndex,
	JIndex*					enclIndex
	)
{
	const JRect theRect = rectList.GetElement(rectIndex);
	JBoolean found = kJFalse;
	*enclIndex = 0;

	JSize minArea = 0;
	const JSize count = rectList.GetElementCount();
	for (JIndex i=1; i<=count; i++)
		{
		if (i != rectIndex)
			{
			const JRect r = rectList.GetElement(i);
			const JSize a = r.area();
			if (r.Contains(theRect) && (a < minArea || minArea == 0))
				{
				minArea    = a;
				found      = kJTrue;
				*enclIndex = i;
				}
			}
		}
	return found;
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:30,代码来源:jxlayout.cpp

示例2: if

JVariableList::MatchResult
JVariableList::FindUniqueVarName
	(
	const JCharacter*	prefix,
	JIndex*				index,
	JString*			maxPrefix
	)
	const
{
	assert( !JStringEmpty(prefix) );

	const JSize count = GetElementCount();
	JArray<JIndex> matchList;

	for (JIndex i=1; i<=count; i++)
		{
		const JString& name = GetVariableName(i);
		if (name == prefix)
			{
			*index     = i;
			*maxPrefix = name;
			return kSingleMatch;
			}
		else if (JStringBeginsWith(name, name.GetLength(), prefix))
			{
			matchList.AppendElement(i);
			}
		}

	const JSize matchCount = matchList.GetElementCount();
	if (matchCount == 0)
		{
		*index = 0;
		maxPrefix->Clear();
		return kNoMatch;
		}
	else if (matchCount == 1)
		{
		*index     = matchList.GetElement(1);
		*maxPrefix = GetVariableName(*index);
		return kSingleMatch;
		}
	else
		{
		*maxPrefix = GetVariableName( matchList.GetElement(1) );
		for (JIndex i=2; i<=matchCount; i++)
			{
			const JString& varName   = GetVariableName( matchList.GetElement(i) );
			const JSize matchLength  = JCalcMatchLength(*maxPrefix, varName);
			const JSize prefixLength = maxPrefix->GetLength();
			if (matchLength < prefixLength)
				{
				maxPrefix->RemoveSubstring(matchLength+1, prefixLength);
				}
			}
		*index = 0;
		return kMultipleMatch;
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:59,代码来源:JVariableList.cpp

示例3: GLUndoElementsChange

void
GLUndoElementsChange::Undo()
{

	// we need to create this before we change the data, because
	// it needs to read the old data first. We can't yet call NewUndo, 
	// though, because that will delete us.

	GLUndoElementsChange* undo =
		new GLUndoElementsChange(GetTable(), GetStartCell(), GetEndCell(), GetType());
	assert(undo != NULL);
	
	GRaggedFloatTableData* data 		= GetData();
	JPoint start 						= GetStartCell();
	JPoint end 							= GetEndCell();
	GLUndoElementsBase::UndoType type 	= GetType();

	if (type == GLUndoElementsBase::kRows)
		{
		}
	else if (type == GLUndoElementsBase::kCols)
		{
		JSize cols = itsValues->GetElementCount();
		for (JSize i = 1; i <= cols; i++)
			{
			JArray<JFloat>* col = itsValues->NthElement(i);
			JSize rows = col->GetElementCount();
			for (JSize j = 1; j <= rows; j++)
				{
				JFloat value = col->GetElement(j);
				data->SetElement(j, i + start.x - 1, value);
				}
			}
		}
	else if (type == GLUndoElementsBase::kElements)
		{
		for (JSize i = start.x; i <= (JSize)end.x; i++)
			{
			JArray<JFloat>* col = itsValues->NthElement(i - start.x + 1);
			JSize rows = col->GetElementCount();
			for (JSize j = start.y; j <= start.y + rows -1; j++)
				{
				JFloat value = col->GetElement(j - start.y + 1);
				data->SetElement(j, i, value);
				}
			}
		}
		
	NewUndo(undo);
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:50,代码来源:GLUndoElementsChange.cpp

示例4:

void
JInterPoly::AddPoints
	(
	const JArray<JFloat>& x,
	const JArray<JFloat>& y
	)
{
	const JSize ptCount = x.GetElementCount();
	assert( ptCount == y.GetElementCount() );

	for (JIndex i=1; i<=ptCount; i++)
		{
		AddPoint(x.GetElement(i), y.GetElement(i));
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:15,代码来源:JInterPoly.cpp

示例5:

void
GRaggedFloatTableData::DuplicateRow
	(
	const JIndex index
	)
{
	const JSize colCount = itsCols->GetElementCount();
	for (JIndex i=1; i<=colCount; i++)
		{
		JArray<JFloat>* colData = itsCols->NthElement(i);
		const JSize rowCount = colData->GetElementCount();

		if (index <= rowCount)
			{
			const JFloat element = colData->GetElement(index);
			colData->InsertElementAtIndex(index, element);
			}
		}

	RowsAdded(1);
	if (itsBroadcast)
		{
		Broadcast(JTableData::RowDuplicated(index, index));
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:25,代码来源:GRaggedFloatTableData.cpp

示例6: GetSubject

const JString&
GMessageHeader::GetBaseSubject()
{
	if (itsHasBaseSubject)
		{
		return itsBaseSubject;
		}
	itsHasBaseSubject	= kJTrue;
	itsBaseSubject		= GetSubject();
	kFixSubjectRegex.SetCaseSensitive(kJFalse);
	JArray<JIndexRange> subList;
	while (kFixSubjectRegex.Match(itsBaseSubject, &subList))
		{
		itsBaseSubject	= itsBaseSubject.GetSubstring(subList.GetElement(subList.GetElementCount()));
		itsBaseSubject.TrimWhitespace();
		subList.RemoveAll();
		}
	const JSize length	= itsBaseSubject.GetLength();
	JIndex findex		= 1;
	while (findex <= length && 
		   !isalnum(itsBaseSubject.GetCharacter(findex)))
		{
		findex++;
		}
	if (findex > 1 && findex <= length)
		{
		itsBaseSubject	= itsBaseSubject.GetSubstring(findex, length);
		}
	return itsBaseSubject;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:30,代码来源:GMessageHeader.cpp

示例7:

JXPSPrintSetupDialog*
CBPSPrinter::CreatePrintSetupDialog
	(
	const Destination	destination,
	const JCharacter*	printCmd,
	const JCharacter*	fileName,
	const JBoolean		collate,
	const JBoolean		bw
	)
{
	assert( itsCBPrintSetupDialog == NULL );

	if (itsFontSize == kUnsetFontSize)
		{
		JString fontName;
		CBGetPrefsManager()->GetDefaultFont(&fontName, &itsFontSize);

		JArray<JIndexRange> matchList;
		if (nxmRegex.Match(fontName, &matchList))
			{
			const JString hStr = fontName.GetSubstring(matchList.GetElement(2));
			const JBoolean ok  = hStr.ConvertToUInt(&itsFontSize);
			assert( ok );
			itsFontSize--;
			}
		}

	itsCBPrintSetupDialog =
		CBPSPrintSetupDialog::Create(destination, printCmd, fileName,
									 collate, bw, itsFontSize,
									 (CBGetPTTextPrinter())->WillPrintHeader());
	return itsCBPrintSetupDialog;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:33,代码来源:CBPSPrinter.cpp

示例8: if

JBoolean
CBCommandTable::WillAcceptDrop
	(
	const JArray<Atom>&	typeList,
	Atom*				action,
	const JPoint&		pt,
	const Time			time,
	const JXWidget*		source
	)
{
	if (source == this)
		{
		return kJTrue;
		}
	else if (source == NULL)
		{
		return kJFalse;
		}

	const JSize typeCount = typeList.GetElementCount();
	for (JIndex i=1; i<=typeCount; i++)
		{
		if (typeList.GetElement(i) == itsCommandXAtom)
			{
			return kJTrue;
			}
		}

	return kJFalse;
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:30,代码来源:CBCommandTable.cpp

示例9: WillAcceptDrop

JBoolean
JXPathInput::WillAcceptDrop
	(
	const JArray<Atom>&	typeList,
	Atom*				action,
	const JPoint&		pt,
	const Time			time,
	const JXWidget*		source
	)
{
	itsExpectURLDropFlag = kJFalse;

	const Atom urlXAtom = (GetSelectionManager())->GetURLXAtom();

	JString dirName;
	const JSize typeCount = typeList.GetElementCount();
	for (JIndex i=1; i<=typeCount; i++)
		{
		if (typeList.GetElement(i) == urlXAtom &&
			GetDroppedDirectory(time, kJFalse, &dirName))
			{
			*action = (GetDNDManager())->GetDNDActionPrivateXAtom();
			itsExpectURLDropFlag = kJTrue;
			return kJTrue;
			}
		}

	return JXInputField::WillAcceptDrop(typeList, action, pt, time, source);
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:29,代码来源:JXPathInput.cpp

示例10: s

JBoolean
JParseURL
	(
	const JCharacter*	url,
	JString*			protocol,
	JString*			host,
	JIndex*				port,
	JString*			path
	)
{
	*path = url;

	JArray<JIndexRange> matchList;
	if (urlPattern.Match(url, &matchList))
		{
		protocol->Set(url, matchList.GetElement(2));
		host->Set(url, matchList.GetElement(3));

		JIndexRange r = matchList.GetElement(4);
		if (!r.IsEmpty())
			{
			const JString s(url, r);
			if (!s.ConvertToUInt(port))
				{
				*port = 0;
				}
			}
		else
			{
			*port = 0;
			}

		r = matchList.GetElement(5);
		if (!r.IsEmpty())
			{
			path->Set(url, r);
			}
		else
			{
			*path = "/";
			}

		return kJTrue;
		}

	return kJFalse;
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:47,代码来源:jWebUtil.cpp

示例11: GetSelectionManager

JBoolean
JXExprEditor::EIPGetExternalClipboard
	(
	JString* text
	)
{
	text->Clear();

	JBoolean gotData = kJFalse;
	JXSelectionManager* selManager = GetSelectionManager();

	JArray<Atom> typeList;
	if (selManager->GetAvailableTypes(kJXClipboardName, CurrentTime, &typeList))
		{
		JBoolean canGetText = kJFalse;
		Atom textType       = None;

		const JSize typeCount = typeList.GetElementCount();
		for (JIndex i=1; i<=typeCount; i++)
			{
			Atom type = typeList.GetElement(i);
			if (type == XA_STRING ||
				(!canGetText && type == selManager->GetUtf8StringXAtom()))
				{
				canGetText = kJTrue;
				textType   = type;
				break;
				}
			}

		Atom returnType;
		unsigned char* data = NULL;
		JSize dataLength;
		JXSelectionManager::DeleteMethod delMethod;
		if (canGetText &&
			selManager->GetData(kJXClipboardName, CurrentTime, textType,
								&returnType, &data, &dataLength, &delMethod))
			{
			if (returnType == XA_STRING)
				{
				*text = JString(reinterpret_cast<JCharacter*>(data), dataLength);
				gotData = kJTrue;
				}
			selManager->DeleteData(&data, delMethod);
			}
		else
			{
			(JGetUserNotification())->ReportError(
				"Unable to paste the current contents of the X Clipboard.");
			}
		}
	else
		{
		(JGetUserNotification())->ReportError("The X Clipboard is empty.");
		}

	return gotData;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:58,代码来源:JXExprEditor.cpp

示例12: GetFontManager

void
JXTabGroup::ScrollUpToTab
	(
	const JIndex index
	)
{
	assert( itsTitles->IndexValid(index) );
	assert( index > itsFirstDrawIndex );

	const JFontManager* fontMgr = GetFontManager();
	const JFontID fontID        = fontMgr->GetFontID(itsFontName, itsFontSize, itsFontStyle);

	const JCoordinate scrollArrowWidth = 2*(kArrowWidth + kBorderWidth);

	const JRect ap        = GetAperture();
	const JCoordinate min = (itsEdge == kTop || itsEdge == kBottom ? ap.left : ap.top);
	const JCoordinate max = (itsEdge == kTop || itsEdge == kBottom ? ap.right : ap.bottom);
	JCoordinate left      = min + kSelMargin;
	JCoordinate right     = left;
	JArray<JCoordinate> widthList;

	const JSize count  = itsTitles->GetElementCount();
	JBoolean offScreen = kJFalse;
	for (JIndex i=itsFirstDrawIndex; i<=index; i++)
		{
		const TabInfo info = itsTabInfoList->GetElement(index);

		right += 2*kBorderWidth + info.preMargin + info.postMargin +
				 fontMgr->GetStringWidth(fontID, itsFontSize, itsFontStyle,
										 *(itsTitles->NthElement(i)));
		if (info.closable)
			{
			right += kCloseMarginWidth + itsCloseImage->GetWidth();
			}
		widthList.AppendElement(right - left);

		if (!offScreen &&
			right >= max - scrollArrowWidth &&
			!(itsFirstDrawIndex == 1 && i == count && right <= max))
			{
			offScreen = kJTrue;
			}

		left = right;
		}

	if (offScreen)
		{
		JIndex i = 1;
		while (right > max - scrollArrowWidth && itsFirstDrawIndex < index)
			{
			right -= widthList.GetElement(i);
			itsFirstDrawIndex++;
			i++;
			}
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:57,代码来源:JXTabGroup.cpp

示例13: GetDisplay

void
TestWidget::PrintSelectionTargets
	(
	const Time time
	)
{
	JXDisplay* display         = GetDisplay();
	JXSelectionManager* selMgr = GetSelectionManager();
	JXDNDManager* dndMgr       = GetDNDManager();

	JArray<Atom> typeList;
	if (selMgr->GetAvailableTypes(kJXClipboardName, time, &typeList))
		{
		std::cout << std::endl;
		std::cout << "Data types available from the clipboard:" << std::endl;
		std::cout << std::endl;

		const JSize typeCount = typeList.GetElementCount();
		for (JIndex i=1; i<=typeCount; i++)
			{
			const Atom type = typeList.GetElement(i);
			std::cout << XGetAtomName(*display, type) << std::endl;
			}

		for (JIndex i=1; i<=typeCount; i++)
			{
			const Atom type = typeList.GetElement(i);
			if (type == XA_STRING ||
				type == selMgr->GetUtf8StringXAtom() ||
				type == selMgr->GetMimePlainTextXAtom())
				{
				std::cout << std::endl;
				PrintSelectionText(kJXClipboardName, time, type);
				}
			}
		}
	else
		{
		std::cout << std::endl;
		std::cout << "Unable to access the clipboard." << std::endl;
		std::cout << std::endl;
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:43,代码来源:TestWidget.cpp

示例14: lineIndexRegex

void
JExtractFileAndLine
	(
	const JCharacter*	str,
	JString*			fileName,
	JIndex*				startLineIndex,
	JIndex*				endLineIndex
	)
{
	static JRegex lineIndexRegex(":([0-9]+)(-([0-9]+))?$");

	*fileName = str;

	JArray<JIndexRange> matchList;
	if (lineIndexRegex.Match(*fileName, &matchList))
		{
		JString s   = fileName->GetSubstring(matchList.GetElement(2));
		JBoolean ok = s.ConvertToUInt(startLineIndex);
		assert( ok );

		const JIndexRange endRange = matchList.GetElement(4);
		if (endLineIndex != NULL && !endRange.IsEmpty())
			{
			s  = fileName->GetSubstring(endRange);
			ok = s.ConvertToUInt(endLineIndex);
			assert( ok );
			}
		else if (endLineIndex != NULL)
			{
			*endLineIndex = *startLineIndex;
			}

		fileName->RemoveSubstring(matchList.GetElement(1));
		}
	else
		{
		*startLineIndex = 0;
		if (endLineIndex != NULL)
			{
			*endLineIndex = 0;
			}
		}
}
开发者ID:mta1309,项目名称:mulberry-lib-jx,代码行数:43,代码来源:jFileUtil.cpp

示例15:

static void
jCleanUserInfoMap()
{
	const JSize count = theUserInfoMap.GetElementCount();
	for (JIndex i=1; i<=count; i++)
		{
		jUIDInfo info = theUserInfoMap.GetElement(i);
		info.Free();
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:10,代码来源:jSysUtil_UNIX.cpp


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