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 <abstract/aacore.h>
25 #include "nsEmbedString.h"
27 /* Project includes */
28 #include <abstract/base/aaIFact.h>
29 #include <abstract/base/aaITransaction.h>
30 #include <abstract/base/aaIHandler.h>
31 #include "aaTransaction.h"
33 aaTransaction::aaTransaction()
38 mHasEarnings(PR_FALSE
),
39 mBroadcasting(PR_FALSE
)
43 aaTransaction::~aaTransaction()
47 NS_IMPL_ISUPPORTS2(aaTransaction
,
53 aaTransaction::GetId(PRInt64
*aId
)
55 NS_ENSURE_ARG_POINTER(aId
);
60 aaTransaction::SetId(PRInt64 aId
)
67 aaTransaction::Accept(aaIHandler
* aQuery
)
69 NS_ENSURE_ARG_POINTER(aQuery
);
70 return aQuery
->HandleTransaction(this);
74 aaTransaction::GetEdited(PRBool
* aEdited
)
76 NS_ENSURE_ARG_POINTER(aEdited
);
84 aaTransaction::GetFact(aaIFact
* *aFact
)
86 NS_ENSURE_ARG_POINTER( aFact
);
87 NS_IF_ADDREF( *aFact
= mFact
);
91 aaTransaction::SetFact(aaIFact
*aFact
)
97 aaTransaction::PickFact()
103 aaTransaction::GetValue(double *aValue
)
105 NS_ENSURE_ARG_POINTER( aValue
);
110 aaTransaction::SetValue(double aValue
)
116 aaTransaction::PickValue()
122 aaTransaction::GetHasTime(PRBool
*aHasTime
)
124 NS_ENSURE_ARG_POINTER( aHasTime
);
125 *aHasTime
= mHasTime
;
130 aaTransaction::GetTime(PRTime
*aTime
)
132 NS_ENSURE_TRUE( mHasTime
, NS_ERROR_NOT_INITIALIZED
);
133 NS_ENSURE_ARG_POINTER( aTime
);
138 aaTransaction::SetTime(PRTime aTime
)
146 aaTransaction::GetHasEarnings(PRBool
*aHasEarnings
)
148 NS_ENSURE_ARG_POINTER(aHasEarnings
);
149 *aHasEarnings
= mHasEarnings
;
153 aaTransaction::PickHasEarnings()
159 aaTransaction::GetEarnings(double *aEarnings
)
161 NS_ENSURE_ARG_POINTER(aEarnings
);
162 NS_ENSURE_TRUE(mHasEarnings
, NS_ERROR_NOT_INITIALIZED
);
163 *aEarnings
= mEarnings
;
167 aaTransaction::SetEarnings(double aEarnings
)
169 mHasEarnings
= PR_TRUE
;
170 mEarnings
= aEarnings
;
174 aaTransaction::PickEarnings()