os_hyperlink
|
 |
A hyperlink.
An os_hyperlink
is often used to associate text or image objects with another Web page. An os_hyperlink
is an association between a group of elements and a resource.
- Elements-The elements are
the contents of the
os_hyperlink . The os_hyperlink
contents are typically rendered in a different color font or underlined.
An initial element for the os_hyperlink
contents can be specified in a constructor. Additional elements can be added to
the os_hyperlink through either the add()
member functions or operator<< .
The elements contained within
the os_hyperlink serve as a reference to the
resource such that when an element is selected within a browser, the specified
resource is retrieved and displayed.
- Resource-The resource is
identified by a URL or a URL and a label. The URL and label of the resource
are specified in a constructor and can be modified through the
url()
and label() member functions.
- URL only-A resource
specified by a URL only is displayed starting at the beginning of the
resource.
- URL and a label-A resource
specified by both a URL and a label is displayed starting at the location
within the resource specified by the label. If the URL is specified as an
empty string (
" " ), the label
refers to a location within the current Web page.
To use a label, you must mark
a location within a Web page by inserting an os_label
at the desired position. The os_label name can then
be specified in an os_hyperlink .
Optionally, an os_hyperlink
can be assigned a name through the name() member
function. This name functions as an os_label and
can be specified in another os_hyperlink .
By default, the resource is
displayed in the browser view area, or frame, that contained the os_hyperlink
. When the display is partitioned into multiple frames, the resource can be
directed to another frame by specifying the frame name through the target()
member function. A frame can be assigned a name through the os_frame::name()
member function.
An os_hyperlink
can define the relationship of the resource to the current page through a string
of space-separated, case-insensitive relationship values. For example, a
relationship value of "next" could specify the resource as the next
document in a sequence. The reverse relationship, that is, the relationship of
the current page to the destination, can be defined in the same way. For
example, a reverse relationship value of "previous" can specify that
the current page is the previous document in a sequence. These relationship
values provide an explanation for the os_hyperlink
's existence, and they can be specified through the rel()
and rev() member functions.
Declaration
#include <ospace/web/hyperlnk.h>
class os_hyperlink : public os_element_group
Interface
Constructor
os_hyperlink(
const string& url ,
const os_element& element )
Constructs a hyperlink,
containing a copy of element , that references url
.
Constructor
os_hyperlink(
const string& url ,
const string& text )
Constructs a hyperlink,
containing an os_text element created from text
, that references url .
Constructor
os_hyperlink(
const string& url ,
const string& label ,
const os_element& element )
Constructs a hyperlink,
containing a copy of element , that references label
within url .
Constructor
os_hyperlink(
const string& url ,
const string& label ,
const os_element& element ,
const string& target )
Constructs a hyperlink,
containing a copy of element , that references label
within url , with the output directed to the
window target .
Constructor
os_hyperlink(
const string& url ,
const string& label ,
const string& text )
Constructs a hyperlink,
containing an os_text element created from text
, that references label within url
.
Constructor
os_hyperlink(
const string& url ,
const string& label ,
const string& text ,
const string& target )
Constructs a hyperlink,
containing an os_text element created from text
, that references label within url
, with the output directed to the window target.
Constructor
os_hyperlink(
const os_hyperlink& rhs )
Constructs a hyperlink
that is a copy of rhs .
Destructor
/*
virtual */ ~os_hyperlink()
Destroys the hyperlink.
=
os_hyperlink&
operator=( const os_hyperlink& rhs )
Replaces the hyperlink
contents with a copy of rhs and returns a
reference to the hyperlink.
clone
/*
virtual */ os_element* clone() const
Returns a base class
pointer to a heap-based deep copy of the hyperlink.
label
os_hyperlink&
label( const string& label )
Sets the reference to label
within the current URL and returns a reference to the hyperlink.
label
string
label() const
Returns the destination
label, or the empty string if not set.
name
os_hyperlink&
name( const string& name )
Sets the hyperlink name to
name and returns a reference to the hyperlink.
name
string
name() const
Returns the name, or the
empty string if not set.
rel
os_hyperlink&
rel( const string& rel )
Sets the destination
relationship to rel and returns a reference to the
hyperlink.
rel
string
rel() const
Returns the destination
relationship, or the empty string if not set.
rev
string
rev() const
Returns the destination
reverse relationship, or the empty string if not set.
rev
os_hyperlink&
rev( const string& rev )
Sets the reverse
relationship to rev and returns a reference to the
hyperlink.
target
string
target() const
Returns the target window,
or the empty string if not set.
target
os_hyperlink&
target( const string& target )
Sets the target window to target
and returns a reference to the hyperlink.
title
os_hyperlink&
title( const string& title )
Sets the title to title
and returns a reference to the hyperlink.
title
string
title() const
Returns the title, or the
empty string if not set.
url
string
url() const
Returns the destination
URL.
url
os_hyperlink&
url( const string& url )
Sets the reference to url
and returns a reference to the hyperlink.
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved