本文整理汇总了C++中JPtrArray::NthElement方法的典型用法代码示例。如果您正苦于以下问题:C++ JPtrArray::NthElement方法的具体用法?C++ JPtrArray::NthElement怎么用?C++ JPtrArray::NthElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPtrArray
的用法示例。
在下文中一共展示了JPtrArray::NthElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JPrepArgForExec
void
SyGViewManPageDialog::ViewManPages
(
const JPtrArray<JString>& list
)
{
if (itsViewCmd == kDefaultViewCmd)
{
JString cmd = kDefaultViewBin;
const JSize count = list.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
cmd += kDefaultViewArg;
cmd += JPrepArgForExec(*(list.NthElement(i)));
}
JSimpleProcess::Create(cmd, kJTrue);
}
else
{
const JSize count = list.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
ViewManPage(*(list.NthElement(i)));
}
}
}
示例2:
void
JWebBrowser::ShowFileLocations
(
const JPtrArray<JString>& fileList
)
{
if (fileList.IsEmpty())
{
return;
}
const JSize count = fileList.GetElementCount();
if (itsShowFileLocationCmd.Contains("$"))
{
for (JIndex i=1; i<=count; i++)
{
ShowFileLocation(*(fileList.NthElement(i)));
}
}
else
{
JString s = itsShowFileLocationCmd;
for (JIndex i=1; i<=count; i++)
{
s += " '";
s += *(fileList.NthElement(i));
s += "'";
}
JSimpleProcess::Create(s, kJTrue);
}
}
示例3: cell
void
JXTreeListWidget::SelectNodes
(
const JPtrArray<JTreeNode>& list
)
{
JTableSelection& s = GetTableSelection();
const JSize count = list.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
const JTreeNode* node = list.NthElement(i);
JIndex index;
if (itsTreeList->FindNode(node, &index))
{
const JPoint cell(itsNodeColIndex, index);
s.SelectCell(cell);
if (!s.HasAnchor())
{
s.SetAnchor(cell);
}
s.SetBoat(cell);
}
}
}
示例4: JExecute
JError
JExecute
(
const JPtrArray<JString>& argList,
pid_t* childPID,
const JExecuteAction toAction,
int* toFD,
const JExecuteAction fromAction,
int* fromFD,
const JExecuteAction errAction,
int* errFD
)
{
const JSize argc = argList.GetElementCount();
const JCharacter** argv = new const JCharacter* [ argc+1 ];
assert( argv != NULL );
for (JIndex i=1; i<=argc; i++)
{
argv[i-1] = *(argList.NthElement(i));
}
argv[argc] = NULL;
const JError err = JExecute(argv, (argc+1) * sizeof(JCharacter*), childPID,
toAction, toFD, fromAction, fromFD,
errAction, errFD);
delete [] argv;
return err;
}
示例5:
SyGDuplicateProcess::SyGDuplicateProcess
(
SyGFileTreeTable* table,
const JPtrArray<SyGFileTreeNode>& nodeList
)
:
itsTable(table),
itsNodeList(JPtrArrayT::kForgetAll),
itsFullNameList(JPtrArrayT::kDeleteAll),
itsProcess(NULL),
itsShouldEditFlag(JI2B(nodeList.GetElementCount() == 1))
{
(itsTable->GetTableSelection()).ClearSelection();
ClearWhenGoingAway(itsTable, &itsTable);
const JSize count = nodeList.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
SyGFileTreeNode* node = const_cast<SyGFileTreeNode*>(nodeList.NthElement(i));
itsNodeList.Append(node);
itsFullNameList.Append((node->GetDirEntry())->GetFullName());
ListenTo(node);
}
ProcessNextFile();
}
示例6:
void
CBStringCompleter::CopySymbolsForLanguage
(
const CBLanguage lang
)
{
JPtrArray<CBProjectDocument>* docList =
(CBGetDocumentManager())->GetProjectDocList();
const JSize docCount = docList->GetElementCount();
for (JIndex i=1; i<=docCount; i++)
{
const CBSymbolList* symbolList =
((docList->NthElement(i))->GetSymbolDirector())->GetSymbolList();
const JSize symbolCount = symbolList->GetElementCount();
for (JIndex j=1; j<=symbolCount; j++)
{
CBLanguage l;
CBSymbolList::Type type;
JBoolean fullyQualifiedFileScope;
const JString& symbolName =
symbolList->GetSymbol(j, &l, &type, &fullyQualifiedFileScope);
if (l == lang && !fullyQualifiedFileScope)
{
Add(const_cast<JString*>(&symbolName));
}
}
}
}
示例7:
void
GenerateHeader
(
ostream& output,
const JPtrArray<JString>& objTypes,
const JPtrArray<JString>& objNames
)
{
JIndex i;
const JSize count = objTypes.GetElementCount();
assert( count == objNames.GetElementCount() );
// get width of longest type
JSize maxLen = 0;
for (i=1; i<=count; i++)
{
const JString* type = objTypes.NthElement(i);
const JSize len = type->GetLength();
if (len > maxLen)
{
maxLen = len;
}
}
// declare each object
for (i=1; i<=count; i++)
{
output << " ";
const JString* type = objTypes.NthElement(i);
type->Print(output);
output << '*';
const JSize len = type->GetLength();
for (JIndex j=len+1; j<=maxLen+1; j++)
{
output << ' ';
}
(objNames.NthElement(i))->Print(output);
output << ';' << endl;
}
// need blank line to conform to expectations of CopyAfterCodeDelimiter
output << endl;
}
示例8: newInfo
void
CBApp::CollectSearchPaths
(
CBDirInfoList* searchPaths
)
const
{
searchPaths->DeleteAll();
searchPaths->SetCompareFunction(CBDirInfo::ComparePathNames);
JPtrArray<CBProjectDocument>* docList =
(CBGetDocumentManager())->GetProjectDocList();
const JSize docCount = docList->GetElementCount();
JString truePath;
JBoolean recurse;
for (JIndex j=1; j<=docCount; j++)
{
CBProjectDocument* doc = docList->NthElement(j);
const CBDirList& dirList = doc->GetDirectories();
const JSize count = dirList.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
if (dirList.GetTruePath(i, &truePath, &recurse))
{
CBDirInfo newInfo(jnew JString(truePath), recurse);
assert( newInfo.path != NULL );
newInfo.projIndex = j;
JBoolean found;
const JIndex index =
searchPaths->SearchSorted1(newInfo, JOrderedSetT::kAnyMatch, &found);
if (found)
{
// compute OR of recurse flags
CBDirInfo existingInfo = searchPaths->GetElement(index);
if (newInfo.recurse && !existingInfo.recurse)
{
existingInfo.recurse = kJTrue;
searchPaths->SetElement(index, existingInfo);
}
jdelete newInfo.path;
}
else
{
searchPaths->InsertElementAtIndex(index, newInfo);
}
}
}
}
searchPaths->SetCompareFunction(CBDirInfo::CompareProjIndex);
searchPaths->Sort();
}
示例9:
JBoolean
CBSymbolList::InContext
(
const JString& fullName,
const JPtrArray<JString>& contextNamespace,
const JBoolean caseSensitive
)
const
{
const JSize count = contextNamespace.GetElementCount();
for (JIndex i=1; i<=count; i+=2)
{
const JString* cns1 = contextNamespace.NthElement(i);
const JString* cns2 = contextNamespace.NthElement(i+1);
if (fullName.BeginsWith(*cns1, caseSensitive) ||
fullName.Contains(*cns2, caseSensitive))
{
return kJTrue;
}
}
return kJFalse;
}
示例10: aliases
void
SMTPMessage::ReplaceAliases
(
JPtrArray<JString>& names
)
{
JPtrArray<JString> aliases(JPtrArrayT::kForgetAll);
aliases.SetCompareFunction(JCompareStringsCaseSensitive);
JSize i = 1;
while (i <= names.GetElementCount())
{
JString& name = *(names.NthElement(i));
JString alias;
JString fcc;
if (GGetAddressBookMgr()->NameIsAlias(name, alias, fcc))
{
JIndex findex;
if (!aliases.SearchSorted(&name, JOrderedSetT::kAnyMatch, &findex))
{
GParseNameList(alias, names);
aliases.InsertSorted(names.NthElement(i));
names.RemoveElement(i);
}
else
{
names.DeleteElement(i);
}
// GParseNameList(fcc, names);
}
else
{
i++;
}
}
aliases.DeleteAll();
}
示例11:
void
GPrefsMgr::SetUIDList
(
const JPtrArray<JString>& list
)
{
const JSize count = list.GetElementCount();
std::ostringstream data;
data << count;
for (JIndex i=1; i<=count; i++)
{
data << ' ' << *(list.NthElement(i));
}
SetData(kGUIDListID, data);
}
示例12: JGetString
void
JXDocktab::UpdateActionMenu()
{
JXDockManager* dockMgr;
if (!JXGetDockManager(&dockMgr))
{
itsActionMenu->RemoveAllItems();
return;
}
while (itsActionMenu->GetItemCount() >= kShowFirstDockCmd)
{
itsActionMenu->RemoveItem(itsActionMenu->GetItemCount());
}
JPtrArray<JXDockDirector>* dockList = dockMgr->GetDockList();
const JSize dockCount = dockList->GetElementCount();
for (JIndex i=1; i<=dockCount; i++)
{
JString itemText = ((dockList->NthElement(i))->GetWindow())->GetTitle();
itemText.Prepend(JGetString(kShowDockPrefixID));
itsActionMenu->AppendItem(itemText);
}
const JBoolean isDocked = (GetWindow())->IsDocked();
itsActionMenu->SetItemEnable(kUndockCmd, isDocked);
itsActionMenu->SetItemEnable(kUndockAllCompartmentCmd, isDocked);
itsActionMenu->SetItemEnable(kUndockAllDockCmd, isDocked);
itsActionMenu->SetItemEnable(kUndockAllCmd, JI2B(dockCount > 0));
itsActionMenu->SetItemEnable(kDockAllDefConfigCmd, dockMgr->CanDockAll());
itsActionMenu->SetItemEnable(kUpdateWindowTypeMapCmd, (GetWindow())->HasWindowType());
if (isDocked)
{
itsActionMenu->SetItemText(kUpdateWindowTypeMapCmd, JGetString(kAddToWindowTypeMapID));
}
else
{
itsActionMenu->SetItemText(kUpdateWindowTypeMapCmd, JGetString(kRemoveFromWindowTypeMapID));
}
}
示例13: CBGetDocumentManager
void
CBEditProjPrefsDialog::UpdateSettings()
{
(CBGetApplication())->DisplayBusyCursor();
const JBoolean reopenTextFiles = itsReopenTextFilesCB->IsChecked();
const JBoolean doubleSpaceCompile = itsDoubleSpaceCB->IsChecked();
const JBoolean rebuildMakefileDaily = itsRebuildMakefileDailyCB->IsChecked();
const CBProjectTable::DropFileAction dropFileAction =
(CBProjectTable::DropFileAction) itsDropFileActionRG->GetSelectedItem();
CBDocumentManager* docMgr = CBGetDocumentManager();
JPtrArray<CBProjectDocument>* docList = docMgr->GetProjectDocList();
const JSize docCount = docList->GetElementCount();
for (JIndex i=1; i<=docCount; i++)
{
(docList->NthElement(i))->
SetProjectPrefs(reopenTextFiles, doubleSpaceCompile,
rebuildMakefileDaily, dropFileAction);
}
}
示例14: Instance
void
JXFSBindingManager::Exec
(
const JPtrArray<JString>& fileList,
const JBoolean ignoreBindings
)
{
if (fileList.IsEmpty())
{
return;
}
JXFSBindingManager* me = Instance();
if (me->itsFileList == NULL)
{
me->itsFileList = new JPtrArray<JFSBinding>(JPtrArrayT::kDeleteAll);
assert( me->itsFileList != NULL );
me->itsFileList->SetCompareFunction(ComparePatterns);
}
const JSize count = fileList.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
const JString* fileName = fileList.NthElement(i);
JFSBinding* f = new JFSBinding(*fileName, "", JFSBinding::kRunPlain, kJTrue, kJFalse);
assert( f != NULL );
if (!me->itsFileList->InsertSorted(f, kJFalse))
{
delete f;
}
}
me->itsIgnoreBindingsFlag = ignoreBindings;
me->ProcessFiles();
}
示例15: optionMap
void
ApplyOptions
(
ostream& output,
const JString& className,
const JString& formName,
const JString& tagName,
const JString& varName,
const JPtrArray<JString>& values,
const JString& flSize,
const JString& flStyle,
const JString& flColor,
JStringManager* stringMgr
)
{
ifstream optionMap(optionMapFile);
optionMap >> ws;
while (1)
{
if (optionMap.peek() == '#')
{
JIgnoreLine(optionMap);
}
else
{
const JString aClassName = JReadUntilws(optionMap);
if (optionMap.eof() || optionMap.fail())
{
break;
}
else if (aClassName != className)
{
for (JIndex i=1; i<=kOptionCount; i++)
{
JIgnoreLine(optionMap);
}
}
else
{
JIndex i;
JBoolean supported;
// shortcuts
optionMap >> ws >> supported;
if (supported)
{
optionMap >> ws;
const JString function = JReadUntilws(optionMap);
const JString* value = values.NthElement(kShortcutsIndex);
if (!value->IsEmpty())
{
JString id = varName;
id += "::";
id += formName;
id += "::shortcuts::";
id += tagName; // last since it is almost always the same
output << " ";
varName.Print(output);
output << "->";
function.Print(output);
output << "(JGetString(\"";
id.Print(output);
output << "\"));" << endl;
JString* s = new JString(*value);
assert( s != NULL );
stringMgr->SetElement(id, s, JPtrArrayT::kDelete);
}
}
else
{
JIgnoreLine(optionMap);
}
// colors
for (i=2; i<=kOptionCount; i++)
{
optionMap >> ws >> supported;
if (supported)
{
optionMap >> ws;
const JString defValue = JReadUntilws(optionMap);
const JString function = JReadUntilws(optionMap);
const JString* value = values.NthElement(i);
if (*value != defValue)
{
JString jxColor;
if (ConvertXFormsColor(*value, &jxColor))
{
output << " ";
varName.Print(output);
output << "->";
function.Print(output);
output << '(';
jxColor.Print(output);
output << ");" << endl;
}
//.........这里部分代码省略.........