// ---------------------------------------------------------------------------
// - HtmlRef.hpp                                                             -
// - afnix:www library - html ref element class definition                   -
// ---------------------------------------------------------------------------
// - This program is free software;  you can redistribute it  and/or  modify -
// - it provided that this copyright notice is kept intact.                  -
// -                                                                         -
// - This program  is  distributed in  the hope  that it will be useful, but -
// - without  any  warranty;  without  even   the   implied    warranty   of -
// - merchantability or fitness for a particular purpose.  In no event shall -
// - the copyright holder be liable for any  direct, indirect, incidental or -
// - special damages arising in any way out of the use of this software.     -
// ---------------------------------------------------------------------------
// - copyright (c) 1999-2005 amaury darsch                                   -
// ---------------------------------------------------------------------------

#ifndef  AFNIX_HTMLREF_HPP
#define  AFNIX_HTMLREF_HPP

#ifndef  AFNIX_HTMLELEMENT_HPP
#include "HtmlElement.hpp"
#endif

namespace afnix {

  /// The HtmlRef class is a html element for a reference (A element). The
  /// reference is built with a path and and text. Since the reference is
  /// an element, additional tag can be added on request.
  /// @author amaury darsch

  class HtmlRef : public HtmlElement {
  protected:
    /// the reference path
    String d_path;
    /// the reference text
    String d_text;

  public:
    /// create a default element
    HtmlRef (void);
    
    /// create an element with a path
    /// @param path the element path
    HtmlRef (const String& path);

    /// create an element with a path
    /// @param path the element path
    /// @param text the element text
    HtmlRef (const String& path, const String& text);

    /// @return the class name
    String repr (void) const;

    /// set the element text
    /// @param text the element text to set
    void settext (const String& text);

    /// @return the element text
    String gettext (void) const;

    /// emit the element into a buffer
    void emit (Buffer& buf) const;

    /// generate a new div element object
    /// @param argv the argument vector
    static Object* mknew (Vector* argv);

    /// apply this div element with a set of arguments and a quark
    /// @param robj  robj the current runnable
    /// @param nset  the current nameset    
    /// @param quark the quark to apply these arguments
    /// @param argv  the arguments to apply
    Object* apply (Runnable* robj, Nameset* nset, const long quark,
                   Vector* argv);
    
  private:
    // make the copy constructor private
    HtmlRef (const HtmlRef&);
    // make the assignment operator private
    HtmlRef& operator = (const HtmlRef&);
  };
}

#endif
