Back to index

lightning-sunbird  0.9+nobinonly
nsMsgRDFUtils.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 //This file holds some useful utility functions and declarations used by our datasources.
00039 
00040 #include "rdf.h"
00041 #include "nsIRDFResource.h"
00042 #include "nsIRDFNode.h"
00043 #include "nsIRDFDataSource.h"
00044 #include "nsIRDFService.h"
00045 #include "nsString.h"
00046 
00047 // this is used for notification of observers using nsVoidArray
00048 typedef struct _nsMsgRDFNotification {
00049   nsIRDFDataSource *datasource;
00050   nsIRDFResource *subject;
00051   nsIRDFResource *property;
00052   nsIRDFNode *newObject;
00053   nsIRDFNode *oldObject;
00054 } nsMsgRDFNotification;
00055 
00056 //Some property declarations
00057 
00058 #define NC_RDF_CHILD                      NC_NAMESPACE_URI "child"
00059 #define NC_RDF_NAME                              NC_NAMESPACE_URI "Name"
00060 #define NC_RDF_OPEN                              NC_NAMESPACE_URI "open"
00061 #define NC_RDF_FOLDERTREENAME             NC_NAMESPACE_URI "FolderTreeName"
00062 #define NC_RDF_FOLDERTREESIMPLENAME              NC_NAMESPACE_URI "FolderTreeSimpleName"
00063 #define NC_RDF_FOLDER                            NC_NAMESPACE_URI "Folder"
00064 #define NC_RDF_SPECIALFOLDER              NC_NAMESPACE_URI "SpecialFolder"
00065 #define NC_RDF_SERVERTYPE                 NC_NAMESPACE_URI "ServerType"
00066 #define NC_RDF_REDIRECTORTYPE                    NC_NAMESPACE_URI "RedirectorType"
00067 #define NC_RDF_CANCREATEFOLDERSONSERVER   NC_NAMESPACE_URI "CanCreateFoldersOnServer"
00068 #define NC_RDF_CANFILEMESSAGESONSERVER    NC_NAMESPACE_URI "CanFileMessagesOnServer"
00069 #define NC_RDF_ISSERVER                          NC_NAMESPACE_URI "IsServer"
00070 #define NC_RDF_ISSECURE             NC_NAMESPACE_URI "IsSecure"
00071 #define NC_RDF_CANSUBSCRIBE               NC_NAMESPACE_URI "CanSubscribe"
00072 #define NC_RDF_SUPPORTSOFFLINE                  NC_NAMESPACE_URI "SupportsOffline"
00073 #define NC_RDF_CANFILEMESSAGES                   NC_NAMESPACE_URI "CanFileMessages"
00074 #define NC_RDF_CANCREATESUBFOLDERS               NC_NAMESPACE_URI "CanCreateSubfolders"
00075 #define NC_RDF_CANRENAME                  NC_NAMESPACE_URI "CanRename"
00076 #define NC_RDF_CANCOMPACT                 NC_NAMESPACE_URI "CanCompact"
00077 #define NC_RDF_TOTALMESSAGES              NC_NAMESPACE_URI "TotalMessages"
00078 #define NC_RDF_TOTALUNREADMESSAGES NC_NAMESPACE_URI "TotalUnreadMessages"
00079 #define NC_RDF_FOLDERSIZE               NC_NAMESPACE_URI "FolderSize"
00080 #define NC_RDF_CHARSET                           NC_NAMESPACE_URI "Charset"
00081 #define NC_RDF_BIFFSTATE                  NC_NAMESPACE_URI "BiffState"
00082 #define NC_RDF_HASUNREADMESSAGES   NC_NAMESPACE_URI "HasUnreadMessages"
00083 #define NC_RDF_SUBFOLDERSHAVEUNREADMESSAGES NC_NAMESPACE_URI "SubfoldersHaveUnreadMessages"
00084 #define NC_RDF_NOSELECT       NC_NAMESPACE_URI "NoSelect"
00085 #define NC_RDF_VIRTUALFOLDER   NC_NAMESPACE_URI "Virtual"
00086 #define NC_RDF_INVFEDITSEARCHSCOPE   NC_NAMESPACE_URI "InVFEditSearchScope"
00087 #define NC_RDF_IMAPSHARED     NC_NAMESPACE_URI "ImapShared"
00088 #define NC_RDF_NEWMESSAGES                NC_NAMESPACE_URI "NewMessages"
00089 #define NC_RDF_SYNCHRONIZE          NC_NAMESPACE_URI "Synchronize"
00090 #define NC_RDF_SYNCDISABLED         NC_NAMESPACE_URI "SyncDisabled"
00091 #define NC_RDF_KEY                      NC_NAMESPACE_URI "Key"
00092 #define NC_RDF_CANSEARCHMESSAGES                 NC_NAMESPACE_URI "CanSearchMessages"
00093 #define NC_RDF_ISDEFERRED NC_NAMESPACE_URI "IsDeferred"
00094 
00095 //Sort Properties
00096 #define NC_RDF_SUBJECT_COLLATION_SORT     NC_NAMESPACE_URI "Subject?collation=true"
00097 #define NC_RDF_SENDER_COLLATION_SORT      NC_NAMESPACE_URI "Sender?collation=true"
00098 #define NC_RDF_RECIPIENT_COLLATION_SORT   NC_NAMESPACE_URI "Recipient?collation=true"
00099 #define NC_RDF_ORDERRECEIVED_SORT         NC_NAMESPACE_URI "OrderReceived?sort=true"
00100 #define NC_RDF_PRIORITY_SORT                     NC_NAMESPACE_URI "Priority?sort=true"
00101 #define NC_RDF_DATE_SORT                NC_NAMESPACE_URI "Date?sort=true"
00102 #define NC_RDF_SIZE_SORT                         NC_NAMESPACE_URI "Size?sort=true"
00103 #define NC_RDF_ISUNREAD_SORT                     NC_NAMESPACE_URI "IsUnread?sort=true"
00104 #define NC_RDF_FLAGGED_SORT                      NC_NAMESPACE_URI "Flagged?sort=true"
00105 
00106 #define NC_RDF_NAME_SORT                         NC_NAMESPACE_URI "Name?sort=true"
00107 #define NC_RDF_FOLDERTREENAME_SORT        NC_NAMESPACE_URI "FolderTreeName?sort=true"
00108 
00109 //Folder Commands
00110 #define NC_RDF_DELETE                            NC_NAMESPACE_URI "Delete"
00111 #define NC_RDF_REALLY_DELETE              NC_NAMESPACE_URI "ReallyDelete"
00112 #define NC_RDF_NEWFOLDER                  NC_NAMESPACE_URI "NewFolder"
00113 #define NC_RDF_GETNEWMESSAGES             NC_NAMESPACE_URI "GetNewMessages"
00114 #define NC_RDF_COPY                              NC_NAMESPACE_URI "Copy"
00115 #define NC_RDF_MOVE                              NC_NAMESPACE_URI "Move"
00116 #define NC_RDF_COPYFOLDER                 NC_NAMESPACE_URI "CopyFolder"
00117 #define NC_RDF_MOVEFOLDER                 NC_NAMESPACE_URI "MoveFolder"
00118 #define NC_RDF_MARKALLMESSAGESREAD  NC_NAMESPACE_URI "MarkAllMessagesRead"
00119 #define NC_RDF_COMPACT                           NC_NAMESPACE_URI "Compact"
00120 #define NC_RDF_COMPACTALL                 NC_NAMESPACE_URI "CompactAll"
00121 #define NC_RDF_RENAME                            NC_NAMESPACE_URI "Rename"
00122 #define NC_RDF_EMPTYTRASH   NC_NAMESPACE_URI "EmptyTrash"
00123 #define NC_RDF_DOWNLOADFLAGGED NC_NAMESPACE_URI "DownloadFlaggedMessages"
00124 #define NC_RDF_DOWNLOADSELECTED NC_NAMESPACE_URI "DownloadSelectedMessages"
00125 
00126 
00127 nsresult createNode(const PRUnichar *str, nsIRDFNode **, nsIRDFService *rdfService);
00128 
00129 //Given an PRInt32 creates an nsIRDFNode that is really an int literal.
00130 nsresult createIntNode(PRInt32 value, nsIRDFNode **node, nsIRDFService *rdfService);
00131 
00132 //Given an nsIRDFBlob creates an nsIRDFNode that is really an blob literal.
00133 nsresult createBlobNode(PRUint8 *value, PRUint32 &length,  nsIRDFNode **node, nsIRDFService *rdfService);
00134 
00135 //s Assertion for a datasource that will just call GetTarget on property.  When all of our 
00136 //datasource derive from our datasource baseclass, this should be moved there and the first
00137 //parameter will no longer be needed.
00138 nsresult GetTargetHasAssertion(nsIRDFDataSource *dataSource, nsIRDFResource* folderResource,
00139                                                     nsIRDFResource *property,PRBool tv, nsIRDFNode *target,PRBool* hasAssertion);
00140 
00141