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 "nsStringAPI.h"
26 #include "nsEmbedString.h"
27 #include "nsIMutableArray.h"
28 #include "nsCOMArray.h"
30 /* Project includes */
31 #include <abstract/base/aaIAction.h>
32 #include <abstract/base/aaIFact.h>
33 #include <abstract/storage/aaIQuery.h>
37 :mTag((const PRUnichar
*) nsnull
), mRead(PR_FALSE
), mEdited(PR_FALSE
)
45 NS_IMPL_ISUPPORTS4(aaFact
,
52 aaFact::GetId(PRInt64
*aId
)
54 NS_ENSURE_ARG_POINTER(aId
);
59 aaFact::SetId(PRInt64 aId
)
66 aaFact::Accept(aaIQuery
* aQuery
)
68 NS_ENSURE_ARG_POINTER(aQuery
);
69 //return aQuery->QueryFact(this);
70 return NS_ERROR_NOT_IMPLEMENTED
;
74 aaFact::GetEdited(PRBool
* aEdited
)
76 NS_ENSURE_ARG_POINTER(aEdited
);
83 aaFact::GetTag(nsAString
& aTag
)
90 aaFact::SetTag(const nsAString
& aTag
)
92 if (mTag
.Equals(aTag
))
102 aaFact::GetLength(PRUint32
*aLength
)
104 return NS_ERROR_NOT_IMPLEMENTED
;
108 aaFact::QueryElementAt(PRUint32 index
, const nsIID
& uuid
, void * *result
)
110 NS_ENSURE_TRUE( index
< (PRUint32
) mActions
.Count(), NS_ERROR_INVALID_ARG
);
111 NS_ENSURE_ARG_POINTER( result
);
112 return mActions
[index
]->QueryInterface(uuid
, result
);
116 aaFact::IndexOf(PRUint32 startIndex
, nsISupports
*element
, PRUint32
*_retval
)
118 return NS_ERROR_NOT_IMPLEMENTED
;
122 aaFact::Enumerate(nsISimpleEnumerator
**_retval
)
124 return NS_ERROR_NOT_IMPLEMENTED
;
127 /* nsIMutableArray */
129 aaFact::AppendElement(nsISupports
*element
, PRBool weak
)
131 NS_ENSURE_TRUE(! weak
, NS_ERROR_NOT_IMPLEMENTED
);
132 nsCOMPtr
<aaIAction
> action(do_QueryInterface( element
));
133 NS_ENSURE_TRUE(action
, NS_ERROR_INVALID_ARG
);
134 if (mActions
.AppendObject(action
))
137 return NS_ERROR_FAILURE
;
141 aaFact::RemoveElementAt(PRUint32 index
)
143 return NS_ERROR_NOT_IMPLEMENTED
;
147 aaFact::InsertElementAt(nsISupports
*element
, PRUint32 index
, PRBool weak
)
149 return NS_ERROR_NOT_IMPLEMENTED
;
153 aaFact::ReplaceElementAt(nsISupports
*element
, PRUint32 index
, PRBool weak
)
155 return NS_ERROR_NOT_IMPLEMENTED
;
161 return NS_ERROR_NOT_IMPLEMENTED
;