Skip to content
Snippets Groups Projects
Commit 386d199a authored by guha%netscape.com's avatar guha%netscape.com
Browse files

More RDF fixing. Now ready for Raptor.

parent a6bb07ef
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,10 @@ public: ...@@ -63,6 +63,10 @@ public:
NS_IMETHOD ResourceIdentifier(RDF_Resource r, NS_IMETHOD ResourceIdentifier(RDF_Resource r,
char** url /* out */) = 0; char** url /* out */) = 0;
#ifdef MOZILLA_CLIENT
NS_IMETHOD SetBookmarkFile(const char* bookmarkFilePath) = 0;
#endif
}; };
......
...@@ -104,7 +104,7 @@ PR_PUBLIC_API(RDF_Error) RDF_Shutdown(void); ...@@ -104,7 +104,7 @@ PR_PUBLIC_API(RDF_Error) RDF_Shutdown(void);
PR_PUBLIC_API(char*) RDF_GetResourceName(RDF rdfDB, RDF_Resource node); PR_PUBLIC_API(char*) RDF_GetResourceName(RDF rdfDB, RDF_Resource node);
PR_PUBLIC_API(void) SetBookmarkURL(const char* url);
PR_PUBLIC_API(RDF_Resource) RDFUtil_GetFirstInstance (RDF_Resource type, char* defaultURL); PR_PUBLIC_API(RDF_Resource) RDFUtil_GetFirstInstance (RDF_Resource type, char* defaultURL);
PR_PUBLIC_API(void) RDFUtil_SetFirstInstance (RDF_Resource type, RDF_Resource item); PR_PUBLIC_API(void) RDFUtil_SetFirstInstance (RDF_Resource type, RDF_Resource item);
......
...@@ -163,13 +163,15 @@ public: ...@@ -163,13 +163,15 @@ public:
NS_METHOD CreateDatabase(const char** url, NS_METHOD CreateDatabase(const char** url,
nsIRDFDataBase** db); nsIRDFDataBase** db);
NS_IMETHOD ResourceIdentifier(RDF_Resource r, NS_METHOD ResourceIdentifier(RDF_Resource r,
char** url /* out */); char** url /* out */);
#ifdef MOZILLA_CLIENT
NS_METHOD SetBookmarkFile(const char* bookmarkFilePath);
#endif
}; };
class rdfServiceFactory : public nsIFactory { class rdfServiceFactory : public nsIFactory {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
...@@ -545,7 +547,7 @@ rdfDatabaseWrapper::DeleteAllArcs(RDF_Resource resource) ...@@ -545,7 +547,7 @@ rdfDatabaseWrapper::DeleteAllArcs(RDF_Resource resource)
*/ */
NS_IMPL_ISUPPORTS( rdfServiceWrapper, NS_IRDFSERVICE_IID ) NS_IMPL_ISUPPORTS(rdfServiceWrapper, NS_IRDFSERVICE_IID )
rdfServiceWrapper::rdfServiceWrapper() rdfServiceWrapper::rdfServiceWrapper()
{ {
...@@ -592,7 +594,14 @@ rdfServiceWrapper::ResourceIdentifier(RDF_Resource r, ...@@ -592,7 +594,14 @@ rdfServiceWrapper::ResourceIdentifier(RDF_Resource r,
*url = RDF_ResourceID(r); *url = RDF_ResourceID(r);
return NS_OK; return NS_OK;
} }
#ifdef MOZILLA_CLIENT
NS_METHOD
rdfServiceWrapper::SetBookmarkFile(const char* bookmarkFilePath) {
SetBookmarkURL(bookmarkFilePath);
return NS_OK;
}
#endif
/* /*
......
...@@ -367,6 +367,11 @@ isSeparator (RDF_Resource r) ...@@ -367,6 +367,11 @@ isSeparator (RDF_Resource r)
return (startsWith("separator", resourceID(r)) || startsWith("nc:separator", resourceID(r))) ; return (startsWith("separator", resourceID(r)) || startsWith("nc:separator", resourceID(r))) ;
} }
extern char* gBookmarkURL;
PR_PUBLIC_API(void)
SetBookmarkURL(const char* url) {
gBookmarkURL = copyString(url);
}
char * char *
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "plevent.h" #include "plevent.h"
#include "nsRepository.h" #include "nsRepository.h"
#define RDF_DB "test.rdf" #define RDF_DB "rdf:bookmarks"
#define SUCCESS 0 #define SUCCESS 0
#define FAILURE -1 #define FAILURE -1
...@@ -53,7 +53,7 @@ main(int argc, char** argv) ...@@ -53,7 +53,7 @@ main(int argc, char** argv)
NS_GetRDFService( &pRDF ); NS_GetRDFService( &pRDF );
PR_ASSERT( pRDF != 0 ); PR_ASSERT( pRDF != 0 );
pRDF->SetBookmarkFile("bookmark.htm");
nsIRDFDataBase* pDB; nsIRDFDataBase* pDB;
char* url[] = { RDF_DB, NULL }; char* url[] = { RDF_DB, NULL };
...@@ -64,7 +64,8 @@ main(int argc, char** argv) ...@@ -64,7 +64,8 @@ main(int argc, char** argv)
/* execute queries */ /* execute queries */
RDF_Resource resource = 0; RDF_Resource resource = 0;
if( NS_OK != pDB->CreateResource("test.rdf#root", &resource) )
if( NS_OK != pDB->CreateResource("NC:Bookmarks", &resource) )
fail("Unable to get resource on db!!!\n"); fail("Unable to get resource on db!!!\n");
RDF_Resource parent = 0; RDF_Resource parent = 0;
if( NS_OK != pDB->GetResource("parent", &parent) ) if( NS_OK != pDB->GetResource("parent", &parent) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment