Update include files documentation (#360)

* Update include files documentation

* Fix inconcistencies with spaces/tabs, some changes

* Update fun, nvault, vector

* Update sqlx.inc
This commit is contained in:
KliPPy
2017-12-09 00:22:43 +01:00
committed by Vincent Herbet
parent 5632420827
commit 7b3646a012
7 changed files with 1508 additions and 381 deletions

View File

@@ -21,43 +21,131 @@
#pragma loadlib nvault
#endif
/* All timestamps are in UNIX epoch form. */
/**
* @global All timestamps are in UNIX epoch form.
*/
/* Opens a vault by name (such as "myvault")
* Returns a vault id, INVALID_HANDLE otherwise (-1)
/**
* Opens a vault by name. Creates a vault if it doesn't exist yet.
*
* @param name Name of the vault. The vault will be created in
* ${amxx_datadir}/vault directory.
*
* @return The vault handle to be used in other natives.
* INVALID_HANDLE (-1) if not successfully opened.
*/
native nvault_open(const name[]);
/* Gets a vault value by returning an int
* setting a byref float or setting a string + maxlength
/**
* Retrieves a value from the given key
*
* @note An example of retrieving a string:
* nvault_get(vaultHandle, "myKey", myString, charsmax(myString));
*
* @param vault A vault handle returned from nvault_open()
* @param key A key to get the value from
* @param ... If three argument are given, gets a float value and
* puts it in the third argument by reference.
* If four arguments are given, gets a string from the
* vault and copies it to the third argument, up to
* 4th argument characters.
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_get(vault, const key[], any:...);
/* Looks up a vault value for full information
* Returns 0 if the entry is not found
/**
* Retrieves full information about a vault entry
*
* @param vault A vault handle returned from nvault_open()
* @param key A key to get information from
* @param value A string where the value should be stored
* @param maxlen Maximum length of the @value string
* @param timestamp The timestamp of the entry
*
* @return 1 if an entry was found, 0 otherwise.
* @error On invalid vault handle.
*/
native nvault_lookup(vault, const key[], value[], maxlen, &timestamp);
/* Sets a vault value (with current timestamp) */
/**
* Sets value of a vault entry and updates the timestamp.
*
* @note A new entry is created if one with the given key doesn't exist.
*
* @param vault A vault handle returned from nvault_open()
* @param key A key to set the value for
* @param value A value to set
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_set(vault, const key[], const value[]);
/* Sets a permanent vault value (no timestamp) */
/**
* Sets value of a vault entry and makes it permanent (non-erasable with nvault_prune()).
*
* @note A new entry is created if one with the given key doesn't exist.
* @note Permanent entries have no timestamp.
*
* @param vault A vault handle returned from nvault_open()
* @param key A key to set the permanent value for
* @param value A permanent value to set
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_pset(vault, const key[], const value[]);
/* Prunes the vault for entries that are within the given timestamps.
* This will not erase values set with pset
/**
* Prunes the vault for entries that are within the given timestamps.
*
* @note This will not erase values set with nvault_pset().
* @note An example of pruning all entries that are older than 24 hours:
* nvault_prune(vaultHandle, 0, get_systime() - (60 * 60 * 24));
*
* @param vault A vault handle returned from nvault_open()
* @param start The timestamp to start erasing from
* @param end The timestamp to erase to
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_prune(vault, start, end);
/* Closes a vault */
/**
* Closes a vault.
*
* @param vault A vault handle returned from nvault_open()
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_close(vault);
/* Removes a key from the vault */
/**
* Removes an entry from the vault by its key.
*
* @param vault A vault handle returned from nvault_open()
* @param key The key to remove from the vault
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_remove(vault, const key[]);
/* "Touches" a key to update its timestamp value.
* If stamp is -1 (default), it will use the current time.
* Like the unix command "touch," it will create an empty key
* if the value does not exist.
/**
* "Touches" an entry in the vault, updating its timestamp.
*
* @note If timestamp is equal to -1, it will use the current time.
* @note An empty entry is created if one with the given key doesn't exist.
*
* @param vault A vault handle returned from nvault_open()
* @param key The key to search for
* @param timestamp Update an entry's timestamp to this one. Default is -1.
*
* @noreturn
* @error On invalid vault handle.
*/
native nvault_touch(vault, const key[], timestamp=-1);