[storage] Store 'fact.amount' once in 'act' table
[abstract.git] / base / aaFact.cpp
blobdae3aa9693589eb722c70ab9801c270edc0a8f9a
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: */
3 /*
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>
24 #include "nsCOMPtr.h"
25 #include "nsEmbedString.h"
27 /* Project includes */
28 #include <abstract/base/aaIFlow.h>
29 #include <abstract/base/aaIObject.h>
30 #include <abstract/base/aaITimeframe.h>
31 #include <abstract/base/aaIFact.h>
32 #include <abstract/base/aaIQuery.h>
33 #include "aaFact.h"
35 aaFact::aaFact()
39 aaFact::~aaFact()
43 NS_IMPL_ISUPPORTS2(aaFact,
44 aaIDataNode,
45 aaIFact)
47 /* aaIDataNode */
48 NS_IMETHODIMP
49 aaFact::GetId(PRInt64 *aId)
51 NS_ENSURE_ARG_POINTER(aId);
52 *aId = mId;
53 return NS_OK;
55 NS_IMETHODIMP
56 aaFact::SetId(PRInt64 aId)
58 mId = aId;
59 return NS_OK;
62 NS_IMETHODIMP
63 aaFact::Accept(aaIQuery* aQuery)
65 NS_ENSURE_ARG_POINTER(aQuery);
66 return aQuery->QueryFact(this);
69 NS_IMETHODIMP
70 aaFact::GetEdited(PRBool* aEdited)
72 NS_ENSURE_ARG_POINTER(aEdited);
73 *aEdited = PR_FALSE;
74 return NS_OK;
78 /* aaIFact */
79 NS_IMETHODIMP
80 aaFact::GetTakeFrom(aaIFlow * *aTakeFrom)
82 NS_ENSURE_ARG_POINTER( aTakeFrom );
83 NS_IF_ADDREF( *aTakeFrom = mTakeFrom );
84 return NS_OK;
86 NS_IMETHODIMP
87 aaFact::SetTakeFrom(aaIFlow *aTakeFrom)
89 mTakeFrom = aTakeFrom;
90 return NS_OK;
93 NS_IMETHODIMP
94 aaFact::GetGiveTo(aaIFlow * *aGiveTo)
96 NS_ENSURE_ARG_POINTER( aGiveTo );
97 NS_IF_ADDREF( *aGiveTo = mGiveTo );
98 return NS_OK;
100 NS_IMETHODIMP
101 aaFact::SetGiveTo(aaIFlow *aGiveTo)
103 mGiveTo = aGiveTo;
104 return NS_OK;
107 NS_IMETHODIMP
108 aaFact::GetTimeframe(aaITimeframe * *aTimeframe)
110 NS_ENSURE_ARG_POINTER( aTimeframe );
111 NS_IF_ADDREF( *aTimeframe = mTimeframe );
112 return NS_OK;
115 NS_IMETHODIMP
116 aaFact::SetTimeframe(aaITimeframe *aTimeframe)
118 mTimeframe = aTimeframe;
119 return NS_OK;
122 NS_IMETHODIMP
123 aaFact::GetAmount(double *aAmount)
125 NS_ENSURE_ARG_POINTER( aAmount );
126 *aAmount = mAmount;
127 return NS_OK;
130 NS_IMETHODIMP
131 aaFact::SetAmount(double aAmount)
133 mAmount = aAmount;
134 return NS_OK;