storage/src/mozStorageResultSet.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/storage/src/mozStorageResultSet.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozStorageResultSet_h
    1.11 +#define mozStorageResultSet_h
    1.12 +
    1.13 +#include "mozIStorageResultSet.h"
    1.14 +#include "nsCOMArray.h"
    1.15 +#include "mozilla/Attributes.h"
    1.16 +class mozIStorageRow;
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace storage {
    1.20 +
    1.21 +class ResultSet MOZ_FINAL : public mozIStorageResultSet
    1.22 +{
    1.23 +public:
    1.24 +  NS_DECL_THREADSAFE_ISUPPORTS
    1.25 +  NS_DECL_MOZISTORAGERESULTSET
    1.26 +
    1.27 +  ResultSet();
    1.28 +  ~ResultSet();
    1.29 +
    1.30 +  /**
    1.31 +   * Adds a tuple to this result set.
    1.32 +   */
    1.33 +  nsresult add(mozIStorageRow *aTuple);
    1.34 +
    1.35 +  /**
    1.36 +   * @returns the number of rows this result set holds.
    1.37 +   */
    1.38 +  int32_t rows() const { return mData.Count(); }
    1.39 +
    1.40 +private:
    1.41 +  /**
    1.42 +   * Stores the current index of the active result set.
    1.43 +   */
    1.44 +  int32_t mCurrentIndex;
    1.45 +
    1.46 +  /**
    1.47 +   * Stores the tuples.
    1.48 +   */
    1.49 +  nsCOMArray<mozIStorageRow> mData;
    1.50 +};
    1.51 +
    1.52 +} // namespace storage
    1.53 +} // namespace mozilla
    1.54 +
    1.55 +#endif // mozStorageResultSet_h

mercurial