home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / simpdata.idl < prev    next >
Text File  |  1998-04-25  |  8KB  |  226 lines

  1. //+------------------------------------------------------------------------
  2. //
  3. //  OLEDBSimpleProvider interface
  4. //
  5. //  Copyright 1993 - 1998 Microsoft Corporation.
  6. //
  7. //  File:       simpdata.idl
  8. //
  9. //-------------------------------------------------------------------------
  10.  
  11. cpp_quote("//=--------------------------------------------------------------------------=")
  12. cpp_quote("// simpdata.h")
  13. cpp_quote("//=--------------------------------------------------------------------------=")
  14. cpp_quote("// Copyright 1995 - 1998 Microsoft Corporation.  All Rights Reserved.")
  15. cpp_quote("//")
  16. cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
  17. cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
  18. cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
  19. cpp_quote("// PARTICULAR PURPOSE.")
  20. cpp_quote("//=--------------------------------------------------------------------------=")
  21. cpp_quote("")
  22. cpp_quote("#pragma comment(lib,\"uuid.lib\")")
  23. cpp_quote("")
  24. cpp_quote("//--------------------------------------------------------------------------")
  25. cpp_quote("// Simple Tabular Data.")
  26. cpp_quote("")
  27. cpp_quote("#ifndef SIMPDATA_H")
  28. cpp_quote("#define SIMPDATA_H")
  29.  
  30. //import "ocidl.idl";
  31. import "objidl.idl";
  32. import "oleidl.idl";
  33. import "oaidl.idl";
  34.  
  35. // We use signed integers for row and column numbers, starting with the value 1.
  36. // The value 0 refers to any "label" or "header" information, distinct from the
  37. // data.  The value -1 refers to any an unknown value, or all values, so, for
  38. // example, iRow = -1, iCol = 2 refers to all of column 2
  39.  
  40. cpp_quote("#define OSP_IndexLabel      (0)")
  41. cpp_quote("#define OSP_IndexAll        (~0ul)")
  42. cpp_quote("#define OSP_IndexUnknown    (~0ul)")
  43. cpp_quote("")
  44.  
  45. [
  46.         uuid(E0E270C2-C0BE-11d0-8FE4-00A0C90A6341),
  47.         helpstring("OLE-DB Simple Provider Type Library"),
  48.         lcid(0x409),
  49.         version(1.4)
  50. ]
  51.  
  52. library std
  53. {
  54.  
  55. //
  56. // Java users should compile this file with -DFORJAVA.  This enables the Set/GetVariant
  57. // function to take/return "Objects" instead of Variants.  
  58. //
  59. #ifdef FORJAVA
  60. typedef struct
  61. {
  62.    VARIANT;
  63. } CustomMarshalableVariant;
  64. #else
  65. #define CustomMarshalableVariant VARIANT
  66. #endif
  67.  
  68. typedef enum OSPFORMAT
  69. {
  70.     OSPFORMAT_RAW = 0,     // set/get variant as is
  71.     OSPFORMAT_DEFAULT = 0, // default is RAW
  72.     OSPFORMAT_FORMATTED = 1,   // all variants converted to string representation
  73.     OSPFORMAT_HTML = 2      // variant converted to HTML string representation
  74.                             // (providers not required to implement this).
  75. } OSPFORMAT;
  76.  
  77. typedef enum OSPRW
  78. {
  79.     // All cells are presumed to be readable.
  80.     OSPRW_DEFAULT = 1,
  81.     OSPRW_READONLY = 0,     // readonly
  82.     OSPRW_READWRITE = 1,    // readwrite
  83.     OSPRW_MIXED = 2         // mixed or unknown; most callers will treat
  84.                                      // as READWRITE "Lazy" provider should just
  85.                                      // return OSPRW_MIXED
  86. } OSPRW;
  87.  
  88. typedef enum OSPFIND
  89. {
  90.     OSPFIND_DEFAULT = 0,
  91.     OSPFIND_UP = 1,             // scan backwards(decreasing row #s)
  92.     OSPFIND_CASESENSITIVE = 2
  93. } OSPFIND;
  94.  
  95. typedef enum OSPCOMP
  96. {
  97.                             // These values derived from bitmasks
  98.                             // i.e.       GT  LT  EQ    
  99.     OSPCOMP_EQ = 1,         // OSPCOMP_EQ          1 Equal
  100.     OSPCOMP_DEFAULT = 1,    // OSPCOMP_EQ is the default
  101.     OSPCOMP_LT = 2,         // OSPCOMP_LT      1   0 Less than
  102.     OSPCOMP_LE = 3,         // OSPCOMP_LE      1   1 Less than or equal
  103.     OSPCOMP_GE = 4,         // OSPCOMP_GT  1   0   0 Greater than or equal
  104.     OSPCOMP_GT = 5,         // OSPCOMP_GE  1   0   1 Greater than
  105.     OSPCOMP_NE = 6,         // OSPCOMP_NE  1   1   0 Not equal
  106. } OSPCOMP;
  107.  
  108. typedef enum OSPXFER
  109. {
  110.     OSPXFER_COMPLETE = 0,
  111.     OSPXFER_ABORT = 1,
  112.     OSPXFER_ERROR = 2
  113. } OSPXFER;
  114.  
  115. [
  116.         object,
  117.         uuid(E0E270C1-C0BE-11d0-8FE4-00A0C90A6341),
  118.         pointer_default(unique),
  119.         local,
  120.         version(1.4)
  121. ]
  122. interface OLEDBSimpleProviderListener : IUnknown
  123. {
  124.       // As noted above; a -1 (STD_IndexAll) can be used in the row or column
  125.       // (or both).  For example, CellChanged(STD_IndexAll, OSP_IndexAll)
  126.       // implies that all rows and columns changed shape.
  127.   
  128.       HRESULT aboutToChangeCell([in] long iRow, [in] long iColumn);
  129.       HRESULT cellChanged([in] long iRow, [in] long iColumn);
  130.       HRESULT aboutToDeleteRows([in] long iRow, [in] long cRows);
  131.       HRESULT deletedRows([in] long iRow, [in] long cRows);
  132.       HRESULT aboutToInsertRows([in] long iRow, [in] long cRows);
  133.       HRESULT insertedRows([in] long iRow, [in] long cRows);
  134.       HRESULT rowsAvailable([in] long iRow, [in] long cRows);
  135.       HRESULT transferComplete([in] OSPXFER xfer);
  136. }
  137.  
  138. [
  139.         object,
  140.         uuid(E0E270C0-C0BE-11d0-8FE4-00A0C90A6341),
  141.         pointer_default(unique),
  142.         local,
  143.         version(1.4)
  144. ]
  145. interface OLEDBSimpleProvider : IUnknown
  146. {
  147.       // Info-retrieving functions:
  148.       // ==========================
  149.       //
  150.       // Note that column names are retrieved using GetString or GetVariant
  151.       // with iRow == OSP_IndexLabel.  RWStatus for a whole row or column
  152.           // can be made with iRow or iColumn == OSP_IndexAll.
  153.  
  154.       HRESULT getRowCount([out,retval] long *pcRows);
  155.       HRESULT getColumnCount([out,retval] long *pcColumns);
  156.  
  157.  
  158.       HRESULT getRWStatus([in] long iRow, [in] long iColumn,
  159.               [out, retval] OSPRW *prwStatus);
  160.  
  161.       // Variant-oriented Get/Set:
  162.       // =========================
  163.       //
  164.       // Note that use of VARIANT precludes references.
  165.  
  166.       HRESULT getVariant([in] long iRow, [in] long iColumn,
  167.                          [in] OSPFORMAT format, [out, retval] CustomMarshalableVariant *pVar );
  168.       HRESULT setVariant([in] long iRow, [in] long iColumn,
  169.                          [in] OSPFORMAT format, [in] CustomMarshalableVariant Var );
  170.  
  171.       // Locale information:
  172.       // ===================
  173.       //
  174.  
  175.       HRESULT getLocale([out,retval] BSTR *pbstrLocale);
  176.  
  177.       // Deletion and Insertion:
  178.       // =======================
  179.       //
  180.       // For insertion, iRow or iColumn is index *before* which to insert; the
  181.       // first inserted row or column will end up with that index.
  182.       //
  183.       // In case of error, provider may choose to insert or delete only the
  184.       // first m of n rows or columns which client requested.  OUT parameter
  185.       // indicates how many rows or columns actually inserted or deleted.  In
  186.       // case of success, OUT parameter should be filled in with cRows.
  187.  
  188.       HRESULT deleteRows([in] long iRow, [in] long cRows,
  189.              [out, retval] long *pcRowsDeleted );
  190.       HRESULT insertRows([in] long iRow, [in] long cRows,
  191.              [out, retval] long *pcRowsInserted );
  192.  
  193.       // Find
  194.       // Find the first row in column iColumn that contains a value which
  195.       // matches val according to the compType.
  196.       // To continue searching past the found row, the caller should pass
  197.       // *piRowFound+1 as the next iRowStart, or *piRowFound-1 for backward
  198.       // searches (STDFIND_UP).
  199.  
  200.       HRESULT find([in] long iRowStart, [in] long iColumn,
  201.                    [in] CustomMarshalableVariant val,
  202.                    [in] OSPFIND findFlags,
  203.                    [in] OSPCOMP compType,
  204.                    [out, retval] long *piRowFound );
  205.  
  206.       // Establish or detach single event sink.
  207.  
  208.       HRESULT addOLEDBSimpleProviderListener([in] OLEDBSimpleProviderListener *pospIListener);
  209.       HRESULT removeOLEDBSimpleProviderListener([in] OLEDBSimpleProviderListener *pospIListener);
  210.  
  211.       // Asynch support
  212.  
  213.       HRESULT isAsync([out, retval] bool *pbAsynch);
  214.  
  215.       HRESULT getEstimatedRows([out, retval] long *piRows);
  216.  
  217.       // Stops any asynchronous download that may be in progress.
  218.       HRESULT stopTransfer();
  219. }
  220.  
  221. cpp_quote("typedef OLEDBSimpleProvider *LPOLEDBSimpleProvider;")
  222.  
  223. }
  224.  
  225. cpp_quote("#endif")
  226.