transport: pass correct channel
[abstract.git] / storage / base / aaLoadBuilder.h
blob520d49d5bdf2cdc5b5a53a6a6674afc0ed801367
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) 2008 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 #ifndef AALOADBUILDER_H
23 #define AALOADBUILDER_H 1
25 #include "aaIChartHandler.h"
27 class aaSession;
28 class aaISqlResult;
29 class aaILoadObserver;
31 class aaIDataNode;
32 class mozIStorageValueArray;
33 #ifdef DEBUG
34 #include "aaIDataNode.h"
35 #include "mozIStorageValueArray.h"
36 #endif
38 #define AA_LOADBUILDER_CID \
39 {0xb1be92d1, 0xdd70, 0x496a, {0xaa, 0xa9, 0xa4, 0x0f, 0x7e, 0x5b, 0x94, 0x12}}
41 #define AA_BUILD_BUFFER_SIZE 1024
43 class aaLoadBuilder : public aaIChartHandler
45 public:
46 aaLoadBuilder() :mIndex(0) {}
47 NS_DECL_ISUPPORTS
48 NS_DECL_AAIHANDLER
49 NS_DECL_AAICHARTHANDLER
51 nsresult Load(aaISqlResult *result, aaIDataNode **_retval);
52 private:
53 virtual ~aaLoadBuilder() {}
54 aaISqlResult *mData;
55 char mPrefix[AA_BUILD_BUFFER_SIZE];
56 PRUint32 mIndex;
57 nsCOMPtr<aaIDataNode> mResult;
59 class PrefixStacker {
60 public:
61 PrefixStacker(aaLoadBuilder *parent)
62 :mParent(parent), mIndex(parent ? parent->mIndex : 0) {}
63 ~PrefixStacker()
64 { ResetPrefix(); mParent = nsnull; }
65 PRUint32 GetIndex() const { return mIndex; }
66 void ResetPrefix()
68 if (mParent) {
69 mParent->mPrefix[mIndex] = 0;
70 mParent->mIndex = mIndex;
71 mParent->mResult = nsnull;
74 private:
75 aaLoadBuilder *mParent;
76 PRUint32 mIndex;
79 nsresult appendPrefix(const char *aElement);
80 PRUint32 getColumn(const char *aElement);
83 #endif /* AALOADBUILDER_H */