2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
12 #include <ObjectList.h>
14 #include <StringList.h>
16 #include "QueryList.h"
21 Person(const entry_ref
& ref
);
24 const BString
& Name() const
27 int32
CountAddresses() const
28 { return fAddresses
.CountStrings(); }
29 BString
AddressAt(int32 index
) const
30 { return fAddresses
.StringAt(index
); }
32 int32
CountGroups() const
33 { return fGroups
.CountStrings(); }
34 BString
GroupAt(int32 index
) const
35 { return fGroups
.StringAt(index
); }
36 bool IsInGroup(const char* group
) const;
40 BStringList fAddresses
;
45 class PersonList
: public QueryListener
, public BLocker
{
47 PersonList(QueryList
& query
);
50 int32
CountPersons() const
51 { return fPersons
.CountItems(); }
52 const Person
* PersonAt(int32 index
) const
53 { return fPersons
.ItemAt(index
); }
55 virtual void EntryCreated(QueryList
& source
,
56 const entry_ref
& ref
, ino_t node
);
57 virtual void EntryRemoved(QueryList
& source
,
58 const node_ref
& nodeRef
);
61 typedef std::map
<node_ref
, Person
*> PersonMap
;
63 QueryList
& fQueryList
;
64 BObjectList
<Person
> fPersons
;
69 class GroupList
: public QueryListener
, public BLocker
{
71 GroupList(QueryList
& query
);
74 int32
CountGroups() const
75 { return fGroups
.CountStrings(); }
76 BString
GroupAt(int32 index
) const
77 { return fGroups
.StringAt(index
); }
79 virtual void EntryCreated(QueryList
& source
,
80 const entry_ref
& ref
, ino_t node
);
81 virtual void EntryRemoved(QueryList
& source
,
82 const node_ref
& nodeRef
);
85 typedef std::map
<BString
, int> StringCountMap
;
87 QueryList
& fQueryList
;
89 StringCountMap fGroupMap
;
93 #endif // ADDRESS_TEXT_CONTROL_H