/*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
 * 
 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
 * language governing rights and limitations under the License.
 * 
 * The Original Code is the Venice Web Communities System.
 * 
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 * Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 * 
 * Contributor(s): 
 */
package com.silverwrist.dynamo.iface;

import java.io.Reader;

/**
 * The public interface of the HTML Checker.  It is used to preprocess text which comes from the user which may have
 * embedded HTML; it rejects HTML considered too dangerous, balances unclosed HTML tags, and can perform other actions
 * as well (such as checking spelling).
 * <P>The original HTML Checker was an ASP component created for Durand's CommunityWare in 1998.  A workalike version
 * was written in Java, by Eric J. Bowersox, for a possible Java-based CommunityWare workalike; this code was
 * completely rewritten in 2001, using a new design, for the initial versions of Venice, and has been rewritten yet
 * again for Venice/Dynamo.
 *
 * @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
 * @version X
 */
public interface HTMLChecker extends ObjectStore
{
  /**
   * Appends the text contained in the string to the HTML Checker.
   *
   * @param str The text to be added to the HTML Checker.
   */
  public void append(String str);

  /**
   * Appends the text contained in a {@link java.io.Reader Reader} to the HTML Checker.
   *
   * @param r Contains the text to be appended to the HTML Checker.
   */
  public void append(Reader r);

  /**
   * Completes processing of the HTML Checker.  All internal parser states are resolved, all opened but unclosed HTML
   * tags are closed, and the output is made available.
   */
  public void finish();

  /**
   * Resets this instance of the HTML Checker.  All internal state is reset and the output is cleared.
   */
  public void reset();

  /**
   * Returns the text value of this HTML Checker.  Can only be called after the {@link #finish() finish()} method
   * is called on this instance of the HTML Checker.
   *
   * @return The text in this HTML Checker.
   */
  public String getValue();

  /**
   * Returns the number of characters stored in this instance of the HTML Checker.  Can only be called after the
   * {@link #finish() finish()} method is called on this instance of the HTML Checker.
   *
   * @return The number of characters stored in this instance of the HTML Checker.
   */
  public int getLength();

  /**
   * Returns the number of lines of text stored in this instance of the HTML Checker.  Can only be called after the
   * {@link #finish() finish()} method is called on this instance of the HTML Checker.
   *
   * @return The number of lines of text stored in this instance of the HTML Checker.
   */
  public int getLines();

  /**
   * Returns the value of a registered counter on this instance of the HTML Checker.  Can only be called after the
   * {@link #finish() finish()} method is called on this instance of the HTML Checker.
   *
   * @param namespace Namespace of the counter to read.
   * @param name Name of the counter to read.
   * @return The value of the counter.
   */
  public int getCounter(String namespace, String name);

} // end interface HTMLChecker
