home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / rdf / include / rdf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  6.8 KB  |  198 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19.  
  20. #ifndef rdf_h___
  21. #define rdf_h___
  22.  
  23.  
  24. #include "prtypes.h"
  25.  
  26.  
  27. typedef int16 RDF_Error;
  28. typedef uint16 RDF_ValueType;
  29.  
  30.  
  31. #define RDF_ILLEGAL_ASSERT ((RDF_Error)0x0001)
  32. #define RDF_ILLEGAL_KILL   ((RDF_Error)0x0002)
  33. #define RDF_NO_MEMORY      ((RDF_Error)0x0003)
  34.  
  35.  
  36. #define RDF_RESOURCE_TYPE ((RDF_ValueType)0x0001)
  37. #define RDF_INT_TYPE      ((RDF_ValueType)0x0002)
  38. #define RDF_STRING_TYPE   ((RDF_ValueType)0x0003)
  39. #define RDF_NATIVE_TYPE   ((RDF_ValueType)0x0004)
  40.  
  41. NSPR_BEGIN_EXTERN_C
  42.  
  43. typedef struct RDF_ResourceStruct* RDF_Resource;
  44. typedef struct RDF_CursorStruct* RDF_Cursor;
  45. typedef struct RDF_DBStruct* RDF;
  46. typedef uint32 RDF_EventType;
  47.  
  48. #define RDF_ASSERT_NOTIFY    ((RDF_EventType)0x00000001)
  49. #define RDF_DELETE_NOTIFY    ((RDF_EventType)0x00000002)
  50. #define RDF_KILL_NOTIFY        ((RDF_EventType)0x00000004)
  51. #define RDF_CREATE_NOTIFY    ((RDF_EventType)0x00000008)
  52. #define RDF_RESOURCE_GC_NOTIFY    ((RDF_EventType)0x00000010)
  53. #define RDF_INSERT_NOTIFY    ((RDF_EventType)0x00000020)
  54.  
  55. struct RDF_NotificationStruct;
  56.  
  57. typedef struct  RDF_AssertEventStruct {
  58.   RDF_Resource u;
  59.   RDF_Resource s;
  60.   void*        v;
  61.   RDF_ValueType type;
  62.   PRBool       tv;
  63.   char*        dataSource;
  64. } *RDF_AssertEvent;
  65.  
  66.  
  67. typedef struct RDF_UnassertEventStruct {
  68.   RDF_Resource u;
  69.   RDF_Resource s;
  70.   void*        v;
  71.   RDF_ValueType type;
  72.   char*        dataSource;
  73. } *RDF_UnassertEvent;
  74.  
  75. typedef struct RDF_KillEventStruct {
  76.   RDF_Resource u;
  77. } *RDF_KillEvent;
  78.  
  79.  
  80. typedef struct RDF_EventStruct {
  81.   RDF_EventType eventType;
  82.   union ev {
  83.     struct RDF_AssertEventStruct assert;
  84.     struct RDF_UnassertEventStruct unassert;
  85.     struct RDF_KillEventStruct    kill;
  86.   } event;
  87. } *RDF_Event;
  88.  
  89.  
  90.  
  91.  
  92. typedef struct _RDF_InitParamsStruct {
  93.     char    *profileURL;
  94.     char    *bookmarksURL;
  95.     char    *globalHistoryURL;
  96. } RDF_InitParamsStruct;
  97.  
  98. typedef struct _RDF_InitParamsStruct* RDF_InitParams;
  99.  
  100. typedef struct RDF_NotificationStruct* RDF_Notification; 
  101.  
  102. typedef void (*RDF_NotificationProc)(RDF_Event theEvent, void* pdata);
  103.  
  104.  
  105. /* core rdf apis */
  106.  
  107. PR_PUBLIC_API(RDF) RDF_GetDB(const char** dbs);
  108. PR_PUBLIC_API(RDF_Error) RDF_ReleaseDB(RDF rdf);
  109. PR_PUBLIC_API(RDF_Resource) RDF_GetResource(RDF db, char* id, PRBool createp);
  110. PR_PUBLIC_API(RDF_Error) RDF_ReleaseResource(RDF db, RDF_Resource resource);
  111. PR_PUBLIC_API(RDF_Error) RDF_DeleteAllArcs(RDF rdfDB, RDF_Resource source);
  112.  
  113.  
  114. PR_PUBLIC_API(RDF_Notification) RDF_AddNotifiable (RDF rdfDB, RDF_NotificationProc callBack, RDF_Event ev, void* pdata);
  115. PR_PUBLIC_API(RDF_Error) RDF_DeleteNotifiable (RDF_Notification ns);
  116.  
  117.  
  118. PR_PUBLIC_API(PRBool) RDF_Assert(RDF rdfDB, RDF_Resource source, RDF_Resource arcLabel, 
  119.                  void* target, RDF_ValueType targetType);
  120. PR_PUBLIC_API(PRBool) RDF_AssertFalse(RDF rdfDB, RDF_Resource source, RDF_Resource arcLabel, 
  121.                       void* target, RDF_ValueType targetType);
  122. PR_PUBLIC_API(PRBool) RDF_Unassert(RDF rdfDB, RDF_Resource source, RDF_Resource arcLabel, 
  123.                    void* target, RDF_ValueType targetType);
  124.  
  125.  
  126. PR_PUBLIC_API(PRBool) RDF_CanAssert(RDF rdfDB, RDF_Resource u, RDF_Resource arcLabel, void* v, RDF_ValueType targetType);
  127. PR_PUBLIC_API(PRBool) RDF_CanAssertFalse(RDF rdfDB, RDF_Resource u, RDF_Resource arcLabel, void* v, RDF_ValueType targetType);
  128. PR_PUBLIC_API(PRBool) RDF_CanUnassert(RDF rdfDB, RDF_Resource u, RDF_Resource arcLabel, void* v, RDF_ValueType targetType);
  129.  
  130.  
  131. PR_PUBLIC_API(PRBool) RDF_HasAssertion (RDF rdfDB, RDF_Resource source, RDF_Resource arcLabel, 
  132.                     void* target, RDF_ValueType targetType, PRBool tv);
  133. PR_PUBLIC_API(void*) RDF_GetSlotValue (RDF rdfDB, RDF_Resource u, RDF_Resource s, RDF_ValueType targetType, 
  134.                        PRBool inversep, PRBool tv);
  135. PR_PUBLIC_API(RDF_Cursor) RDF_GetTargets (RDF rdfDB, RDF_Resource source, RDF_Resource arcLabel, 
  136.                       RDF_ValueType targetType,  PRBool tv);    
  137. PR_PUBLIC_API(RDF_Cursor) RDF_GetSources (RDF rdfDB, RDF_Resource target, RDF_Resource arcLabel, 
  138.                       RDF_ValueType sourceType,  PRBool tv);    
  139. PR_PUBLIC_API(RDF_Cursor) RDF_ArcLabelsOut (RDF rdfDB, RDF_Resource u);
  140. PR_PUBLIC_API(RDF_Cursor) RDF_ArcLabelsIn (RDF rdfDB, RDF_Resource u);
  141. PR_PUBLIC_API(void*) RDF_NextValue(RDF_Cursor c);
  142. PR_PUBLIC_API(char*) RDF_ValueDataSource(RDF_Cursor c);
  143. PR_PUBLIC_API(RDF_ValueType) RDF_CursorValueType(RDF_Cursor c);
  144. PR_PUBLIC_API(RDF_Error) RDF_DisposeCursor (RDF_Cursor c);
  145.  
  146.  
  147.  
  148. /*** Guha needs to get his act together and figure out how to do this.
  149. PR_PUBLIC_API(RDF_Error) RDF_Undo(RDF rdf);
  150. ***/
  151.  
  152. /* These two should be removed soon. They are here because Nav Center
  153. depends on them. */
  154.  
  155. /* PR_PUBLIC_API(RDF_Error) RDF_Init(char *profileDirURL); */
  156. PR_PUBLIC_API(RDF_Error) RDF_Init(RDF_InitParams params);
  157. PR_PUBLIC_API(RDF_Error) RDF_Shutdown(void);
  158.  
  159.  
  160. /** utilities : move out of here!!! **/
  161. /* well known resources */
  162.  
  163.  
  164. #include "vocab.h"
  165.  
  166. /* the stuff in vocab.h will supercede whats below. I am leaving this here
  167.    only for the very near future */
  168.  
  169.  
  170. PR_PUBLIC_API(char*) RDF_GetResourceName(RDF rdfDB, RDF_Resource node);
  171.  
  172. PR_PUBLIC_API(RDF_Resource) RDFUtil_GetFirstInstance (RDF_Resource type, char* defaultURL);
  173. PR_PUBLIC_API(void) RDFUtil_SetFirstInstance (RDF_Resource type, RDF_Resource item);
  174.  
  175. typedef void (*printProc)(void* data, char* str);
  176. PR_PUBLIC_API(void) outputMCFTree  (RDF db, printProc printer, void* data, RDF_Resource node);
  177. PR_PUBLIC_API(RDF_Resource) RDFUtil_GetBreadcrumb();
  178. PR_PUBLIC_API(RDF_Resource) RDFUtil_GetQuickFileFolder();
  179. PR_PUBLIC_API(void) RDFUtil_SetQuickFileFolder(RDF_Resource container);
  180. PR_PUBLIC_API(RDF_Resource) RDFUtil_GetPTFolder();
  181. PR_PUBLIC_API(void) RDFUtil_SetPTFolder(RDF_Resource container);
  182. PR_PUBLIC_API(RDF_Cursor)  RDF_Find (RDF_Resource s, void* v, RDF_ValueType type);
  183. PR_PUBLIC_API(RDF_Resource) RDFUtil_GetNewBookmarkFolder();
  184. PR_PUBLIC_API(void) RDFUtil_SetNewBookmarkFolder(RDF_Resource container);
  185. PR_PUBLIC_API(RDF_Resource) RDFUtil_GetDefaultSelectedView();
  186. PR_PUBLIC_API(void) RDFUtil_SetDefaultSelectedView(RDF_Resource container);
  187.  
  188. /** end utilities **/
  189.  
  190. /* this stuff is stuck in here for netlib */
  191.  
  192.  
  193.  
  194.  
  195. NSPR_END_EXTERN_C
  196.  
  197. #endif /* rdf_h___ */
  198.