Represents the whole WWW
section.
More...
#include <ms_wwwoptions.hpp>
Public Member Functions | |
ms_wwwoptions () | |
Default constructor. | |
ms_wwwoptions (const ms_wwwoptions &src) | |
Copying constructor. | |
~ms_wwwoptions () | |
Destructor. | |
void | appendEntry (const ms_wwwentry *item) |
Append a new entry which is a copy of the only parameter. | |
void | appendProperty (const char *name, const char *value, const char *delimiter, const bool bFirstPlace=false) |
Adds a new property with the given parameters. | |
void | appendText (const char *line, const bool bFirstPlace=false) |
Adds a new non-parsed property. | |
void | clearEntries () |
Deletes all entries from the list. | |
void | copyFrom (const ms_customproperty *src) |
Copies all properties and comments from another instance. | |
void | copyFrom (const ms_wwwoptions *right) |
Can be used to create a copy of another object. | |
void | defaultValues () |
Initialises the instance with default values. | |
void | delNonEmpty () |
Deletes all non-comment properties. | |
void | delProp (const char *name) |
Deletes all properties with the specified name. | |
void | delPropByNumber (const int index) |
Deletes a single property with the specified number only. | |
void | delPropStart (const char *nameBeginning) |
Deletes all properties whose names start with the given string. | |
void | dropEntry (const int index) |
Make the entry at the given index unavailable. | |
int | findProperty (const char *name, const int startFrom=0) const |
Searches the list for a property with the given name. | |
int | findPropertyBeginning (const char *nameBeginning, const int startFrom=0) const |
Searches the list for a property with the partially matching name. | |
std::string | getDefaultDelimiter () const |
Return current default delimiter string used for parsing/storing properties. | |
std::string | getDelimiterByNumber (const int index) const |
Returns a specific delimiter used for the property. | |
const ms_wwwentry * | getEntry (const int index) const |
Returns an entry by its index. | |
int | getNumberOfEntries () const |
Returns the total number of entries in the section. | |
int | getNumberOfProperties () const |
Returns a total number of property/comment entries. | |
std::string | getPreceedingComments () const |
Returns any comments preceeding the section. | |
std::string | getPropertyName (const int index) const |
Returns a property name for a given index. | |
std::string | getPropValStringByName (const char *name) const |
Retrieves property value by name. | |
std::string | getPropValStringByNumber (const int index) const |
Retrieves property raw text values by number. | |
const ms_wwwentry * | getRepEntryByName (const char *dbName) const |
Searches the entries list for the given name and type of REP . | |
const ms_wwwentry * | getSeqEntryByName (const char *dbName) const |
Searches the entries list for the given name and type of SEQ . | |
bool | isSectionAvailable () const |
Check whether the section has been actually read from the file. | |
ms_wwwoptions & | operator= (const ms_wwwoptions &right) |
Assignment operator for C++ client applications. | |
void | setDefaultDelimiter (const char *delim) |
Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied. | |
void | setEntry (const int index, const ms_wwwentry *item) |
Update the entry at the given index. | |
void | setPreceedingComments (const std::string &comments) |
Sets any comments preceeding the section. | |
void | setPropertyName (const int index, const char *name) |
Changes name of the property with the given index. | |
void | setPropValBoolByName (const char *name, const bool value, const bool bFirstPlace=false) |
Changes a boolean value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValCharByName (const char *name, const char value, const bool bFirstPlace=false) |
Changes a single character value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValFloatByName (const char *name, const double value, const bool bFirstPlace=false) |
Changes an floating point value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValInt64ByName (const char *name, const INT64 value, const bool bFirstPlace=false) |
Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValIntByName (const char *name, const int value, const bool bFirstPlace=false) |
Changes an integer value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValStringByName (const char *name, const char *value, const bool bFirstPlace=false) |
Changes a string value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValStringByNumber (const int index, const char *value) |
Changes an string value of an existing property with the given index. | |
void | setSectionAvailable (const bool value) |
Changes availability of the section, i.e. whether it should be saved in a file. | |
bool | uncommentProp (const int index, const char *delimeter=0) |
Uncomments a line in the configuration file. | |
Represents the whole WWW
section.
The WWW
section defines where CGI scripts look for the information needed to compile a results report. At least one entry is required for each database, to define the source from which the sequence string of a database entry can be obtained. A second line can optionally define the source from which the full text report of an entry can be obtained. The syntax is very similar in both cases, independent of whether the information originates locally or on a remote system.
An instance of this class holds a list of entries (see ms_wwwentry) that can be obtained and dealt with individually. By default the list is empty.
For detailed information on any of the options please consult the Mascot manual.
Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:
More functionality is described in the documentation for ms_customproperty.
|
inherited |
Adds a new property with the given parameters.
name | a property name to use. |
value | a property value to use. |
delimiter | a specific delimiter or an empty string for a default one to be used. |
bFirstPlace | forces a new property to be put on top of the list. |
|
inherited |
Adds a new non-parsed property.
All property elements will be retrieved from the first parameter. Before calling this method, a specific default delimiter can be set using setDefaultDelimiter().
l | raw text representation of the property to be parsed. |
bFirstPlace | forces a new property to be put on top of the list. |
|
inherited |
Deletes all properties with the specified name.
str | Property name to find a match and then delete. |
|
inherited |
Deletes all properties whose names start with the given string.
str | Beginning a first part of the property name to delete. |
void dropEntry | ( | const int | index | ) |
Make the entry at the given index unavailable.
This is achieved by deleting the corresponding line from the mascot.dat file. This does not affect the indices of other entries in this instance of the object. In other words, dropping an entry will reset the value at that index to a default, and the gap is plugged the next time the file is loaded.
index | The index of the entry to delete, between 0 and getNumberOfEntries()-1. |
|
inherited |
Searches the list for a property with the given name.
If no property found with the given name -1 will be returned. There may be several property entries in the list with the same name.
name | a property name to be found. |
startFrom | a minimal property index to start search from. |
|
inherited |
Searches the list for a property with the partially matching name.
If no property found with the given name part -1 will be returned. There may be several property entries in the list whose names start with the given string.
nameBeginning | first part of a property name to be found. |
startFrom | a minimal property index to start search from. |
|
inherited |
Return current default delimiter string used for parsing/storing properties.
|
inherited |
Returns a specific delimiter used for the property.
index | Index for which to get a delimiter |
const ms_wwwentry * getEntry | ( | const int | index | ) | const |
Returns an entry by its index.
See getNumberOfEntries() for more information.
index | The entry to return, between 0 and getNumberOfEntries()-1. |
int getNumberOfEntries | ( | ) | const |
Returns the total number of entries in the section.
Note that there might be several entries associated with each database. Therefore, total number of entries differs with the number of databases in Databases
section.
The entries are not ordered and are represented as is. Use specific functions such as getSeqEntryByName() and getRepEntryByName() to retrieve the entry by name, or getEntry() by the entry index.
|
inherited |
Returns a total number of property/comment entries.
|
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
|
inherited |
Returns a property name for a given index.
index | property number from 0 to (getNumberOfProperties()-1). |
|
inherited |
Retrieves property value by name.
Don't use this method for comments as they all have empty name. Also note that there might be several entries corresponding to the same name . – only the first value will be returned. If in doubt use findProperty() and getPropValStringByNumber() instead.
name | Name for which to get a property value |
|
inherited |
Retrieves property raw text values by number.
index | Index for which to get a property value |
const ms_wwwentry * getRepEntryByName | ( | const char * | dbName | ) | const |
Searches the entries list for the given name and type of REP
.
If an entry is not found, a null value is returned. Note that database names are case sensitive.
dbName | name to get entry from |
const ms_wwwentry * getSeqEntryByName | ( | const char * | dbName | ) | const |
Searches the entries list for the given name and type of SEQ
.
If an entry is not found, a null value is returned. Note that database names are case sensitive.
dbName | name to get entry from |
bool isSectionAvailable | ( | ) | const |
Check whether the section has been actually read from the file.
By default the WWW
section is unavailable until it has been set to a different state.
|
inherited |
Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.
delim | String to set the default delimiter |
void setEntry | ( | const int | index, |
const ms_wwwentry * | item | ||
) |
Update the entry at the given index.
index | The index of the entry to update, between 0 and getNumberOfEntries()-1. |
item | The data to update with. Member fields of item will copied to the underlying object. |
|
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 |
|
inherited |
Changes name of the property with the given index.
index | property number from 0 to (getNumberOfProperties()-1). |
name | new name to be given to the property. |
|
inherited |
Changes a boolean value of the first entry with the given name or creates a new property if it is not found.
A new value will be converted into 1 (for TRUE) or 0 (for FALSE) character.
name | a name of the property to find or add. |
value | a new boolean value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a single character value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new single character value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an floating point value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new floating point value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new long 64-bit integer value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an integer value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new integer value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a string value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new string value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an string value of an existing property with the given index.
index | an index of an existing property. |
str | String value for the property. |
|
inherited |
Uncomments a line in the configuration file.
Removes a # and any white space. Finds the delimeter and extracts the property name and value.
index | must be a value between 0 and getNumberOfProperties(). |
delimeter | will often be a space. If not supplied, the default delimeter will be used. |