-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnsCallLog.cpp
140 lines (114 loc) · 2.55 KB
/
nsCallLog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "nsCallLog.h"
/* ************************* */
/* nsList */
/* ************************* */
NS_IMPL_ISUPPORTS1(nsList, nsIList)
nsList::nsList(): mList(nsnull)
{
length = 0;
if (!mList) {
mList = do_CreateInstance(NS_ARRAY_CONTRACTID);
}
}
nsList::~nsList(){}
/* nsICallLog item (in unsigned long index); */
NS_IMETHODIMP nsList::Item(PRUint32 index, nsICallLog **_retval NS_OUTPARAM)
{
if (index >= length)
return NS_OK;
nsCOMPtr<nsCallLog> cl;
(nsIArray*)mList->QueryElementAt(index, NS_GET_IID(nsCallLog), getter_AddRefs(cl));
*_retval = cl;
return NS_OK;
}
/* readonly attribute unsigned long length; */
NS_IMETHODIMP nsList::GetLength(PRUint32 *aLength)
{
*aLength = length;
return NS_OK;
}
/* add call log to list */
/* [noscriptable] void add (in nsICallLog cl); */
NS_IMETHODIMP nsList::Add(nsICallLog *cl)
{
NS_ENSURE_ARG_POINTER(cl);
length++;
mList->AppendElement(cl, PR_FALSE);
};
/* ************************* */
/* nsCallLog */
/* ************************* */
NS_IMPL_ISUPPORTS1(nsCallLog, nsICallLog)
nsCallLog::nsCallLog(): date(nsnull), from(nsnull), to(nsnull)
{
duration = -1;
status = -1;
direction = -1;
}
nsCallLog::~nsCallLog(){}
/* attribute unsigned short direction; */
NS_IMETHODIMP nsCallLog::GetDirection(PRInt16 *aDirection)
{
*aDirection = direction;
return NS_OK;
}
NS_IMETHODIMP nsCallLog::SetDirection(PRInt16 aDirection)
{
direction = aDirection;
return NS_OK;
}
/* attribute unsigned short status; */
NS_IMETHODIMP nsCallLog::GetStatus(PRInt16 *aStatus)
{
*aStatus = status;
return NS_OK;
}
NS_IMETHODIMP nsCallLog::SetStatus(PRInt16 aStatus)
{
status = aStatus;
return NS_OK;
}
/* attribute unsigned long duration; */
NS_IMETHODIMP nsCallLog::GetDuration(PRInt32 *aDuration)
{
*aDuration = duration;
return NS_OK;
}
NS_IMETHODIMP nsCallLog::SetDuration(PRInt32 aDuration)
{
duration = aDuration;
return NS_OK;
}
/* attribute ACString date; */
NS_IMETHODIMP nsCallLog::GetDate(nsACString & aDate)
{
aDate = date;
return NS_OK;
}
NS_IMETHODIMP nsCallLog::SetDate(const nsACString & aDate)
{
date = aDate;
return NS_OK;
}
/* attribute ACString from; */
NS_IMETHODIMP nsCallLog::GetFrom(nsACString & aFrom)
{
aFrom = from;
return NS_OK;
}
NS_IMETHODIMP nsCallLog::SetFrom(const nsACString & aFrom)
{
from = aFrom;
return NS_OK;
}
/* attribute ACString to; */
NS_IMETHODIMP nsCallLog::GetTo(nsACString & aTo)
{
aTo = to;
return NS_OK;
}
NS_IMETHODIMP nsCallLog::SetTo(const nsACString & aTo)
{
to = aTo;
return NS_OK;
}