Back to index

lightning-sunbird  0.9+nobinonly
nsAbDirectoryQuery.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Sun Microsystems, Inc.
00019  * Portions created by the Initial Developer are Copyright (C) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Created by: Paul Sandoz   <paul.sandoz@sun.com>
00024  *   Dan Mosedale <dan.mosedale@oracle.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifndef nsAbDirectoryQuery_h__
00041 #define nsAbDirectoryQuery_h__
00042 
00043 #include "nsIAbDirectoryQuery.h"
00044 #include "nsCOMPtr.h"
00045 #include "nsString.h"
00046 #include "nsVoidArray.h"
00047 
00048 class nsAbDirectoryQuerySimpleBooleanExpression : public nsIAbBooleanExpression
00049 {
00050 public:
00051     NS_DECL_ISUPPORTS
00052     NS_DECL_NSIABBOOLEANEXPRESSION
00053 
00054     nsAbDirectoryQuerySimpleBooleanExpression();
00055     virtual ~nsAbDirectoryQuerySimpleBooleanExpression();
00056 
00057 public:
00058     nsCOMPtr<nsISupportsArray> mExpressions;
00059     nsAbBooleanOperationType mOperation;
00060 };
00061 
00062 
00063 class nsAbDirectoryQueryArguments : public nsIAbDirectoryQueryArguments
00064 {
00065 public:
00066     NS_DECL_ISUPPORTS
00067     NS_DECL_NSIABDIRECTORYQUERYARGUMENTS
00068 
00069     nsAbDirectoryQueryArguments();
00070     virtual ~nsAbDirectoryQueryArguments();
00071 
00072 protected:
00073     nsCOMPtr<nsISupports> mExpression;
00074     nsCOMPtr<nsISupports> mTypeSpecificArg;
00075     PRBool mQuerySubDirectories;
00076     nsCStringArray mReturnProperties;
00077 };
00078 
00079 
00080 class nsAbDirectoryQueryPropertyValue : public nsIAbDirectoryQueryPropertyValue
00081 {
00082 public:
00083     NS_DECL_ISUPPORTS
00084     NS_DECL_NSIABDIRECTORYQUERYPROPERTYVALUE
00085 
00086     nsAbDirectoryQueryPropertyValue();
00087     nsAbDirectoryQueryPropertyValue(const char* aName,
00088           const PRUnichar* aValue);
00089     nsAbDirectoryQueryPropertyValue(const char* aName,
00090           nsISupports* aValueISupports);
00091     virtual ~nsAbDirectoryQueryPropertyValue();
00092 
00093 protected:
00094     nsCString mName;
00095     nsString mValue;
00096     nsCOMPtr<nsISupports> mValueISupports;
00097 };
00098 
00099 
00100 class nsAbDirectoryQueryResult : public nsIAbDirectoryQueryResult
00101 {
00102 public:
00103     NS_DECL_ISUPPORTS
00104     NS_DECL_NSIABDIRECTORYQUERYRESULT
00105 
00106     nsAbDirectoryQueryResult();
00107     nsAbDirectoryQueryResult(PRInt32 aContextID,
00108           nsIAbDirectoryQueryArguments* aContextArgs,
00109           PRInt32 aType,
00110           nsCOMPtr<nsISupportsArray> aResult);
00111     virtual ~nsAbDirectoryQueryResult();
00112 
00113 protected:
00114     PRInt32 mContextID;
00115     nsCOMPtr<nsIAbDirectoryQueryArguments> mContextArgs;
00116     PRInt32 mType;
00117     nsCOMPtr<nsISupportsArray> mResult;
00118 };
00119 
00120 
00121 
00122 
00123 #include "nsIAbDirectory.h"
00124 
00125 class nsAbDirectoryQuery : public nsIAbDirectoryQuery
00126 {
00127 public:
00128     NS_DECL_ISUPPORTS
00129     NS_DECL_NSIABDIRECTORYQUERY
00130 
00131     nsAbDirectoryQuery(nsIAbDirectory* aDirectory);
00132     virtual ~nsAbDirectoryQuery();
00133 
00134 protected:
00135     nsresult query (nsIAbDirectory* directory,
00136         nsIAbDirectoryQueryArguments* arguments,
00137         nsIAbDirectoryQueryResultListener* listener,
00138         PRInt32* resultLimit);
00139     nsresult queryChildren (nsIAbDirectory* directory,
00140         nsIAbDirectoryQueryArguments* arguments,
00141         nsIAbDirectoryQueryResultListener* listener,
00142         PRInt32* resultLimit);
00143     nsresult queryCards (nsIAbDirectory* directory,
00144         nsIAbDirectoryQueryArguments* arguments,
00145         nsIAbDirectoryQueryResultListener* listener,
00146         PRInt32* resultLimit);
00147     nsresult matchCard (nsIAbCard* card,
00148         nsIAbDirectoryQueryArguments* arguments,
00149         nsIAbDirectoryQueryResultListener* listener,
00150         PRInt32* resultLimit);
00151     nsresult matchCardExpression (nsIAbCard* card,
00152         nsIAbBooleanExpression* expression,
00153         PRBool* result);
00154     nsresult matchCardCondition (nsIAbCard* card,
00155         nsIAbBooleanConditionString* condition,
00156         PRBool* matchFound);
00157 
00158     nsresult queryMatch (nsIAbCard* card,
00159         nsIAbDirectoryQueryArguments* arguments,
00160         nsIAbDirectoryQueryResultListener* listener);
00161     nsresult queryFinished (nsIAbDirectoryQueryArguments* arguments,
00162         nsIAbDirectoryQueryResultListener* listener);
00163     nsresult queryError (nsIAbDirectoryQueryArguments* arguments,
00164         nsIAbDirectoryQueryResultListener* listener);
00165     
00166 protected:
00167     nsCOMPtr<nsIAbDirectory> mDirectory;
00168 };
00169 
00170 #endif