/* ----------------------------------------------------------------------------
 * 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 QueryParser : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

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

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

  ~QueryParser() {
    Dispose();
  }

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

  public QueryParser(string field, Analyzer analyzer) : this(libCLcsharpPINVOKE.new_QueryParser(field, Analyzer.getCPtr(analyzer)), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Query parse(string query) {
    IntPtr cPtr = libCLcsharpPINVOKE.QueryParser_parse__SWIG_0(swigCPtr, query);
    Query ret = (cPtr == IntPtr.Zero) ? null : new Query(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Query parse(Reader reader) {
    IntPtr cPtr = libCLcsharpPINVOKE.QueryParser_parse__SWIG_1(swigCPtr, Reader.getCPtr(reader));
    Query ret = (cPtr == IntPtr.Zero) ? null : new Query(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Query parse(string query, string field, Analyzer analyzer) {
    IntPtr cPtr = libCLcsharpPINVOKE.QueryParser_parse__SWIG_2(query, field, Analyzer.getCPtr(analyzer));
    Query ret = (cPtr == IntPtr.Zero) ? null : new Query(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
