htmlHyperLink
Hypertext link class
[Previous] [Main] [Next]


Description
htmlHyperLink encapsulates the <A HREF></A> tags. Hyperlinks are used to associate text and images within one document to another document. htmlHyperLink objects associate a URL with a group of object elements, which can be added to the htmlHyperLink object using the Add() method or the << operator.  
 
By default, linked URL's will be displayed in the default browser window, or frame. If the browser display is broken into multiple frames, the URL can be directed to a particular frame name using the Target() method. Frames are named using htmlFrame::Name(), and are created in conjunction with the htmlFrameSet class.  
 
References to specific locations within other URL's can be made using the Label() method. The htmlLabel object is used to mark such labels in documents.  
 
Declaration
#include <dcmicro/htmlpp/hyperlnk.h>  
 
Hierarchy
htmlhyperlink.gif  
 
See Also
htmlLabel, htmlFrame, htmlFrameSet  
 
Advanced Topics : Redirecting Browsers to Another Page in the User's Guide  
 
Related Constants/Definitions
None.  
 
Constructors
htmlHyperLink()  
Constructs an empty hyperlink object.  
 
htmlHyperLink( const String& url )  
Constructs an empty hyperlink object that references url.  
 
htmlHyperLink( const String& url, const htmlObject& element )  
Constructs a hyperlink, containing a copy of element, that references url.  
 
htmlHyperLink( const String& url, const String& text )  
Constructs a hyperlink, containing a copy of text, that references url.  
 
htmlHyperLink( const String& url, const String& label, const htmlObject& element )  
Constructs a hyperlink, containing a copy of element, that references label within url.  
 
htmlHyperLink( const String& url, const String& label, const String& text )  
Constructs a hyperlink, containing a copy of text, that references label within url.  
 
htmlHyperLink(const String& url,  
   const String& label,  
   const String& text,  
   const String& target_window )  
Constructs a hyperlink, containing a copy of text, that references label within url, with the output sent to window target_window.  
 
htmlHyperLink( const htmlHyperLink& rhs )  
Copy constructor.  
 
Destructors
virtual ~htmlHyperLink()  
Destroys the object.  
 
Member Methods
=   htmlHyperLink& operator=( const htmlHyperLink& rhs )  
Replaces the contents with rhs and returns a pointer to the object.  
 
URL   htmlHyperLink& URL( const String& url )  
Sets the hyperlink url, then returns a reference to the object.  
 
URL   String URL() const  
Returns the hyperlink url as a string.  
 
LabelhtmlHyperLink& Label( const String& label )  
Sets the hyperlink to reference label within the url, then returns a reference to the object. If the URL is not set, label refers to the current document.  
 
LabelString Label() const  
Returns the label reference within the url, or an empty string if not set.  
 
NamehtmlHyperLink& Name( const String& name )  
Sets the hyperlink name to name, then returns a reference to the object.  
 
NameString Name() const  
Returns the hyperlink name, or an empty string if not set.  
 
Rel   htmlHyperLink& Rel( const String& relationship )  
Sets the hyperlink relationship to relationship, then returns a reference to the object.  
 
Rel   String Rel() const  
Returns the hyperlink relationship, or an empty string if not set.  
 
Rev   htmlHyperLink& Rev( const String& reverse_relationship )  
Sets the hyperlink reverse relationship to reverse_elationship, then returns a reference to the object.  
 
Rev   String Rev() const  
Returns the hyperlink reverse relationship, or an empty string if not set.  
 
TargethtmlHyperLink& Target( const String& target_window )  
Sets the target window frame for the hyperlink to target_window, then returns a reference to the object. See Target Windows and htmlFrame for additional details.  
 
TargetString Target() const  
Returns the target window frame for the hyperlink, or an empty string if not set.  
 
Title   htmlHyperLink& Title( const String& title )  
Sets the title to title, then returns a reference to the object.  
 
Title   String Title() const  
Returns the title for the hyperlink, or an empty string if not set.  
 
ClonehtmlObject FAR * Clone() const  
Returns a base-class pointer to a deep copy of the object.  
 
Example Use
 
#include <stdio.h>  
#include <stdlib.h>  
#include <dcmicro/htmlpp/htmlpp.h>  
 
int main( void )  
{  
   htmlCgi   server ;  
   htmlPage  page( "html++ example application" ) ;  
 
   htmlParagraph  p ;  
 
   //  Create a simple hyperlink to another page  
   page << htmlHyperLink( "http://www.dcmicro.com""Click here" )  
        << " to jump to DC Micro Development's home page."  
        << p ;  
 
   //  Create a hyperlinked image  
   page << "Click on the image "  
       << htmlHyperLink( "http://www.dcmicro.com/crusher/get_crusher.html",  
            htmlImage( "http://www.dcmicro.com/images/gc.gif""Download demo" ) )  
      << " to download a demo of Crusher."  
      << p ;  
 
   //  Create a hyperlink to a specific location  
   //  within another page  
   page << "To find out about annual support options, "  
       << htmlHyperLink( "http://www.dcmicro.com/crusher/pricing.html",  
             "Support""click here." )  
      << p ;  
 
   server << page ;  
   return 0 ;  
}  
 
Program Output
 
Content-Type: text/html  
<HTML>  
<HEAD>  
<TITLE>html++ example application</TITLE>  
</HEAD>  
<BODY>  
<A HREF="http://www.dcmicro.com">Click here</A> to jump to DC Micro Development's home page.<P></P>  
Click on the image  
<A HREF="http://www.dcmicro.com/crusher/get_crusher.html">  
<IMG SRC="http://www.dcmicro.com/images/gc.gif" ALT="Download demo"></IMG></A> to download a demo of Crusher.<P></P>  
To find out about annual support options,  
<A HREF="http://www.dcmicro.com/crusher/pricing.html#Support">click here.</A><P></P>  
</BODY>  
</HTML>  
 
hyperlink.gif  



©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.