RemoteDrawingEngine: Reduce RP_READ_BITMAP result timeout.
[haiku.git] / src / apps / mail / People.h
blob1d53e4617f8aa4600b271a0b32b6ec3f8de9104f
1 /*
2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef PEOPLE_H
6 #define PEOPLE_H
9 #include <map>
11 #include <Locker.h>
12 #include <ObjectList.h>
13 #include <String.h>
14 #include <StringList.h>
16 #include "QueryList.h"
19 class Person {
20 public:
21 Person(const entry_ref& ref);
22 virtual ~Person();
24 const BString& Name() const
25 { return fName; }
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;
38 private:
39 BString fName;
40 BStringList fAddresses;
41 BStringList fGroups;
45 class PersonList : public QueryListener, public BLocker {
46 public:
47 PersonList(QueryList& query);
48 ~PersonList();
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);
60 private:
61 typedef std::map<node_ref, Person*> PersonMap;
63 QueryList& fQueryList;
64 BObjectList<Person> fPersons;
65 PersonMap fPersonMap;
69 class GroupList : public QueryListener, public BLocker {
70 public:
71 GroupList(QueryList& query);
72 ~GroupList();
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);
84 private:
85 typedef std::map<BString, int> StringCountMap;
87 QueryList& fQueryList;
88 BStringList fGroups;
89 StringCountMap fGroupMap;
93 #endif // ADDRESS_TEXT_CONTROL_H