2 * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
6 #include <Application.h>
7 #include <TokenSpace.h>
9 #include "AppInfoListMessagingTargetSet.h"
10 #include "RosterAppInfo.h"
13 AppInfoListMessagingTargetSet::AppInfoListMessagingTargetSet(
14 AppInfoList
&list
, bool skipRegistrar
)
17 fSkipRegistrar(skipRegistrar
)
19 _SkipFilteredOutInfos();
23 AppInfoListMessagingTargetSet::~AppInfoListMessagingTargetSet()
29 AppInfoListMessagingTargetSet::HasNext() const
31 return fIterator
.IsValid();
36 AppInfoListMessagingTargetSet::Next(port_id
&port
, int32
&token
)
38 if (!fIterator
.IsValid())
41 port
= (*fIterator
)->port
;
42 token
= B_PREFERRED_TOKEN
;
45 _SkipFilteredOutInfos();
52 AppInfoListMessagingTargetSet::Rewind()
54 fIterator
= fList
.It();
59 AppInfoListMessagingTargetSet::Filter(const RosterAppInfo
*info
)
64 return (!fSkipRegistrar
|| info
->team
!= be_app
->Team());
67 // _SkipFilteredOutInfos
69 AppInfoListMessagingTargetSet::_SkipFilteredOutInfos()
71 while (fIterator
.IsValid() && !Filter(*fIterator
))