/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.5
 *
 * 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 ValueSetMatchDecider : MatchDecider {
  private HandleRef swigCPtr;

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

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

  ~ValueSetMatchDecider() {
    Dispose();
  }

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

  public ValueSetMatchDecider(uint slot, bool inclusive_) : this(XapianPINVOKE.new_ValueSetMatchDecider(slot, inclusive_), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void AddValue(string value) {
    XapianPINVOKE.ValueSetMatchDecider_AddValue(swigCPtr, value);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void RemoveValue(string value) {
    XapianPINVOKE.ValueSetMatchDecider_RemoveValue(swigCPtr, value);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public override bool Apply(Document doc) {
    bool ret = XapianPINVOKE.ValueSetMatchDecider_Apply(swigCPtr, Document.getCPtr(doc));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
