зеркало из https://github.com/mozilla/gecko-dev.git
Convert nsIAutoCompleteResultTypes.h to an IDL file, which makes QI'ing to those interfaces work as expected.
This commit is contained in:
Родитель
9297bd6971
Коммит
3bd70bbd4e
|
@ -33,8 +33,7 @@ XPIDLSRCS = nsIAutoCompleteController.idl \
|
|||
nsIAutoCompletePopup.idl \
|
||||
nsIAutoCompleteSearch.idl \
|
||||
nsIAutoCompleteResult.idl \
|
||||
nsIAutoCompleteResultTypes.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = nsIAutoCompleteResultTypes.h
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -35,40 +35,51 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __nsIAutoCompleteResultTypes__
|
||||
#define __nsIAutoCompleteResultTypes__
|
||||
#include "nsIAutoCompleteResult.idl"
|
||||
|
||||
#include "nsIAutoCompleteResult.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
interface nsIMdbTable;
|
||||
interface nsIMdbEnv;
|
||||
interface nsIMdbRow;
|
||||
|
||||
%{ C++
|
||||
#include "mdb.h"
|
||||
%}
|
||||
|
||||
class nsIAutoCompleteBaseResult : public nsIAutoCompleteResult
|
||||
native mdb_scope(mdb_scope);
|
||||
native mdb_column(mdb_column);
|
||||
|
||||
/* noscript */
|
||||
[uuid(c5257f44-b4d0-41aa-a50b-5b7bcefcc235)]
|
||||
interface nsIAutoCompleteBaseResult : nsIAutoCompleteResult
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD SetSearchString(const nsAString &aSearchString) = 0;
|
||||
NS_IMETHOD SetErrorDescription(const nsAString &aErrorDescription) = 0;
|
||||
NS_IMETHOD SetDefaultIndex(PRInt32 aDefaultIndex) = 0;
|
||||
NS_IMETHOD SetSearchResult(PRUint32 aSearchResult) = 0;
|
||||
void setSearchString(in AString searchString);
|
||||
void setErrorDescription(in AString errorDescription);
|
||||
void setDefaultIndex(in long defaultIndex);
|
||||
void setSearchResult(in unsigned long searchResult);
|
||||
};
|
||||
|
||||
class nsIAutoCompleteMdbResult : public nsIAutoCompleteBaseResult
|
||||
/* noscript */
|
||||
[uuid(f7e7b341-2d5c-4d04-9f51-496cb2ce178c)]
|
||||
interface nsIAutoCompleteMdbResult : nsIAutoCompleteBaseResult
|
||||
{
|
||||
public:
|
||||
enum eDataType {
|
||||
kUnicharType,
|
||||
kCharType,
|
||||
kIntType
|
||||
};
|
||||
const short kUnicharType = 0;
|
||||
const short kCharType = 1;
|
||||
const short kIntType = 2;
|
||||
|
||||
NS_IMETHOD Init(nsIMdbEnv *aEnv, nsIMdbTable *aTable) = 0;
|
||||
NS_IMETHOD SetTokens(mdb_scope aValueToken, eDataType aValueType, mdb_scope aCommentToken, eDataType aCommentType) = 0;
|
||||
NS_IMETHOD AddRow(nsIMdbRow *aRow) = 0;
|
||||
NS_IMETHOD RemoveRowAt(PRUint32 aRowIndex) = 0;
|
||||
NS_IMETHOD GetRowAt(PRUint32 aRowIndex, nsIMdbRow **aRow) = 0;
|
||||
NS_IMETHOD GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsAString &aValue) = 0;
|
||||
NS_IMETHOD GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACString &aValue) = 0;
|
||||
NS_IMETHOD GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt32 *aValue) = 0;
|
||||
void init(in nsIMdbEnv env, in nsIMdbTable table);
|
||||
|
||||
void setTokens(in mdb_scope valueToken, in short valueType,
|
||||
in mdb_scope commentToken, in short commentType);
|
||||
|
||||
void addRow(in nsIMdbRow row);
|
||||
|
||||
void removeRowAt(in unsigned long rowIndex);
|
||||
|
||||
nsIMdbRow getRowAt(in unsigned long rowIndex);
|
||||
|
||||
AString getRowValue(in nsIMdbRow row, in mdb_column col);
|
||||
|
||||
AUTF8String getUTF8RowValue(in nsIMdbRow row, in mdb_column col);
|
||||
|
||||
long getIntRowValue(in nsIMdbRow row, in mdb_column col);
|
||||
};
|
||||
|
||||
#endif // __nsIAutoCompleteResultTypes__
|
|
@ -39,7 +39,15 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAutoCompleteMdbResult, nsIAutoCompleteResult)
|
||||
NS_INTERFACE_MAP_BEGIN(nsAutoCompleteMdbResult)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteResult)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteBaseResult)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteMdbResult)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAutoCompleteResult)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(nsAutoCompleteMdbResult)
|
||||
NS_IMPL_RELEASE(nsAutoCompleteMdbResult)
|
||||
|
||||
nsAutoCompleteMdbResult::nsAutoCompleteMdbResult() :
|
||||
mDefaultIndex(-1),
|
||||
|
@ -102,7 +110,7 @@ nsAutoCompleteMdbResult::GetValueAt(PRInt32 aIndex, nsAString & _retval)
|
|||
GetRowValue(row, mValueToken, _retval);
|
||||
} else if (mValueType == kCharType) {
|
||||
nsCAutoString value;
|
||||
GetRowValue(row, mValueToken, value);
|
||||
GetUTF8RowValue(row, mValueToken, value);
|
||||
_retval = NS_ConvertUTF8toUCS2(value);
|
||||
}
|
||||
|
||||
|
@ -129,7 +137,7 @@ nsAutoCompleteMdbResult::GetCommentAt(PRInt32 aIndex, nsAString & _retval)
|
|||
GetRowValue(row, mCommentToken, _retval);
|
||||
} else if (mCommentType == kCharType) {
|
||||
nsCAutoString value;
|
||||
GetRowValue(row, mCommentToken, value);
|
||||
GetUTF8RowValue(row, mCommentToken, value);
|
||||
_retval = NS_ConvertUTF8toUCS2(value);
|
||||
}
|
||||
|
||||
|
@ -185,7 +193,7 @@ nsAutoCompleteMdbResult::Init(nsIMdbEnv *aEnv, nsIMdbTable *aTable)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAutoCompleteMdbResult::SetTokens(mdb_scope aValueToken, eDataType aValueType, mdb_scope aCommentToken, eDataType aCommentType)
|
||||
nsAutoCompleteMdbResult::SetTokens(mdb_scope aValueToken, PRInt16 aValueType, mdb_scope aCommentToken, PRInt16 aCommentType)
|
||||
{
|
||||
mValueToken = aValueToken;
|
||||
mValueType = aValueType;
|
||||
|
@ -243,7 +251,8 @@ nsAutoCompleteMdbResult::GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsAString
|
|||
|
||||
|
||||
nsresult
|
||||
nsAutoCompleteMdbResult::GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACString& aValue)
|
||||
nsAutoCompleteMdbResult::GetUTF8RowValue(nsIMdbRow *aRow, mdb_column aCol,
|
||||
nsACString& aValue)
|
||||
{
|
||||
mdb_err err;
|
||||
|
||||
|
@ -261,7 +270,8 @@ nsAutoCompleteMdbResult::GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACStrin
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsAutoCompleteMdbResult::GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt32 *aValue)
|
||||
nsAutoCompleteMdbResult::GetIntRowValue(nsIMdbRow *aRow, mdb_column aCol,
|
||||
PRInt32 *aValue)
|
||||
{
|
||||
mdb_err err;
|
||||
|
||||
|
|
|
@ -53,21 +53,8 @@ public:
|
|||
nsAutoCompleteMdbResult();
|
||||
virtual ~nsAutoCompleteMdbResult();
|
||||
|
||||
// nsIAutoCompleteBaseResult
|
||||
NS_IMETHOD SetSearchString(const nsAString &aSearchString);
|
||||
NS_IMETHOD SetErrorDescription(const nsAString &aErrorDescription);
|
||||
NS_IMETHOD SetDefaultIndex(PRInt32 aDefaultIndex);
|
||||
NS_IMETHOD SetSearchResult(PRUint32 aSearchResult);
|
||||
|
||||
// nsIAutoCompleteMdbResult
|
||||
NS_IMETHOD Init(nsIMdbEnv *aEnv, nsIMdbTable *aTable);
|
||||
NS_IMETHOD SetTokens(mdb_scope aValueToken, eDataType aValueType, mdb_scope aCommentToken, eDataType aCommentType);
|
||||
NS_IMETHOD AddRow(nsIMdbRow *aRow);
|
||||
NS_IMETHOD RemoveRowAt(PRUint32 aRowIndex);
|
||||
NS_IMETHOD GetRowAt(PRUint32 aRowIndex, nsIMdbRow **aRow);
|
||||
NS_IMETHOD GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsAString &aValue);
|
||||
NS_IMETHOD GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACString &aValue);
|
||||
NS_IMETHOD GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt32 *aValue);
|
||||
NS_DECL_NSIAUTOCOMPLETEBASERESULT
|
||||
NS_DECL_NSIAUTOCOMPLETEMDBRESULT
|
||||
|
||||
protected:
|
||||
nsAutoVoidArray mResults;
|
||||
|
@ -81,9 +68,9 @@ protected:
|
|||
nsIMdbTable *mTable;
|
||||
|
||||
mdb_scope mValueToken;
|
||||
eDataType mValueType;
|
||||
PRInt16 mValueType;
|
||||
mdb_scope mCommentToken;
|
||||
eDataType mCommentType;
|
||||
PRInt16 mCommentType;
|
||||
};
|
||||
|
||||
#endif // __nsAutoCompleteResultBase__
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
static const char *kFormHistoryFileName = "formhistory.dat";
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче