transport: empty test for sqlite converter
[abstract.git] / base / aaEntity.cpp
blob0da9b11eb084d37ebdcc29d563c77b8f7dd637ec
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 "xpcom-config.h"
24 #include "nsStringAPI.h"
26 /* Project includes */
27 #include "aaIHandler.h"
28 #include "aaEntity.h"
30 aaEntity::aaEntity()
31 :mId(0), mTag((const PRUnichar *) nsnull), mRead(PR_FALSE), mEdited(PR_FALSE)
35 aaEntity::~aaEntity()
39 NS_IMPL_ISUPPORTS3(aaEntity,
40 aaIDataNode,
41 aaIListNode,
42 aaIEntity)
43 /* aaIDataNode */
44 NS_IMETHODIMP
45 aaEntity::GetId(PRInt64 *aId)
47 NS_ENSURE_ARG_POINTER(aId);
48 *aId = mId;
49 return NS_OK;
51 NS_IMETHODIMP
52 aaEntity::SetId(PRInt64 aId)
54 mId = aId;
55 return NS_OK;
57 PRInt64
58 aaEntity::PickId()
60 return mId;
63 NS_IMETHODIMP
64 aaEntity::Accept(aaIHandler* aQuery)
66 NS_ENSURE_ARG_POINTER(aQuery);
67 return aQuery->HandleEntity(this);
70 NS_IMETHODIMP
71 aaEntity::GetEdited(PRBool* aEdited)
73 NS_ENSURE_ARG_POINTER(aEdited);
74 *aEdited = mEdited;
75 return NS_OK;
78 NS_IMETHODIMP
79 aaEntity::Sync(aaIStorager *aStorager, aaISqliteChannel *aChannel)
81 return NS_ERROR_NOT_IMPLEMENTED;
84 /* aaIEntity */
85 NS_IMETHODIMP
86 aaEntity::GetTag(nsAString & aTag)
88 aTag.Assign(mTag);
89 mRead = PR_TRUE;
90 return NS_OK;
92 NS_IMETHODIMP
93 aaEntity::SetTag(const nsAString & aTag)
95 if (mTag.Equals(aTag))
96 return NS_OK;
97 if (mRead)
98 mEdited = PR_TRUE;
99 mTag.Assign(aTag);
100 return NS_OK;