⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qnp.cpp

📁 这个是Linux的qt源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    consume up to the amount given by \a len. \a buffer is the data    available for consumption. The \a offset argument is merely an    informational value indicating the total amount of data that has    been consumed in prior calls.    This function should return the amount of data actually consumed.*/int QNPInstance::write(QNPStream*, int, int len, void*){    // Yes, we processed it all... into the bit bucket.    return len;}/*!    Requests that the \a url be retrieved and sent to the named \a    window. See Netscape's JavaScript documentation for an explanation    of window names.*/void QNPInstance::getURL(const char* url, const char* window){    NPN_GetURL( pi->npp, url, window );}/*!    \preliminary    This function is \e{not tested}.    It is an interface to the NPN_PostURL function of the Netscape    Plugin API.    Passes \a url, \a window, \a buf, \a len, and \a file to    NPN_PostURL.*/void QNPInstance::postURL(const char* url, const char* window,	     uint len, const char* buf, bool file){    NPN_PostURL( pi->npp, url, window, len, buf, file );}/*!    Print the instance full-page. By default, this returns FALSE,    causing the browser to call the (embedded) print() function    instead. Requests that the given \a url be retrieved and sent to    the named \a window. See Netscape's JavaScript documentation for    an explanation of window names. Passes the arguments including \a    data to NPN_GetURLNotify.    \sa    \link http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#npngeturlnotify    Netscape: NPN_GetURLNotify method\endlink*/void QNPInstance::getURLNotify(const char* url, const char* window, void*data){#ifdef Q_WS_WIN // Only on Windows?    NPN_GetURLNotify( pi->npp, url, window, data );#else    Q_UNUSED( url );    Q_UNUSED( window );    Q_UNUSED( data );#endif}/*!    \preliminary    This function is \e{not tested}.    It is an encapsulation of the NPP_Print function of the Netscape    Plugin API.*/bool QNPInstance::printFullPage(){    return FALSE;}/*!    \preliminary    This function is \e{not tested}.    Print the instance embedded in a page.    It is an encapsulation of the NPP_Print function of the Netscape    Plugin API.*/void QNPInstance::print(QPainter*){    // ### default could redirected-print the window.}/*!    Returns the number of arguments to the instance. Note that you    should not normally rely on the ordering of arguments, and also    note that the SGML specification does not permit multiple    arguments with the same name.    \sa arg(), argn()*/int QNPInstance::argc() const{    return pi->argc;}/*!    Returns the name of the \a{i}-th argument.    \sa argc(), argv()*/const char* QNPInstance::argn(int i) const{    return pi->argn[i];}/*!    \preliminary    This function is \e{not tested}.    Called whenever a \a url is notified after a call to    NPN_GetURLNotify with \a notifyData. The reason is given in \a r.    It is an encapsulation of the NPP_URLNotify function of the    Netscape Plugin API.    See also:    \link http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#nppurlnotify    Netscape: NPP_URLNotify method\endlink*/void QNPInstance::notifyURL(const char*, Reason, void*){}/*!    Returns the value of the \a{i}-th argument.    \as argc(), arg()*/const char* QNPInstance::argv(int i) const{    return pi->argv[i];}/*!    Returns the mode of the plugin.*/QNPInstance::InstanceMode QNPInstance::mode() const{    return (QNPInstance::InstanceMode)pi->fMode;}/*!    Returns the value of the named arguments, or 0 if no argument    called \a name appears in the \c{<EMBED>} tag of this instance.    If the argument appears, but has no value assigned, the empty    string is returned. In summary:    \table    \header \i Tag \i Result    \row \i \c{<EMBED ...>} \i arg("FOO") == 0    \row \i \c{<EMBED FOO ...>} \i arg("FOO") == ""    \row \i \c{<EMBED FOO=BAR ...>} \i arg("FOO") == "BAR"    \endtable*/const char* QNPInstance::arg(const char* name) const{    for (int i=0; i<pi->argc; i++) {	// SGML: names are case insensitive	if ( qstricmp( name, pi->argn[i] ) == 0 ) {	    if (pi->argv[i].isEmpty())		return "";	    else		return pi->argv[i];	}    }    return 0;}/*!    Returns the user agent (browser name) containing this instance.*/const char* QNPInstance::userAgent() const{    return NPN_UserAgent(pi->npp);}/*!    \preliminary    This function is \e{not tested}.    Requests the creation of a new data stream \e from the plug-in.    The mime type and window are passed in \a mimetype and \a window.    \a as_file holds the \c AsFileOnly flag. It is an interface to the    NPN_NewStream function of the Netscape Plugin API.*/QNPStream* QNPInstance::newStream(const char* mimetype, const char* window,    bool as_file){    NPStream* s=0;    NPError err = NPN_NewStream(pi->npp, (char*)mimetype, window, &s);    if (err != NPERR_NO_ERROR) return 0;    return s ? new QNPStream(this, mimetype, s, as_file) : 0;}/*!    Sets the status message in the browser containing this instance to    \a msg.*/void QNPInstance::status(const char* msg){    NPN_Status(pi->npp, msg);}/*!    Returns the Java object associated with the plug-in instance, an    object of the \link QNPlugin::getJavaClass() plug-in's Java    class\endlink, or 0 if the plug-in does not have a Java class,    Java is disabled, or an error occurred.    The return value is actually a \c{jref} we use \c{void*} so as to    avoid burdening plugins which do not require Java.    \sa QNPlugin::getJavaClass(), QNPlugin::getJavaEnv(), getJavaPeer()*/void* QNPInstance::getJavaPeer() const{    return NPN_GetJavaPeer(pi->npp);}/*!    \class QNPStream qnp.h    \brief The QNPStream class provides a stream of data provided to a QNPInstance by the browser.    \extension Netscape Plugin    Note that this is neither a QTextStream nor a QDataStream.    \sa QNPInstance::write(), QNPInstance::newStreamCreated()*//*!    Creates a stream. Plugins should not call this, but rather    QNPInstance::newStream() if a stream is required.    Takes a QNPInstance \a in, mime type \a mt, a pointer to an    _NPStream \a st and a seekable flag \a se.*/QNPStream::QNPStream(QNPInstance* in,const char* mt, _NPStream* st, bool se) :    inst(in),    stream(st),    mtype(mt),    seek(se){    isokay = TRUE;    iscomplete = FALSE;}/*!    Destroys the stream.*/QNPStream::~QNPStream(){    if (!qnps_no_call_back) {	qnps_no_call_back++;	NPN_DestroyStream(inst->pi->npp, stream, NPRES_USER_BREAK);	qnps_no_call_back--;    }}/*!    \fn QNPInstance* QNPStream::instance()    Returns the QNPInstance for which this stream was created.*//*!    Returns the URL from which the stream was created.*/const char* QNPStream::url() const{    return stream->url;}/*!    Returns the length of the stream in bytes. Can be 0 for streams of    unknown length.*/uint QNPStream::end() const{    return stream->end;}/*!    Returns the time when the source of the stream was last modified.*/uint QNPStream::lastModified() const{    return stream->lastmodified;}/*!    Returns the MIME type of the stream.*/const char* QNPStream::type() const{    return mtype;}/*!    Returns TRUE if the stream is seekable; otherwise returns FALSE.*/bool QNPStream::seekable() const{    return seek;}/*!  \internal*/void QNPStream::setOkay(bool y){    isokay = y;}/*!  \internal*/void QNPStream::setComplete(bool y){    iscomplete = y;}/*!    Returns TRUE if no errors have occurred on the stream; otherwise    returns FALSE.*/bool QNPStream::okay() const{    return isokay;}/*!    Returns TRUE if the stream has received all the data from the    source; otherwise returns FALSE.*/bool QNPStream::complete() const{    return iscomplete;}/*!    Requests the section of the stream, of \a length bytes from \a    offset, be sent to the QNPInstance::write() function of the    instance() of this stream.*/void QNPStream::requestRead(int offset, uint length){    NPByteRange range;    range.offset = offset;    range.length = length;    range.next = 0; // ### Only one supported at this time    NPN_RequestRead(stream, &range);}/*!    Writes \a len bytes from \a buffer \e to the stream.*/int QNPStream::write( int len, void* buffer ){    return NPN_Write(inst->pi->npp, stream, len, buffer);}/****************************************************************************** * The plugin itself - only one ever exists, created by QNPlugin::create() *****************************************************************************//*!    \class QNPlugin qnp.h    \brief The QNPlugin class provides the plugin central factory.    \extension Netscape Plugin    This class is the heart of the plugin. One instance of this object    is created when the plugin is \e first needed, by calling    QNPlugin::create(), which must be implemented in your plugin code    to return some derived class of QNPlugin. The one QNPlugin object    creates all QNPInstance instances for a single running Web-browser    process.    Additionally, if Qt is linked to the plugin as a dynamic library,    only one instance of QApplication will exist \e{across all plugins    that have been made with Qt}. So, your plugin should tread lightly    on global settings - do not, for example, use    QApplication::setFont() - that will change the font in every    widget of every Qt-based plugin currently loaded!*//*!    \fn QNPlugin* QNPlugin::create()    This must be implemented by your plugin code. It should return a    derived class of QNPlugin.*//*!    Returns the plugin most recently returned by QNPlugin::create().*/QNPlugin* QNPlugin::actual(){    return qNP;}/*!    Creates a QNPlugin. This may only be used by the constructor    derived class returned by the plugin's implementation of the    QNPlugin::create() function.*/QNPlugin::QNPlugin(){    // Encourage linker to include stuff.    static void* a;    a = (void*)NP_Initialize;    a = (void*)NP_Shutdown;}/*!    Destroys the QNPlugin. This is called by the plugin binding code    just before the plugin is about to be unloaded from memory. If    newWindow() has been called, a QApplication will still exist at    this time, but will be deleted shortly after before the plugin is    deleted.*/QNPlugin::~QNPlugin(){}/*!    Populates \e *\a plugin_major and \e *\a plugin_minor with the    version of the plugin API and populates \e *\a browser_major and    \e *\a browser_minor with the version of the browser.*/void QNPlugin::getVersionInfo(int& plugin_major, int& plugin_minor,	     int& browser_major, int& browser_minor){    NPN_Version(&plugin_major, &plugin_minor, &browser_major, &browser_minor);}/*!    \fn QNPInstance* QNPlugin::newInstance()    Override this to return an appropriate derived class of    QNPInstance.*//*!    \fn const char* QNPlugin::getMIMEDescription() const    Override this to return the MIME description of the data formats    supported by your plugin. The format of this string is shown by    the following example:\code    const char* getMIMEDescription() const    {	return "image/x-png:png:PNG Image;"	       "image/png:png:PNG Image;"	       "image/x-portable-bitmap:pbm:PBM Image;"	       "image/x-portable-graymap:pgm:PGM Image;"	       "image/x-portable-pixmap:ppm:PPM Image;"	       "image/bmp:bmp:BMP Image;"	       "image/x-ms-bmp:bmp:BMP Image;"	       "image/x-xpixmap:xpm:XPM Image;"	       "image/xpm:xpm:XPM Image";    }\endcode*//*!    \fn const char* QNPlugin::getPluginNameString() const    Returns the plain-text name of the plugin.*//*!    \fn const char* QNPlugin::getPluginDescriptionString() const    Returns the plain-text description of the plugin.*//*!    Override to return a reference to the Java class that represents    the plugin. The default returns 0, indicating no class.    If you override this class, you must also override    QNPlugin::unuseJavaClass().    The return value is actually a \c{jref}; we use \c{void*} so as to    avoid burdening plugins which do not require Java.    \sa getJavaEnv(), QNPInstance::getJavaPeer()*/void* QNPlugin::getJavaClass(){    return NULL;}/*!    This function is called when the plugin is shutting down, with \e    jc set to the value returned earlier by getJavaClass(). The    function should \e unuse the Java class.*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -