本文整理汇总了C++中BObjectList类的典型用法代码示例。如果您正苦于以下问题:C++ BObjectList类的具体用法?C++ BObjectList怎么用?C++ BObjectList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BObjectList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PackageAttribute
void
WriterImplBase::RegisterPackageResolvableExpressionList(
PackageAttributeList& attributeList,
const BObjectList<BPackageResolvableExpression>& expressionList, uint8 id)
{
for (int i = 0; i < expressionList.CountItems(); ++i) {
BPackageResolvableExpression* resolvableExpr = expressionList.ItemAt(i);
bool hasVersion = resolvableExpr->Version().InitCheck() == B_OK;
PackageAttribute* name = new PackageAttribute((BHPKGAttributeID)id,
B_HPKG_ATTRIBUTE_TYPE_STRING,
B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE);
name->string = fPackageStringCache.Get(resolvableExpr->Name().String());
attributeList.Add(name);
if (hasVersion) {
PackageAttribute* op = new PackageAttribute(
B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR,
B_HPKG_ATTRIBUTE_TYPE_UINT,
B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
op->unsignedInt = resolvableExpr->Operator();
name->children.Add(op);
RegisterPackageVersion(name->children, resolvableExpr->Version());
}
}
}
示例2: if
BSolverPackage*
PackageManager::_GetSolverPackage(PackageInfoRef package)
{
int32 flags = BSolver::B_FIND_IN_NAME;
if (package->State() == ACTIVATED || package->State() == INSTALLED)
flags |= BSolver::B_FIND_INSTALLED_ONLY;
BObjectList<BSolverPackage> packages;
status_t result = Solver()->FindPackages(package->Title(),
flags, packages);
if (result == B_OK) {
for (int32 i = 0; i < packages.CountItems(); i++) {
BSolverPackage* solverPackage = packages.ItemAt(i);
if (solverPackage->Name() != package->Title())
continue;
else if (package->State() == NONE
&& dynamic_cast<BPackageManager::RemoteRepository*>(
solverPackage->Repository()) == NULL) {
continue;
}
return solverPackage;
}
}
return NULL;
}
示例3: AddOneUniqueDocumentType
static const entry_ref*
AddOneUniqueDocumentType(const entry_ref* ref, void* castToList)
{
BObjectList<BString>* list = (BObjectList<BString>*)castToList;
BEntry entry(ref, true);
// traverse symlinks
// get this documents type
char type[B_MIME_TYPE_LENGTH];
BFile file(&entry, O_RDONLY);
if (file.InitCheck() != B_OK)
return 0;
BNodeInfo info(&file);
if (info.GetType(type) != B_OK)
return 0;
if (list->EachElement(FindOne, &type))
// type already in list, bail
return 0;
// add type to list
list->AddItem(new BString(type));
return 0;
}
示例4: new
/*static*/ status_t
SpecificImageDebugInfo::GetFunctionsFromSymbols(
const BObjectList<SymbolInfo>& symbols,
BObjectList<FunctionDebugInfo>& functions, DebuggerInterface* interface,
const ImageInfo& imageInfo, SpecificImageDebugInfo* info)
{
// create the function infos
int32 functionsAdded = 0;
for (int32 i = 0; SymbolInfo* symbol = symbols.ItemAt(i); i++) {
if (symbol->Type() != B_SYMBOL_TYPE_TEXT)
continue;
FunctionDebugInfo* function = new(std::nothrow) BasicFunctionDebugInfo(
info, symbol->Address(), symbol->Size(), symbol->Name(),
Demangler::Demangle(symbol->Name()));
if (function == NULL || !functions.AddItem(function)) {
delete function;
int32 index = functions.CountItems() - 1;
for (; functionsAdded >= 0; functionsAdded--, index--) {
function = functions.RemoveItemAt(index);
delete function;
}
return B_NO_MEMORY;
}
functionsAdded++;
}
return B_OK;
}
示例5:
void
PairsView::Draw(BRect updateRect)
{
BObjectList<BBitmap>* bitmapsList;
switch (fIconSize) {
case kSmallIconSize:
bitmapsList = fSmallBitmapsList;
break;
case kLargeIconSize:
bitmapsList = fLargeBitmapsList;
break;
case kMediumIconSize:
default:
bitmapsList = fMediumBitmapsList;
}
for (int32 i = 0; i < fButtonsCount; i++) {
SetDrawingMode(B_OP_ALPHA);
DrawBitmap(bitmapsList->ItemAt(i % (fButtonsCount / 2)),
BPoint(fPositionX[i], fPositionY[i]));
SetDrawingMode(B_OP_COPY);
}
}
示例6: lock
void
TTracker::MoveRefsToTrash(const BMessage *message)
{
int32 count;
uint32 type;
message->GetInfo("refs", &type, &count);
if (count <= 0)
return;
BObjectList<entry_ref> *srcList = new BObjectList<entry_ref>(count, true);
for (int32 index = 0; index < count; index++) {
entry_ref ref;
ASSERT(message->FindRef("refs", index, &ref) == B_OK);
if (message->FindRef("refs", index, &ref) != B_OK)
continue;
AutoLock<WindowList> lock(&fWindowList);
BContainerWindow *window = FindParentContainerWindow(&ref);
if (window)
// if we have a window open for this entry, ask the pose to
// delete it, this will select the next entry
window->PoseView()->MoveEntryToTrash(&ref);
else
// add all others to a list that gets deleted separately
srcList->AddItem(new entry_ref(ref));
}
if (srcList->CountItems())
// async move to trash
FSMoveToTrash(srcList);
}
示例7: RemoveNickFromList
void ChannelAgent::RemoveNickFromList(BObjectList<BString>& list, const char* data)
{
int32 count(list.CountItems());
for (int32 i = 0; i < count; i++) {
if (list.ItemAt(i)->ICompare(data) == 0) {
delete list.RemoveItemAt(i);
break;
}
}
}
示例8:
BObjectList<TaskList>* TaskMerge::GetTaskLists()
{
//run throught all TaskSyncer and get the TaskLists
BObjectList<TaskList> *listOfLists = new BObjectList<TaskList>();
int32 i = 0;
for (i=0;i<syncerList->CountItems();i++){
listOfLists->AddList(syncerList->ItemAt(i)->GetTaskLists());
}
return listOfLists;
}
示例9: CompareLists
// TODO: move this to the KeyStore or the registrar backend if needed
static bool
CompareLists(BObjectList<BString> a, BObjectList<BString> b)
{
if (a.CountItems() != b.CountItems())
return false;
for (int32 i = 0; i < a.CountItems(); i++) {
if (*a.ItemAt(i) != *b.ItemAt(i))
return false;
}
return true;
}
示例10: PoseView
void
TFilePanel::OpenDirectory()
{
BObjectList<BPose>* list = PoseView()->SelectionList();
if (list->CountItems() != 1)
return;
Model* model = list->FirstItem()->TargetModel();
if (model->ResolveIfLink()->IsDirectory()) {
BMessage message(B_REFS_RECEIVED);
message.AddRef("refs", model->EntryRef());
PostMessage(&message);
}
}
示例11:
BObjectList<Task>* TaskFS::GetTasks(TaskList forList)
{
Task *tmpTask = NULL;
BObjectList<Task> *taskTaskList = new BObjectList<Task>();
int32 i;
//grab a up to date List of Items
GetTasks();
for (i = 0; i<tasks->CountItems();i++) {
tmpTask=tasks->ItemAt(i);
if (*(tmpTask->GetTaskList()) == forList)
taskTaskList->AddItem(tmpTask);
}
return taskTaskList;
}
示例12: symbols
status_t
ImageDebugInfo::FinishInit(DebuggerInterface* interface)
{
BObjectList<SymbolInfo> symbols(50, true);
status_t error = interface->GetSymbolInfos(fImageInfo.TeamID(),
fImageInfo.ImageID(), symbols);
if (error != B_OK)
return error;
symbols.SortItems(&_CompareSymbols);
// get functions -- get them from most expressive debug info first and add
// missing functions from less expressive debug infos
for (int32 i = 0; SpecificImageDebugInfo* specificInfo
= fSpecificInfos.ItemAt(i); i++) {
BObjectList<FunctionDebugInfo> functions;
error = specificInfo->GetFunctions(symbols, functions);
if (error != B_OK)
return error;
for (int32 k = 0; FunctionDebugInfo* function = functions.ItemAt(k);
k++) {
if (FunctionAtAddress(function->Address()) != NULL)
continue;
FunctionInstance* instance = new(std::nothrow) FunctionInstance(
this, function);
if (instance == NULL
|| !fFunctions.BinaryInsert(instance, &_CompareFunctions)) {
delete instance;
error = B_NO_MEMORY;
break;
}
if (function->IsMain())
fMainFunction = instance;
}
// Remove references returned by the specific debug info -- the
// FunctionInstance objects have references, now.
for (int32 k = 0; FunctionDebugInfo* function = functions.ItemAt(k);
k++) {
function->ReleaseReference();
}
if (error != B_OK)
return error;
}
return B_OK;
}
示例13: locker
status_t
DebugReportGenerator::_DumpRunningThreads(BFile& _output)
{
AutoLocker< ::Team> locker(fTeam);
BString data("\nActive Threads:\n");
WRITE_AND_CHECK(_output, data);
BObjectList< ::Thread> threads;
::Thread* thread;
for (ThreadList::ConstIterator it = fTeam->Threads().GetIterator();
(thread = it.Next());) {
threads.AddItem(thread);
}
threads.SortItems(&_CompareThreads);
for (int32 i = 0; (thread = threads.ItemAt(i)) != NULL; i++) {
try {
data.SetToFormat("\tthread %" B_PRId32 ": %s %s\n", thread->ID(),
thread->Name(), thread->IsMainThread()
? "(main)" : "");
WRITE_AND_CHECK(_output, data);
if (thread->State() == THREAD_STATE_STOPPED) {
data.SetToFormat("\t\tstate: %s",
UiUtils::ThreadStateToString(thread->State(),
thread->StoppedReason()));
const BString& stoppedInfo = thread->StoppedReasonInfo();
if (stoppedInfo.Length() != 0)
data << " (" << stoppedInfo << ")";
data << "\n\n";
WRITE_AND_CHECK(_output, data);
// we need to release our lock on the team here
// since we might need to block and wait
// on the stack trace.
BReference< ::Thread> threadRef(thread);
locker.Unlock();
status_t error = _DumpDebuggedThreadInfo(_output, thread);
if (error != B_OK)
return error;
locker.Lock();
}
} catch (...) {
return B_NO_MEMORY;
}
}
return B_OK;
}
示例14: BMenu
BMenu*
MenuBuilder::BuildMenu(KeyBind* bind, MenuFilter* filter,
CustomMenuCreator* custom)
{
if (bind == NULL)
return NULL;
// The first item describe the menu
BMenu* menu = new BMenu(bind[0].label);
if (filter != NULL)
filter->FilterMenu(menu, bind[0].message);
BObjectList<BMenu> menuList;
menuList.AddItem(menu);
for (int i = 1; bind[i].itemType != FABER_EOF; i++) {
menu = menuList.ItemAt(menuList.CountItems()-1);
if (bind[i].itemType == FABER_ITEM_START) {
BMenu* subMenu = NULL;
subMenu = new BMenu(bind[i].label);
if (filter != NULL)
filter->FilterMenu(subMenu, bind[i].message);
menu->AddItem(subMenu);
menuList.AddItem(subMenu);
} else if (bind[i].itemType == FABER_ITEM_END) {
if (menuList.CountItems() > 1)
menuList.RemoveItemAt(menuList.CountItems()-1);
} else if (bind[i].itemType == FABER_CUSTOM_ITEM) {
if (custom == NULL)
continue;
BMenu* customMenu = custom->CreateCustomMenu(bind[i].message);
if (customMenu != NULL)
menu->AddItem(customMenu);
} else if (bind[i].itemType == FABER_SUBITEM) {
BMenuItem* item = BuildMenuItem(bind[i].message, bind[i].label);
if (filter != NULL)
filter->FilterItem(item, bind[i].message);
menu->AddItem(item);
} else if (bind[i].itemType == FABER_SPLITTER)
menu->AddItem(new BSeparatorItem());
}
return menuList.ItemAt(0);
}
示例15: AccountListItem
void
PreferencesAccounts::_LoadListView(ProtocolSettings* settings)
{
if (!settings)
return;
BObjectList<BString> accounts = settings->Accounts();
// Add accounts to list view
for (int32 i = 0; i < accounts.CountItems(); i++) {
BString* account = accounts.ItemAt(i);
AccountListItem* listItem
= new AccountListItem(settings, account->String());
fListView->AddItem(listItem);
}
}