52 return (
reinterpret_cast<uintptr_t
>(
p) & 0x01) == 0x01;
57 reinterpret_cast<uintptr_t&
>(rp) |= 0x01;
60static void sortListeners(std::vector<SvtListener*>& listeners,
size_t firstUnsorted)
65 auto sortedEnd = firstUnsorted == 0
66 ? std::is_sorted_until(listeners.begin(),listeners.end())
67 : listeners.begin() + firstUnsorted;
68 if( listeners.end() - sortedEnd == 1 )
72 listeners.insert( std::upper_bound( listeners.begin(), listeners.end(), item ), item );
76 std::sort( sortedEnd, listeners.end());
77 std::inplace_merge( listeners.begin(), sortedEnd, listeners.end());
81 std::sort(listeners.begin(), listeners.end());
111 assert(!
mbDisposing &&
"called inside my own destructor?");
112 assert(!
mbAboutToDie &&
"called after PrepareForDestruction()?");
173 mnEmptySlots(0), mnListenersFirstUnsorted(0),
174 mbAboutToDie(false), mbDisposing(false),
175 mbDestNormalized(true)
177 assert(!rBC.
mbAboutToDie &&
"copying an object marked with PrepareForDestruction()?");
178 assert(!rBC.
mbDisposing &&
"copying an object that is in its destructor?");
183 p->StartListening(*
this);
204 rpListener->BroadcasterDying(*
this);
221 rpListener->Notify(rHint);
static void markDeletedPtr(SvtListener *&rp)
static bool isDeletedPtr(SvtListener *p)
static void sortListeners(std::vector< SvtListener * > &listeners, size_t firstUnsorted)
bool HasListeners() const
sal_Int32 mnEmptySlots
Note that this class is very performance sensitive, so the following fields have been carefully sized...
ListenersType maDestructedListeners
When the broadcaster is about to die, collect listeners that asked for removal.
void Broadcast(const SfxHint &rHint)
virtual ~SvtBroadcaster()
ListenersType maListeners
contains only one of each listener, which is enforced by SvtListener
sal_Int32 mnListenersFirstUnsorted
virtual void ListenersGone()
void Normalize() const
Ensure that the container doesn't contain any duplicated listener entries.
void Remove(SvtListener *p)
bool mbAboutToDie
Indicate that this broadcaster will be destructed (we indicate this on all ScColumn's broadcasters du...
void PrepareForDestruction()
Listeners and broadcasters are M:N relationship.
std::vector< SvtListener * > ListenersType
ListenersType & GetAllListeners()
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)