| stil.h | | stil.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| * along with this program; if not, write to the Free Software | | * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
1, USA. | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
1, USA. | |
| */ | | */ | |
| | | | |
| #ifndef STIL_H | | #ifndef STIL_H | |
| #define STIL_H | | #define STIL_H | |
| | | | |
| #include <string> | | #include <string> | |
| #include <algorithm> | | #include <algorithm> | |
| #include <map> | | #include <map> | |
|
| | | #include <iosfwd> | |
| | | | |
| #include "stildefs.h" | | #include "stildefs.h" | |
| | | | |
| /** | | /** | |
| * STIL class | | * STIL class | |
| * | | * | |
| * @author LaLa <LaLa@C64.org> | | * @author LaLa <LaLa@C64.org> | |
| * @copyright 1998, 2002 by LaLa | | * @copyright 1998, 2002 by LaLa | |
| * | | * | |
| * | | * | |
| | | | |
| skipping to change at line 310 | | skipping to change at line 311 | |
| | | | |
| /// Error number of the last error that happened. | | /// Error number of the last error that happened. | |
| STILerror lastError; | | STILerror lastError; | |
| | | | |
| /// Error strings containing the description of the possible errors in
STIL. | | /// Error strings containing the description of the possible errors in
STIL. | |
| static const char *STIL_ERROR_STR[]; | | static const char *STIL_ERROR_STR[]; | |
| | | | |
| //////////////// | | //////////////// | |
| | | | |
| /// The last retrieved entry | | /// The last retrieved entry | |
|
| char entrybuf[STIL_MAX_ENTRY_SIZE]; | | std::string entrybuf; | |
| | | | |
| /// The last retrieved section-global comment | | /// The last retrieved section-global comment | |
|
| char globalbuf[STIL_MAX_ENTRY_SIZE]; | | std::string globalbuf; | |
| | | | |
| /// The last retrieved BUGentry | | /// The last retrieved BUGentry | |
|
| char bugbuf[STIL_MAX_ENTRY_SIZE]; | | std::string bugbuf; | |
| | | | |
| /// Buffers to hold the resulting strings | | /// Buffers to hold the resulting strings | |
|
| char resultEntry[STIL_MAX_ENTRY_SIZE]; | | std::string resultEntry; | |
| char resultBug[STIL_MAX_ENTRY_SIZE]; | | std::string resultBug; | |
| | | | |
| //////////////// | | //////////////// | |
| | | | |
| void setVersionString(); | | void setVersionString(); | |
| | | | |
| /** | | /** | |
| * Determines what the EOL char is (or are) from STIL.txt. | | * Determines what the EOL char is (or are) from STIL.txt. | |
| * It is assumed that BUGlist.txt will use the same EOL. | | * It is assumed that BUGlist.txt will use the same EOL. | |
| * | | * | |
| * @return | | * @return | |
| | | | |
| skipping to change at line 373 | | skipping to change at line 374 | |
| bool positionToEntry(const char *entryStr, std::ifstream &inFile, dirLi
st &dirs); | | bool positionToEntry(const char *entryStr, std::ifstream &inFile, dirLi
st &dirs); | |
| | | | |
| /** | | /** | |
| * Reads the entry from 'inFile' into 'buffer'. 'inFile' should | | * Reads the entry from 'inFile' into 'buffer'. 'inFile' should | |
| * already be positioned to the entry to be read. | | * already be positioned to the entry to be read. | |
| * | | * | |
| * @param inFile - filehandle of file to read from | | * @param inFile - filehandle of file to read from | |
| * @param entryStr - the entry needed to be read | | * @param entryStr - the entry needed to be read | |
| * @param buffer - where to put the result to | | * @param buffer - where to put the result to | |
| */ | | */ | |
|
| void readEntry(std::ifstream &inFile, char *buffer); | | void readEntry(std::ifstream &inFile, std::string &buffer); | |
| | | | |
| /** | | /** | |
| * Given a STIL formatted entry in 'buffer', a tune number, | | * Given a STIL formatted entry in 'buffer', a tune number, | |
| * and a field designation, it returns the requested | | * and a field designation, it returns the requested | |
| * STIL field into 'result'. | | * STIL field into 'result'. | |
| * If field=all, it also puts the file-global comment (if it exists) | | * If field=all, it also puts the file-global comment (if it exists) | |
| * as the first field into 'result'. | | * as the first field into 'result'. | |
| * | | * | |
| * @param result - where to put the resulting string to (if any) | | * @param result - where to put the resulting string to (if any) | |
| * @param buffer - pointer to the first char of what to search for | | * @param buffer - pointer to the first char of what to search for | |
| * the field. Should be a buffer in standard STIL | | * the field. Should be a buffer in standard STIL | |
| * format. | | * format. | |
| * @param tuneNo - song number within the song (default=0) | | * @param tuneNo - song number within the song (default=0) | |
| * @param field - which field to retrieve (default=all). | | * @param field - which field to retrieve (default=all). | |
| * @return | | * @return | |
| * - false - if nothing was put into 'result' | | * - false - if nothing was put into 'result' | |
| * - true - 'result' has the resulting field | | * - true - 'result' has the resulting field | |
| */ | | */ | |
|
| bool getField(char *result, char *buffer, int tuneNo = 0, STILField fie
ld = all); | | bool getField(std::string &result, const char *buffer, int tuneNo = 0,
STILField field = all); | |
| | | | |
| /** | | /** | |
| * @param result - where to put the resulting string to (if any) | | * @param result - where to put the resulting string to (if any) | |
| * @param start - pointer to the first char of what to search for | | * @param start - pointer to the first char of what to search for | |
| * the field. Should be a buffer in standard STIL | | * the field. Should be a buffer in standard STIL | |
| * format. | | * format. | |
| * @param end - pointer to the last+1 char of what to search for | | * @param end - pointer to the last+1 char of what to search for | |
| * the field. ('end-1' should be a '\n'!) | | * the field. ('end-1' should be a '\n'!) | |
| * @param field - which specific field to retrieve | | * @param field - which specific field to retrieve | |
| * @return | | * @return | |
| * - false - if nothing was put into 'result' | | * - false - if nothing was put into 'result' | |
| * - true - 'result' has the resulting field | | * - true - 'result' has the resulting field | |
| */ | | */ | |
|
| bool getOneField(char *result, char *start, char *end, STILField field)
; | | bool getOneField(std::string &result, const char *start, const char *en
d, STILField field); | |
| | | | |
| /** | | /** | |
| * Extracts one line from 'infile' to 'line[]'. The end of | | * Extracts one line from 'infile' to 'line[]'. The end of | |
| * the line is marked by endOfLineChar. Also eats up | | * the line is marked by endOfLineChar. Also eats up | |
| * additional EOL-like chars. | | * additional EOL-like chars. | |
| * | | * | |
| * @param infile - filehandle (streampos should already be positioned | | * @param infile - filehandle (streampos should already be positioned | |
| * to the start of the desired line) | | * to the start of the desired line) | |
| * @param line - char array to put the line into | | * @param line - char array to put the line into | |
| */ | | */ | |
|
| void getStilLine(std::ifstream &infile, char *line); | | void getStilLine(std::ifstream &infile, std::string &line); | |
| | | | |
| private: | | private: | |
| /** | | /** | |
| * Converts slashes to the one the OS uses to access files. | | * Converts slashes to the one the OS uses to access files. | |
| * | | * | |
| * @param | | * @param | |
| * str - what to convert | | * str - what to convert | |
| */ | | */ | |
| static void convertSlashes(std::string &str) { std::replace(str.begin()
, str.end(), '/', SLASH); } | | static void convertSlashes(std::string &str) { std::replace(str.begin()
, str.end(), '/', SLASH); } | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 9 lines changed or deleted | | 10 lines changed or added | |
|