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

📄 qnp.cpp

📁 Linux 下的图形编程环境。
💻 CPP
📖 第 1 页 / 共 4 页
字号:
  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 given URL be retrieved and sent to the named  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 );}/*!  This function is not tested.  It is an interface to the NPN_PostURL  function of the Netscape Plugin API.*/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 URL be retrieved and sent to the named  window.  See Netscape's JavaScript documentation for an explanation  of window names.  See also:  <a href=http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#npngeturlnotify>  Netscape: NPN_GetURLNotify method</a>*/void QNPInstance::getURLNotify(const char* url, const char* window, void*data){#ifdef _WS_WIN_ // Only on Windows?    NPN_GetURLNotify( pi->npp, url, window, data );#endif}/*!  This function is not tested.  It is an encapsulation of the NPP_Print  function of the Netscape Plugin API.*/bool QNPInstance::printFullPage(){    return FALSE;}/*!  Print the instance embedded in a page.  This function is not tested.  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()*/int QNPInstance::argc() const{    return pi->argc;}/*!  Returns the name of the <em>i</em>th argument.  See notes of argc().*/const char* QNPInstance::argn(int i) const{    return pi->argn[i];}/*!  Called whenever an url is notified after call to NPN_GetURLNotify  This function is not tested.  It is an encapsulation of the NPP_URLNotify  function of the Netscape Plugin API.  See also:  <a href=http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#nppurlnotify>  Netscape: NPP_URLNotify method</a>*/void QNPInstance::notifyURL(const char*, Reason, void*){}/*!  Returns the value of the <em>i</em>th argument.  See notes of argc().*/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  with that name appears in the &lt;EMBED&gt; tag of this instance.  If the argument appears, but has no value assigned, the empty  string is returned.  In summary:  <ul>   <li> <b>&lt;EMBED ...&gt;</b> - arg("FOO") == 0   <li> <b>&lt;EMBED FOO ...&gt;</b> - arg("FOO") == ""   <li> <b>&lt;EMBED FOO=BAR ...&gt;</b> - arg("FOO") == "BAR"  </ul>*/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);}/*!  Requests the creation of a new data stream \e from the plug-in.  This function is not tested.  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.*/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 <tt>jref</tt> we use <tt>void*</tt> 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 A stream of data provided to a QNPInstance by the browser.  \extension NSPlugin  Note that this is neither a QTextStream or a QDataStream.  \sa QNPInstance::write(), QNPInstance::newStreamCreated()*//*!  Creates a stream.  Plugins should not call this, but rather  QNPInstance::newStream() if a stream is required.*/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 (???).*/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.*/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.*/bool QNPStream::okay() const{    return isokay;}/*!  Returns TRUE if the stream has received all the data from  the source.*/bool QNPStream::complete() const{    return iscomplete;}/*!  Requests the given section of the stream 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 data \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 plugin central factory.  \extension NSPlugin  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 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  <em>across all plugins that have been made with Qt.</em>  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 returns by QNPlugin::create().*/QNPlugin* QNPlugin::actual(){    return qNP;}/*!  Creates a QNPlugin.  This may only be used by the constructor  derived class  returned by 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(){}/*!  Returns the version information - the version of the plugin API, and  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 described  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 a 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 <tt>jref</tt> we use <tt>void*</tt> 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 \a jc set to the value returned earlier by getJavaClass().  The function should \e unuse the Java class and return 0.*/void QNPlugin::unuseJavaClass(){    qFatal("QNPlugin::unuseJavaClass() must overridden along with getJavaClass()");}/*!  Returns a pointer to the Java execution environment, or 0 if  Java is disabled or an error occurred.  The return value is actually a <tt>JRIEnv*</tt> we use <tt>void*</tt> so  as to avoid burdening plugins which do not require Java.  \sa getJavaClass(), QNPInstance::getJavaPeer()*/void* QNPlugin::getJavaEnv() const{    return NPN_GetJavaEnv();}

⌨️ 快捷键说明

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