Logo Search packages:      
Sourcecode: xapian-bindings version File versions  Download package

WritableDatabase.cs

/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.30
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace Xapian {

using System;
using System.Runtime.InteropServices;

public class WritableDatabase : Database {
  private HandleRef swigCPtr;

  internal WritableDatabase(IntPtr cPtr, bool cMemoryOwn) : base(XapianPINVOKE.WritableDatabaseUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(WritableDatabase obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~WritableDatabase() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
        swigCMemOwn = false;
        XapianPINVOKE.delete_WritableDatabase(swigCPtr);
      }
      swigCPtr = new HandleRef(null, IntPtr.Zero);
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  public WritableDatabase() : this(XapianPINVOKE.new_WritableDatabase__SWIG_0(), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public WritableDatabase(string path, int action) : this(XapianPINVOKE.new_WritableDatabase__SWIG_1(path, action), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public WritableDatabase(WritableDatabase other) : this(XapianPINVOKE.new_WritableDatabase__SWIG_2(WritableDatabase.getCPtr(other)), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Flush() {
    XapianPINVOKE.WritableDatabase_Flush(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void BeginTransaction(bool flushed) {
    XapianPINVOKE.WritableDatabase_BeginTransaction__SWIG_0(swigCPtr, flushed);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void BeginTransaction() {
    XapianPINVOKE.WritableDatabase_BeginTransaction__SWIG_1(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void CommitTransaction() {
    XapianPINVOKE.WritableDatabase_CommitTransaction(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void CancelTransaction() {
    XapianPINVOKE.WritableDatabase_CancelTransaction(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public uint AddDocument(Document document) {
    uint ret = XapianPINVOKE.WritableDatabase_AddDocument(swigCPtr, Document.getCPtr(document));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void DeleteDocument(uint did) {
    XapianPINVOKE.WritableDatabase_DeleteDocument__SWIG_0(swigCPtr, did);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void ReplaceDocument(uint did, Document document) {
    XapianPINVOKE.WritableDatabase_ReplaceDocument__SWIG_0(swigCPtr, did, Document.getCPtr(document));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void DeleteDocument(string unique_term) {
    XapianPINVOKE.WritableDatabase_DeleteDocument__SWIG_1(swigCPtr, unique_term);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public uint ReplaceDocument(string unique_term, Document document) {
    uint ret = XapianPINVOKE.WritableDatabase_ReplaceDocument__SWIG_1(swigCPtr, unique_term, Document.getCPtr(document));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public new string GetDescription() {
    string ret = XapianPINVOKE.WritableDatabase_GetDescription(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}

Generated by  Doxygen 1.6.0   Back to index