BPicture: Fix archive constructor.
[haiku.git] / src / kits / app / MessageFilter.cpp
blobc78fd32ea432db68588d0258cf6d9cbd68391286
1 /*
2 * Copyright 2001-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Erik Jaesler (erik@cgsoftware.com)
7 */
10 #include <MessageFilter.h>
13 BMessageFilter::BMessageFilter(uint32 inWhat, filter_hook func)
15 fFiltersAny(false),
16 fWhat(inWhat),
17 fDelivery(B_ANY_DELIVERY),
18 fSource(B_ANY_SOURCE),
19 fLooper(NULL),
20 fFilterFunction(func)
25 BMessageFilter::BMessageFilter(message_delivery delivery,
26 message_source source, filter_hook func)
28 fFiltersAny(true),
29 fWhat(0),
30 fDelivery(delivery),
31 fSource(source),
32 fLooper(NULL),
33 fFilterFunction(func)
38 BMessageFilter::BMessageFilter(message_delivery delivery,
39 message_source source, uint32 inWhat, filter_hook func)
41 fFiltersAny(false),
42 fWhat(inWhat),
43 fDelivery(delivery),
44 fSource(source),
45 fLooper(NULL),
46 fFilterFunction(func)
51 BMessageFilter::BMessageFilter(const BMessageFilter& filter)
53 *this = filter;
57 BMessageFilter::BMessageFilter(const BMessageFilter* filter)
59 *this = *filter;
63 BMessageFilter::~BMessageFilter()
68 BMessageFilter &
69 BMessageFilter::operator=(const BMessageFilter& from)
71 fFiltersAny = from.FiltersAnyCommand();
72 fWhat = from.Command();
73 fDelivery = from.MessageDelivery();
74 fSource = from.MessageSource();
75 fFilterFunction = from.FilterFunction();
77 SetLooper(from.Looper());
79 return *this;
83 filter_result
84 BMessageFilter::Filter(BMessage* message, BHandler** target)
86 return B_DISPATCH_MESSAGE;
90 message_delivery
91 BMessageFilter::MessageDelivery() const
93 return fDelivery;
97 message_source
98 BMessageFilter::MessageSource() const
100 return fSource;
104 uint32
105 BMessageFilter::Command() const
107 return fWhat;
111 bool
112 BMessageFilter::FiltersAnyCommand() const
114 return fFiltersAny;
118 BLooper*
119 BMessageFilter::Looper() const
121 return fLooper;
125 void BMessageFilter::_ReservedMessageFilter1() {}
126 void BMessageFilter::_ReservedMessageFilter2() {}
129 void
130 BMessageFilter::SetLooper(BLooper* owner)
132 fLooper = owner;
136 filter_hook
137 BMessageFilter::FilterFunction() const
139 return fFilterFunction;