mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 01:37:16 +00:00
started implementing history (not yet in build system)
This commit is contained in:
parent
dcc89d4ab6
commit
77399b80d9
164
rdf/datasource/src/nsHistoryDataSource.cpp
Normal file
164
rdf/datasource/src/nsHistoryDataSource.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include <ctype.h> // for toupper()
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsIRDFObserver.h"
|
||||
#include "nsIRDFResourceFactory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h" // XXX introduces dependency on raptorbase
|
||||
#include "nsRDFCID.h"
|
||||
#include "rdfutil.h"
|
||||
#include "nsIRDFMail.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "plhash.h"
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
#include "prio.h"
|
||||
|
||||
#include "nsMailDataSource.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Interface IDs
|
||||
|
||||
static NS_DEFINE_IID(kIRDFArcsInCursorIID, NS_IRDFARCSINCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFArcsOutCursorIID, NS_IRDFARCSOUTCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFAssertionCursorIID, NS_IRDFASSERTIONCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFDataSourceIID, NS_IRDFDATASOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
|
||||
static NS_DEFINE_IID(kIRDFHistoryDataSourceIID, NS_IRDFHISTORYDATAOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceFactoryIID, NS_IRDFRESOURCEFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// RDF property & resource declarations
|
||||
|
||||
static const char kURIHistoryRoot[] = "HistoryRoot";
|
||||
|
||||
#define NC_NAMESPACE_URI "http://home.netscape.com/NC-rdf#"
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Folder);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Column);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Columns);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Title);
|
||||
|
||||
#define WEB_NAMESPACE_URI "http://home.netscape.com/WEB-rdf#"
|
||||
DEFINE_RDF_VOCAB(WEB_NAMESPACE_URI, WEB, LastVisitDate);
|
||||
DEFINE_RDF_VOCAB(WEB_NAMESPACE_URI, WEB, LastModifiedDate);
|
||||
|
||||
|
||||
|
||||
class nsHistoryDataSource : public nsIHistoryDataSource {
|
||||
nsIRDFDataSource** mInner;
|
||||
nsVoidArray mFiles;
|
||||
|
||||
public:
|
||||
NS_IMETHOD Init(const char* uri) ;
|
||||
NS_IMETHOD GetURI(const char* *uri) {
|
||||
return mInner->GetURI(uri);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetSource(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv, nsIRDFResource** source) {
|
||||
return mInner->GetSource(property, target, tv, source);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target, PRBool tv,
|
||||
nsIRDFAssertionCursor** sources) {
|
||||
return mInner->GetSources(property, target, tv, sources);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetTarget(nsIRDFResource* source,
|
||||
nsIRDFResource* property, PRBool tv,
|
||||
nsIRDFNode** target) {
|
||||
return mInner->GetTarget(source, property, tv, target);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property, PRBool tv,
|
||||
nsIRDFAssertionCursor** targets) {
|
||||
return mInner->GetTargets(source, property, tv, targets);
|
||||
}
|
||||
|
||||
NS_IMETHOD Assert(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
nsIRDFNode* target, PRBool tv) {
|
||||
return mInner->Assert(source, property, target, tv);
|
||||
}
|
||||
|
||||
NS_IMETHOD Unassert(nsIRDFResource* source,
|
||||
nsIRDFResource* property, nsIRDFNode* target) {
|
||||
return mInner->Unassert(source, property, target);
|
||||
}
|
||||
|
||||
NS_IMETHOD HasAssertion(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
nsIRDFNode* target, PRBool tv,
|
||||
PRBool* hasAssertion) {
|
||||
return mInner->HasAssertion(source, property, target, tv, hasAssertion);
|
||||
}
|
||||
|
||||
NS_IMETHOD AddObserver(nsIRDFObserver* n) {
|
||||
return mInner->AddObserver(n);
|
||||
}
|
||||
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver* n) {
|
||||
return mInner->RemoveObserver(n);
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels) {
|
||||
return mInner->ArcLabelsIn(node, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels) {
|
||||
return mInner->ArcLabelsOut(source, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return mInner->Flush();
|
||||
}
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(const char* aCommand,
|
||||
nsIRDFResource* aCommandTarget,
|
||||
PRBool* aResult) {
|
||||
return mInner->IsCommandEnabled(aCommand, aCommandTarget, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHOD DoCommand(const char* aCommand,
|
||||
nsIRDFResource* aCommandTarget) {
|
||||
return mInner->DoCommand(aCommand, aCommandTarget);
|
||||
}
|
||||
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user