1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent tw=79 ft=cpp: */
4 * Copyright (C) 2007 Sergey Yanovich <ynvich@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "xpcom-config.h"
25 #include "nsEmbedString.h"
27 /* Project includes */
29 #include "aaIHandler.h"
30 #include "aaTransaction.h"
32 aaTransaction::aaTransaction()
37 mHasEarnings(PR_FALSE
),
38 mBroadcasting(PR_FALSE
)
42 aaTransaction::~aaTransaction()
46 NS_IMPL_ISUPPORTS2(aaTransaction
,
52 aaTransaction::GetId(PRInt64
*aId
)
54 NS_ENSURE_ARG_POINTER(aId
);
59 aaTransaction::SetId(PRInt64 aId
)
66 aaTransaction::Accept(aaIHandler
* aQuery
)
68 NS_ENSURE_ARG_POINTER(aQuery
);
69 return aQuery
->HandleTransaction(this);
73 aaTransaction::GetEdited(PRBool
* aEdited
)
75 NS_ENSURE_ARG_POINTER(aEdited
);
83 aaTransaction::GetFact(aaIFact
* *aFact
)
85 NS_ENSURE_ARG_POINTER( aFact
);
86 NS_IF_ADDREF( *aFact
= mFact
);
90 aaTransaction::SetFact(aaIFact
*aFact
)
96 aaTransaction::PickFact()
102 aaTransaction::GetValue(double *aValue
)
104 NS_ENSURE_ARG_POINTER( aValue
);
109 aaTransaction::SetValue(double aValue
)
115 aaTransaction::PickValue()
121 aaTransaction::GetHasTime(PRBool
*aHasTime
)
123 NS_ENSURE_ARG_POINTER( aHasTime
);
124 *aHasTime
= mHasTime
;
129 aaTransaction::GetTime(PRTime
*aTime
)
131 NS_ENSURE_TRUE( mHasTime
, NS_ERROR_NOT_INITIALIZED
);
132 NS_ENSURE_ARG_POINTER( aTime
);
137 aaTransaction::SetTime(PRTime aTime
)
145 aaTransaction::GetHasEarnings(PRBool
*aHasEarnings
)
147 NS_ENSURE_ARG_POINTER(aHasEarnings
);
148 *aHasEarnings
= mHasEarnings
;
152 aaTransaction::PickHasEarnings()
158 aaTransaction::GetEarnings(double *aEarnings
)
160 NS_ENSURE_ARG_POINTER(aEarnings
);
161 NS_ENSURE_TRUE(mHasEarnings
, NS_ERROR_NOT_INITIALIZED
);
162 *aEarnings
= mEarnings
;
166 aaTransaction::SetEarnings(double aEarnings
)
168 mHasEarnings
= PR_TRUE
;
169 mEarnings
= aEarnings
;
173 aaTransaction::PickEarnings()