2010-06-23 23:46:08 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-06-23 23:46:08 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_indexeddb_indexeddatabase_h__
|
|
|
|
#define mozilla_dom_indexeddb_indexeddatabase_h__
|
|
|
|
|
|
|
|
#include "nsIProgrammingLanguage.h"
|
|
|
|
|
2010-08-27 00:57:25 +04:00
|
|
|
#include "jsapi.h"
|
2010-06-23 23:46:08 +04:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsDebug.h"
|
2010-11-11 02:25:44 +03:00
|
|
|
#include "nsDOMError.h"
|
2010-06-23 23:46:08 +04:00
|
|
|
#include "nsStringGlue.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
|
|
|
#define BEGIN_INDEXEDDB_NAMESPACE \
|
|
|
|
namespace mozilla { namespace dom { namespace indexedDB {
|
|
|
|
|
|
|
|
#define END_INDEXEDDB_NAMESPACE \
|
|
|
|
} /* namespace indexedDB */ } /* namepsace dom */ } /* namespace mozilla */
|
|
|
|
|
|
|
|
#define USING_INDEXEDDB_NAMESPACE \
|
|
|
|
using namespace mozilla::dom::indexedDB;
|
|
|
|
|
2011-12-16 11:34:24 +04:00
|
|
|
class nsIDOMBlob;
|
|
|
|
|
2010-12-10 05:15:00 +03:00
|
|
|
BEGIN_INDEXEDDB_NAMESPACE
|
|
|
|
|
2011-12-16 11:34:24 +04:00
|
|
|
class FileInfo;
|
|
|
|
|
|
|
|
struct StructuredCloneReadInfo {
|
|
|
|
void Swap(StructuredCloneReadInfo& aCloneReadInfo) {
|
|
|
|
mCloneBuffer.swap(aCloneReadInfo.mCloneBuffer);
|
|
|
|
mFileInfos.SwapElements(aCloneReadInfo.mFileInfos);
|
|
|
|
}
|
|
|
|
|
|
|
|
JSAutoStructuredCloneBuffer mCloneBuffer;
|
|
|
|
nsTArray<nsRefPtr<FileInfo> > mFileInfos;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct StructuredCloneWriteInfo {
|
|
|
|
void Swap(StructuredCloneWriteInfo& aCloneWriteInfo) {
|
|
|
|
mCloneBuffer.swap(aCloneWriteInfo.mCloneBuffer);
|
|
|
|
mBlobs.SwapElements(aCloneWriteInfo.mBlobs);
|
|
|
|
mOffsetToKeyProp = aCloneWriteInfo.mOffsetToKeyProp;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSAutoStructuredCloneBuffer mCloneBuffer;
|
|
|
|
nsTArray<nsCOMPtr<nsIDOMBlob> > mBlobs;
|
|
|
|
PRUint64 mOffsetToKeyProp;
|
|
|
|
};
|
|
|
|
|
2010-12-10 05:15:00 +03:00
|
|
|
inline
|
|
|
|
void
|
|
|
|
AppendConditionClause(const nsACString& aColumnName,
|
|
|
|
const nsACString& aArgName,
|
|
|
|
bool aLessThan,
|
|
|
|
bool aEquals,
|
|
|
|
nsACString& aResult)
|
|
|
|
{
|
|
|
|
aResult += NS_LITERAL_CSTRING(" AND ") + aColumnName +
|
|
|
|
NS_LITERAL_CSTRING(" ");
|
|
|
|
|
|
|
|
if (aLessThan) {
|
|
|
|
aResult.AppendLiteral("<");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aResult.AppendLiteral(">");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aEquals) {
|
|
|
|
aResult.AppendLiteral("=");
|
|
|
|
}
|
|
|
|
|
|
|
|
aResult += NS_LITERAL_CSTRING(" :") + aArgName;
|
|
|
|
}
|
|
|
|
|
|
|
|
END_INDEXEDDB_NAMESPACE
|
|
|
|
|
2010-06-23 23:46:08 +04:00
|
|
|
#endif // mozilla_dom_indexeddb_indexeddatabase_h__
|