# QsciAPIs Class Reference

The QsciAPIs class provies an implementation of the textual API information used in call tips and for auto-completion. More...

`#include <qsciapis.h>`

Inherits QsciAbstractAPIs.

List of all members.

## Signals

- void apiPreparationCancelled ()
- void apiPreparationStarted ()
- void apiPreparationFinished ()

## Public Member Functions

- QsciAPIs (QsciLexer *lexer)
- virtual ~QsciAPIs ()
- void add (const QString &entry)
- void clear ()
- bool load (const QString &fname)
- void remove (const QString &entry)
- void prepare ()
- void cancelPreparation ()
- QString defaultPreparedName () const
- bool isPrepared (const QString &fname=QString()) const
- bool loadPrepared (const QString &fname=QString())
- bool savePrepared (const QString &fname=QString()) const
- virtual void updateAutoCompletionList (const QStringList &context, QStringList &list)
- virtual void autoCompletionSelected (const QString &sel)
- virtual QStringList callTips (const QStringList &context, int commas, QsciScintilla::CallTipsStyle style, QList< int > &shifts)
- virtual bool event (QEvent *e)
- QStringList installedAPIFiles () const

## Detailed Description

The QsciAPIs class provies an implementation of the textual API information used in call tips and for auto-completion.

Raw API information is read from one or more files. Each API function is described by a single line of text comprising the function's name, followed by the function's optional comma separated parameters enclosed in parenthesis, and finally followed by optional explanatory text.

A function name may be followed by a `?' and a number. The number is used by auto-completion to display a registered QPixmap with the function name.

All function names are used by auto-completion, but only those that include function parameters are used in call tips.

QScintilla only deals with prepared API information and not the raw information described above. This is done so that large APIs can be handled while still being responsive to user input. The conversion of raw information to prepared information is time consuming (think tens of seconds) and implemented in a separate thread. Prepared information can be quickly saved to and loaded from files. Such files are portable between different architectures.

QScintilla based applications that want to support large APIs would normally provide the user with the ability to specify a set of, possibly project specific, raw API files and convert them to prepared files that are loaded quickly when the application is invoked.

## Constructor & Destructor Documentation

QsciAPIs::QsciAPIs | ( | QsciLexer * | lexer | ) |

Constructs a QsciAPIs instance attached to lexer lexer. lexer becomes the instance's parent object although the instance can also be subsequently attached to other lexers.

virtual QsciAPIs::~QsciAPIs | ( |  | ) | `[virtual]`

Destroy the QsciAPIs instance.

## Member Function Documentation

void QsciAPIs::add | ( | const QString & | entry | ) |

Add the single raw API entry entry to the current set.

See also:
  clear(), load(), remove()

void QsciAPIs::clear | ( |  | ) |

Deletes all raw API information.

See also:
  add(), load(), remove()

bool QsciAPIs::load | ( | const QString & | fname | ) |

Load the API information from the file named fname, adding it to the current set. Returns true if successful, otherwise false.

void QsciAPIs::remove | ( | const QString & | entry | ) |

Remove the single raw API entry entry from the current set.

See also:
  add(), clear(), load()

void QsciAPIs::prepare | ( |  | ) |

Convert the current raw API information to prepared API information. This is implemented by a separate thread.

See also:
  cancelPreparation()

void QsciAPIs::cancelPreparation | ( |  | ) |

Cancel the conversion of the current raw API information to prepared API information.

See also:
  prepare()

QString QsciAPIs::defaultPreparedName | ( |  | ) | const

Return the default name of the prepared API information file. It is based on the name of the associated lexer and in the directory defined by the QSCIDIR environment variable. If the environment variable isn't set then $HOME/.qsci is used.

bool QsciAPIs::isPrepared | ( | const QString & | fname = `QString()` | ) | const

Check to see is a prepared API information file named fname exists. If fname is empty then the value returned by defaultPreparedName() is used. Returns true if successful, otherwise false.

See also:
  defaultPreparedName()

bool QsciAPIs::loadPrepared | ( | const QString & | fname = `QString()` | ) |

Load the prepared API information from the file named fname. If fname is empty then a name is constructed based on the name of the associated lexer and saved in the directory defined by the QSCIDIR environment variable. If the environment variable isn't set then $HOME/.qsci is used. Returns true if successful, otherwise false.

bool QsciAPIs::savePrepared | ( | const QString & | fname = `QString()` | ) | const

Save the prepared API information to the file named fname. If fname is empty then a name is constructed based on the name of the associated lexer and saved in the directory defined by the QSCIDIR environment variable. If the environment variable isn't set then $HOME/.qsci is used. Returns true if successful, otherwise false.

virtual void QsciAPIs::updateAutoCompletionList | ( | const QStringList & | context,
|  | QStringList & | list |
| ) |  |  | `[virtual]`

Implements QsciAbstractAPIs.

virtual void QsciAPIs::autoCompletionSelected | ( | const QString & | sel | ) | `[virtual]`

Reimplemented from QsciAbstractAPIs.

virtual QStringList QsciAPIs::callTips | ( | const QStringList & | context,
|  | int | commas,
|  | QsciScintilla::CallTipsStyle | style,
|  | QList< int > & | shifts |
| ) |  |  | `[virtual]`

Implements QsciAbstractAPIs.

QStringList QsciAPIs::installedAPIFiles | ( |  | ) | const

Return a list of the installed raw API file names for the associated lexer.

void QsciAPIs::apiPreparationCancelled | ( |  | ) | `[signal]`

This signal is emitted when the conversion of raw API information to prepared API information has been cancelled.

See also:
  apiPreparationFinished(), apiPreparationStarted()

void QsciAPIs::apiPreparationStarted | ( |  | ) | `[signal]`

This signal is emitted when the conversion of raw API information to prepared API information starts and can be used to give some visual feedback to the user.

See also:
  apiPreparationCancelled(), apiPreparationFinished()

void QsciAPIs::apiPreparationFinished | ( |  | ) | `[signal]`

This signal is emitted when the conversion of raw API information to prepared API information has finished.

See also:
  apiPreparationCancelled(), apiPreparationStarted()