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

namespace clucene.net {

using System;
using System.Runtime.InteropServices;

public class DocumentWriter : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal DocumentWriter(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

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

  ~DocumentWriter() {
    Dispose();
  }

  public virtual void Dispose() {
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
      swigCMemOwn = false;
      libCLcsharpPINVOKE.delete_DocumentWriter(swigCPtr);
    }
    swigCPtr = new HandleRef(null, IntPtr.Zero);
    GC.SuppressFinalize(this);
  }

  public DocumentWriter(Directory d, Analyzer a, Similarity similarity, int maxFieldLength) : this(libCLcsharpPINVOKE.new_DocumentWriter(Directory.getCPtr(d), Analyzer.getCPtr(a), Similarity.getCPtr(similarity), maxFieldLength), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void addDocument(string segment, Document doc) {
    libCLcsharpPINVOKE.DocumentWriter_addDocument(swigCPtr, segment, Document.getCPtr(doc));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

}

}
