/usr/include/Wt/WLink is in libwt-dev 3.3.3+dfsg-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2011 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WLINK_H_
#define WLINK_H_
#ifndef WT_CNOR
#include <boost/variant.hpp>
#else
#include <boost/any.hpp>
#endif
#include <Wt/WGlobal>
#include <string>
namespace Wt {
/*! \brief A value class that defines a hyperlink target.
*
* This class abstracts a link target. Depending on the context, it
* may reference a URL, a dynamic \link WResource resource\endlink, or
* (for certain usages) an internal path.
*
* \sa WAnchor, WImage, WMediaPlayer, WPopupMenuItem, WPushButton
*/
class WT_API WLink
{
public:
/*! \brief An enumeration for a link type.
*
* \sa type()
*/
enum Type {
Url, //!< A static URL.
Resource, //!< A dynamic resource.
InternalPath //!< An internal path.
};
/*! \brief Default constructor.
*
* This constructs a null link.
*/
WLink();
/*! \brief Creates a link to a (static) URL.
*
* \sa setUrl()
*/
WLink(const char *url);
/*! \brief Creates a link to a (static) URL.
*
* \sa setUrl()
*/
WLink(const std::string& url);
/*! \brief Creates a link to a (static) URL or an internal path.
*
* Using this constructor, you can create a link to a static URL (\p
* type == WLink::Url) or an internal path (\p type ==
* WLink::InternalPath). For an internal path, the \p value will
* be interpreted as a UTF8 encoded string.
*
* \sa setUrl(), setInternalPath()
*/
WLink(Type type, const std::string& value);
/*! \brief Creates a link to a resource.
*
* \if cpp
* Ownership of the \p resource is not transferred to the link (or to
* the widget that deals with it), to allow resources to be shared.
* \endif
*
* \sa setResource()
*/
WLink(WResource *resource);
/*! \brief Returns the link type.
*
* The type is implicitly set depending on the constructor or after
* calling setUrl(), setResource() or setInternalPath().
*
* The default type for a null link is WLink::Url.
*/
Type type() const { return type_; }
/*! \brief Returns whether the link is unspecified.
*
* A null link is a link created using the default constructor and
* points to nowhere.
*
* \sa WLink()
*/
bool isNull() const;
/*! \brief Sets the link URL.
*
* This sets the type to WLink::Url.
*/
void setUrl(const std::string& url);
/*! \brief Returns the link URL.
*
* The return value is the URL set by setUrl(), the resource URL of
* the resource set using setResource(), or the canonical URL of
* an internal path within the current application context.
*/
std::string url() const;
/*! \brief Sets the link resource.
*
* This sets the type to WLink::Resource.
*
* \if cpp
* Ownership of the \p resource is not transferred to the link (or to
* the widget that deals with it), to allow resources to be shared.
* \endif
*/
void setResource(WResource *resource);
/*! \brief Returns the link resource.
*
* This returns the resource previously set using setResource(), or \c 0.
*
* \sa setResource()
*/
WResource *resource() const;
/*! \brief Sets the link internal path.
*
* This points the link to the given internal path.
*/
void setInternalPath(const WT_USTRING& internalPath);
/*! \brief Returns the internal path.
*
* This returns the internal path perviously set using setInternalPath(),
* or an empty string otherwise.
*
* \sa setInternalPath().
*/
WT_USTRING internalPath() const;
/*! \brief Comparison operator.
*/
bool operator== (const WLink& other) const;
/*! \brief Comparison operator.
*/
bool operator!= (const WLink& other) const;
std::string resolveUrl(WApplication *app) const;
private:
Type type_;
#ifndef WT_CNOR
boost::variant<std::string, WResource *> value_;
#else
boost::any value_;
#endif
JSlot *manageInternalPathChange(WApplication *app, WInteractWidget *widget,
JSlot *slot) const;
friend class WAnchor;
friend class WAbstractArea;
};
}
#endif // WLINK_H_
|