QNPInstance(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’– QNPInstance(3qt) β€” the manual page, bestie πŸ’–

okay so you found the QNPInstance(3qt) page and honestly? iconic of you. this is the Qt Netscape Extension vibe, it's giving "plugin era," it's giving "before your time but still slays." let's get into it. πŸ¦‹


✨ NAME ✨

QNPInstance β€” a QObject that is a web browser plugin. periodt. πŸ‘‘


✨ SYNOPSIS ✨

This class is part of the Qt Netscape Extension.

#include <qnp.h>

Inherits QObject.

🌸 Public Members 🌸

  • ~QNPInstance ()
  • int argc () const
  • const char * argn ( int i ) const
  • const char * argv ( int i ) const
  • enum Reason { ReasonDone = 0, ReasonBreak = 1, ReasonError = 2, ReasonUnknown = -1 }
  • const char * arg ( const char * name ) const
  • enum InstanceMode { Embed = 1, Full = 2, Background = 3 }
  • InstanceMode mode () const
  • const char * userAgent () const
  • virtual QNPWidget * newWindow ()
  • QNPWidget * widget ()
  • enum StreamMode { Normal = 1, Seek = 2, AsFile = 3, AsFileOnly = 4 }
  • virtual bool newStreamCreated ( QNPStream *, StreamMode & smode )
  • virtual int writeReady ( QNPStream * )
  • virtual int write ( QNPStream *, int offset, int len, void * buffer )
  • virtual void streamDestroyed ( QNPStream * )
  • void status ( const char * msg )
  • void getURLNotify ( const char * url, const char * window = 0, void * data = 0 )
  • void getURL ( const char * url, const char * window = 0 )
  • void postURL ( const char * url, const char * window, uint len, const char * buf, bool file )
  • QNPStream * newStream ( const char * mimetype, const char * window, bool as_file = FALSE )
  • virtual void streamAsFile ( QNPStream *, const char * fname )
  • void * getJavaPeer () const
  • virtual void notifyURL ( const char * url, Reason r, void * notifyData )
  • virtual bool printFullPage ()
  • virtual void print ( QPainter * )

πŸŽ€ Protected Members πŸŽ€

  • QNPInstance ()

✨ DESCRIPTION ✨

lowkey important: this class is defined in the Qt Netscape Extension, which lives in the qt/extensions directory. it is not included in the main Qt API. so don't come for it, it's off doing its own thing. πŸ’…

the QNPInstance class provides a QObject that is a web browser plugin.

deriving from QNPInstance creates an object that represents a single <EMBED> tag in an HTML document. yes. one tag, one object. that's the whole vibe. 🫢

the QNPInstance is responsible for creating an appropriate QNPWidget window if required (and bestie, not all plugins have windows, okay, we don't judge), and for interacting with the input/output facilities intrinsic to plugins.

⚠️ REAL TALK WARNING: there is absolutely no guarantee regarding the order in which functions are called. sometimes the browser will call newWindow() first, at other times, newStreamCreated() will be called first (assuming the <EMBED> tag has a SRC parameter). so don't build your whole personality on an assumed call order. πŸ™ˆ
⚠️ ANOTHER ONE: none of Qt's GUI functionality may be used until after the first call to newWindow(). that includes any use of QPaintDevice (i.e. QPixmap, QWidget, and all subclasses), QApplication, anything related to QPainter (QBrush, etc.), fonts, QMovie, QToolTip, etc. the classes that specifically can be used are QImage, QFile, and QBuffer. πŸ’–

this restriction can easily be accommodated by structuring your plugin so that the task of the QNPInstance is to gather data, while the task of the QNPWidget is to provide a graphical interface to that data. slay, separation of concerns, we love to see it. ✨


🧚 Member Type Documentation 🧚

QNPInstance::InstanceMode

this enum type provides Qt-style names for three #defines in npapi.h:

  • QNPInstance::Embed β€” corresponds to NP_EMBED
  • QNPInstance::Full β€” corresponds to NP_FULL
  • QNPInstance::Background β€” corresponds to NP_BACKGROUND

QNPInstance::Reason

  • QNPInstance::ReasonDone
  • QNPInstance::ReasonBreak
  • QNPInstance::ReasonError
  • QNPInstance::ReasonUnknown

QNPInstance::StreamMode

  • QNPInstance::Normal
  • QNPInstance::Seek
  • QNPInstance::AsFile
  • QNPInstance::AsFileOnly

✨ MEMBER FUNCTION DOCUMENTATION ✨

QNPInstance::QNPInstance () [protected]

creates a QNPInstance. πŸŽ€

can only be called from within a derived class created within QNPlugin::newInstance(). that's the rule, no cap.

QNPInstance::~QNPInstance ()

called when the plugin instance is about to be deleted. it's the goodbye moment. 😭

const char * QNPInstance::arg ( const char * name ) const

returns the value of the named arguments, or 0 if no argument called name appears in the <EMBED> tag of this instance. and if the argument does appear but has no value assigned? you get the empty string back. empty string β‰  zero, bestie, they are different girls.

in summary:

<center>.nf
Tag
────

</center>

int QNPInstance::argc () const

returns the number of arguments to the instance.

heads up: you should not normally rely on the ordering of arguments, and note that the SGML specification does not permit multiple arguments with the same name. so like, don't try it. 🚫

see also arg() and argn().

const char * QNPInstance::argn ( int i ) const

returns the name of the i-th argument.

see also argc() and argv().

const char * QNPInstance::argv ( int i ) const

returns the value of the i-th argument.

\as argc(), arg()

void * QNPInstance::getJavaPeer () const

returns the Java object associated with the plugin instance, an object of the plugin's Java class β€” or 0 if the plug-in does not have a Java class, Java is disabled, or an error occurred. (three whole reasons for a zero, we respect the transparency. πŸ’€)

the return value is actually a jref; they use void* so as to avoid burdening plugins which do not require Java. thoughtful king behavior. πŸ‘‘

see also QNPlugin::getJavaClass() and QNPlugin::getJavaEnv().

void QNPInstance::getURL ( const char * url, const char * window = 0 )

requests that the url be retrieved and sent to the named window. see Netscape's JavaScript documentation for an explanation of window names. πŸ¦‹

void QNPInstance::getURLNotify ( const char * url, const char * window = 0, void * data = 0 )

requests that the given url be retrieved and sent to the named window. see Netscape's JavaScript documentation for an explanation of window names. passes the arguments including data to NPN_GetURLNotify.

Netscape: NPN_GetURLNotify method

InstanceMode QNPInstance::mode () const

returns the mode of the plugin. that's it, that's the function. πŸ’…

QNPStream * QNPInstance::newStream ( const char * mimetype, const char * window, bool as_file = FALSE )

🚧 under development: this function is under development and is subject to change. 🚧 not tested: this function is not tested. fr fr, proceed with the vibes of caution.

requests the creation of a new data stream from the plugin. the MIME type and window are passed in mimetype and window. as_file holds the AsFileOnly flag. it is an interface to the NPN_NewStream function of the Netscape Plugin API.

bool QNPInstance::newStreamCreated ( QNPStream *, StreamMode & smode ) [virtual]

this function is called when a new stream has been created. the instance should return TRUE if it accepts the processing of the stream. if the instance requires the stream as a file, it should set smode to AsFileOnly, in which case the data will be delivered some time later to the streamAsFile() function. otherwise, the data will be delivered in chunks to the write() function, which must consume at least as much data as returned by the most recent call to writeReady(). no slacking on the consumption, bestie. πŸ“

note: the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.

the default implementation accepts any stream. generous of it honestly. 🫢

QNPWidget * QNPInstance::newWindow () [virtual]

called at most once, at some time after the QNPInstance is created. if the plugin requires a window, this function should return a derived class of QNPWidget that provides the required interface.

Example: grapher/grapher.cpp.

void QNPInstance::notifyURL ( const char * url, Reason r, void * notifyData ) [virtual]

🚧 under development: this function is under development and is subject to change. 🚧 not tested: this function is not tested.

called whenever a url is notified after a call to NPN_GetURLNotify with notifyData. the reason is given in r. 🌈

it is an encapsulation of the NPP_URLNotify function of the Netscape Plugin API.

see also: Netscape: NPP_URLNotify method

void QNPInstance::postURL ( const char * url, const char * window, uint len, const char * buf, bool file )

🚧 under development: this function is under development and is subject to change. 🚧 not tested: this function is not tested.

it is an interface to the NPN_PostURL function of the Netscape Plugin API.

passes url, window, buf, len, and file to NPN_PostURL. all five, no skips. βœ…

void QNPInstance::print ( QPainter * ) [virtual]

🚧 under development: this function is under development and is subject to change. 🚧 not tested: this function is not tested.

print the instance embedded in a page.

it is an encapsulation of the NPP_Print function of the Netscape Plugin API.

bool QNPInstance::printFullPage () [virtual]

🚧 under development: this function is under development and is subject to change. 🚧 not tested: this function is not tested.

it is an encapsulation of the NPP_Print function of the Netscape Plugin API.

void QNPInstance::status ( const char * msg )

sets the status message in the browser containing this instance to msg. little message, big impact. ✨

void QNPInstance::streamAsFile ( QNPStream *, const char * fname ) [virtual]

called when a stream is delivered as a single file called fname rather than as chunks. this may be simpler for a plugin to deal with, but precludes any incremental behavior. simpler but less flexible, the eternal tradeoff, iykyk.

note: the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.

see also newStreamCreated() and newStream().

void QNPInstance::streamDestroyed ( QNPStream * ) [virtual]

called when a stream is destroyed. at this point, the stream may be complete() and okay().

  • if it is not okay(), then an error has occurred.
  • if it is okay() but not complete(), then the user has cancelled the transmission β€” do not give an error message in this case. the user just changed their mind, that's valid, don't be dramatic about it. πŸ’…

const char * QNPInstance::userAgent () const

returns the user agent (browser name) containing this instance. 🌐

QNPWidget * QNPInstance::widget ()

returns the plugin window created by newWindow(), if any.

int QNPInstance::write ( QNPStream *, int offset, int len, void * buffer ) [virtual]

called when incoming data is available for processing by the instance. the instance must consume at least the amount that it returned in the most recent call to writeReady(), but it may consume up to the amount given by len. buffer is the data available for consumption. the 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.

Example: grapher/grapher.cpp.

int QNPInstance::writeReady ( QNPStream * ) [virtual]

returns the minimum amount of data the instance is willing to receive from the given stream.

the default returns a very large value. generous default energy, we stan. πŸ‘‘


✨ SEE ALSO ✨


copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. see the license file included in the distribution for a complete license statement. πŸ“œ


✨ AUTHOR ✨

generated automatically from the source code. (not even a human, just vibes and a script. πŸ’€)


okay bestie that's part one!! more is coming, don't go anywhere πŸ’–βœ¨πŸŽ€

πŸ› BUGS πŸ›

Okay bestie, real talk β€” found a bug in Qt? πŸ‘€ Don't suffer in silence, report it exactly the way they describe over at http://doc.trolltech.com/bughowto.html. Fr fr, good bug reports are the whole entire point β€” they help them help you. Thank youuu 🫢✨

The definitive Qt documentation lives in HTML format, no cap. It's sitting pretty at $QTDIR/doc/html and you can read it with Qt Assistant or just, like, any web browser 🌈 This man page? It's a lil convenience for the girlies who prefer man pages β€” adorable, iconic β€” but heads up, this format is not officially supported by Trolltech. So it's giving ✨bonus content✨, not the main character πŸ“–πŸ’…

And if you spot errors in this manual page specifically? Spill πŸ“ β€” report them to qt-bugs@trolltech.com. But pls pls pls include:

  • the name of the manual page β€” qnpinstance.3qt
  • the Qt version β€” 3.3.8

Without those two lil deets they're out here guessing, and nobody wants that 😭


That's the whole page, bestie β€” QNPInstance(3qt), straight from Trolltech AS, dated 2 February 2007, version 3.3.8 energy all the way through. Go forth and embed your plugins, you absolute legend πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from