|
| LangMap (const std::string &path, const std::string &filename) |
| A LangMap object based on the passed map file (using the specified path). More...
|
|
| LangMap (const std::string &filename) |
| A LangMap object based on the passed map file (using the path stored in the settings or the default hardcoded one). More...
|
|
const_iterator | begin () |
|
const_iterator | end () |
|
void | print () |
| Prints the contents on the map to the standard output. More...
|
|
void | open () |
| Open the corresponding file (if it is not already opened) and read and parse its contents. More...
|
|
const std::string | getFileName (const std::string &lang) |
| Returns the lang file name corresponding to the passed language name. More...
|
|
const std::string | getMappedFileName (const std::string &lang) |
| Returns the lang file name corresponding to the passed language name. More...
|
|
const std::string | getMappedFileNameFromFileName (const std::string &fileName) |
| Tries to detect the corresponding lang file name, from the file name passed as parameter. More...
|
|
std::set< std::string > | getLangNames () const |
| Returns a set (i.e., an ordered list) of all the lang names of this map. More...
|
|
std::set< std::string > | getMappedFileNames () const |
| Returns a set (i.e., an ordered list) of all the mapped lang file names of this map. More...
|
|
void | reload (const std::string &path, const std::string &filename) |
| Reloads the contents of this map, using the (new) path and filename. More...
|
|
A map stored in a file with the format key = elem.
Comment line start with a #
This is used for lang.map, outlang.map and style.defaults (and for any other files that have this simple syntax).
Methods of this class can throw ParserException if they can't parse the map file because of a syntax error.
const std::string srchilite::LangMap::getMappedFileNameFromFileName |
( |
const std::string & |
fileName | ) |
|
Tries to detect the corresponding lang file name, from the file name passed as parameter.
In order to do so it proceeds as follows (until it succeeds):
- Use the file extension if any (for instance, if the passed file name is foo.cpp it looks for the lang def file associated to cpp)
- Use the lower case file extension if any
- Use the file name if it has no extension (for instance, if the passed file name is changelog, then looks for the lang file associated to changelog)
- Use the file name in lowercase (for instance, if the passed file name is ChangeLog, then looks for the lang file to changelog)
This is useful, e.g., for highlighting a file using its file name for detecting its source language. Similarly, for choosing the output format by using the name of the output file.
This method opens the lang map file if it hasn't been parsed yet.
- Parameters
-
fileName | the language name whose lang definition file name we want to retrieve |
- Returns
- the file name of the lang definition file corresponding to the specified file name (or the empty string if there's no such association)
- Exceptions
-