An instance of this class represents the Databases
section of mascot.dat
.
More...
#include <ms_databaseoptions.hpp>
Public Member Functions | |
ms_databases () | |
Default constructor. | |
ms_databases (const ms_databases &src) | |
Copying constructor. | |
~ms_databases () | |
Destructor. | |
void | appendDatabase (const ms_databaseoptions *item) |
Add one more database definition at the end of the list. | |
void | clearDatabases () |
Deletes all database definitions. | |
void | copyFrom (const ms_databases *right) |
Can be used to create a copy of another object. | |
void | defaultValues () |
Initialises the instance with default values. | |
bool | deleteDatabaseByName (const char *name) |
Remove a database from the list in memory. | |
bool | deleteDatabaseByNumber (const int num) |
Remove a database from the list in memory. | |
int | findDatabase (const char *dbName, const bool searchInactive=false) const |
Finds a database with the specified name and returns its number to access. | |
const ms_databaseoptions * | getDatabase (const int index) const |
Returns a database definition by its number. | |
int | getNumberOfDatabases () const |
Returns the total number of database definitions including inactive (commented out) databases. | |
std::string | getPreceedingComments () const |
Returns any comments preceeding the section. | |
bool | isSectionAvailable () const |
Check if the section has been actually read form the file or have to be saved. | |
ms_databases & | operator= (const ms_databases &right) |
Assignment operator for C++ client applications. | |
void | setPreceedingComments (const std::string &comments) |
Sets any comments preceeding the section. | |
void | setSectionAvailable (const bool value) |
Changes availability of the section, i.e. whether it should be saved in the file. | |
bool | updateDatabaseByName (const char *name, const ms_databaseoptions db) |
Update the information for a specific database. | |
bool | updateDatabaseByNumber (const int num, const ms_databaseoptions db) |
Update the information for a specific database. |
An instance of this class represents the Databases
section of mascot.dat
.
An instance is created and populated with database entries within ms_datfile class. It contains active database definitions as well as inactive ones. When traversing the list of database with getNumberOfDatabases() and getDatabase() members, don't forget to check each entry for being active. Otherwise one or all database parameters might be invalid and, therefore, must be ignored. In a text-based configuration file a database definition can be made inactive by commenting it out.
For detailed information on any of the options please consult Mascot manual.
Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:
More functionality is described in details in the documentation for the class.
void appendDatabase | ( | const ms_databaseoptions * | item ) |
Add one more database definition at the end of the list.
item | valid pointer to a ms_databaseoptions object |
bool deleteDatabaseByName | ( | const char * | name ) |
Remove a database from the list in memory.
If the database name is specified incorrectly FALSE value is returned and no action is performed.
name | the database name. |
bool deleteDatabaseByNumber | ( | const int | num ) |
Remove a database from the list in memory.
If the database index is specified incorrectly FALSE value is returned and no action is performed.
num | zero-based database index. |
int findDatabase | ( | const char * | dbName, |
const bool | searchInactive = false |
||
) | const |
Finds a database with the specified name and returns its number to access.
Note that only active database will be returned (unless searchInactive is set to TRUE). If no database have been found the returning value will be -1.
dbName | a database name to find. |
searchInactive | set this parameter to TRUE if you want to search both active and inactive databases. |
const ms_databaseoptions * getDatabase | ( | const int | index ) | const |
Returns a database definition by its number.
Use this member to retrieve a database definition with index from 0 to (getNumberOfDatabases()-1).
index | number of database to look for |
int getNumberOfDatabases | ( | ) | const |
Returns the total number of database definitions including inactive (commented out) databases.
By default the list of database is empty unless explicitly populated.
std::string getPreceedingComments | ( | ) | const [inherited] |
Returns any comments preceeding the section.
Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.
Multiple line comments are supported by having a single string with newline characters
void setPreceedingComments | ( | const std::string & | comments ) | [inherited] |
Sets any comments preceeding the section.
Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.
Multiple line comments are supported by having a single string with newline characters
comments | any comments preceeding the section |
bool updateDatabaseByName | ( | const char * | name, |
const ms_databaseoptions | db | ||
) |
Update the information for a specific database.
If a database with the supplied name cannot be found no database will be updated and the returning value will be FALSE.
name | a database name to find. |
db | a database object to copy the content from. |
bool updateDatabaseByNumber | ( | const int | num, |
const ms_databaseoptions | db | ||
) |
Update the information for a specific database.
If the index is out of bounds no database will be updated and the returning value will be FALSE.
num | a zero-based index of the database to update. |
db | a database object to copy the content from. |
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:32 |