35 std::cerr <<
"pbliblio_parser : error at " << parser.
getLocation() << std::endl;
36 std::cerr <<
"\tunexpected token '" << token <<
"'" << std::endl;
44 }
else if(token ==
"\""){
62 if(attrName ==
"authors"){
return "author";}
85 mapStrEntry[
"label"] = entryLabel;
88 PString attrName(
""), attrValue(
"");
104 biblioEntry.
setLabel(mapStrEntry[
"label"]);
105 biblioEntry.
setTitle(mapStrEntry[
"title"]);
106 biblioEntry.
setAuthor(mapStrEntry[
"author"]);
107 biblioEntry.
setJournal(mapStrEntry[
"journal"]);
108 biblioEntry.
setYear(mapStrEntry[
"year"]);
109 biblioEntry.
setUrl(mapStrEntry[
"url"]);
124 biblioEntry.
setId(mapBiblioEntry.size());
126 mapBiblioEntry[biblioEntry.
getLabel()] = biblioEntry;
141 if(!parser.
open(fileName)){
142 std::cerr <<
"pbliblio_file : can't open file '" << fileName <<
"'" << std::endl;
Entry in the bibliography.
void setLabel(const PString &label)
Sets the label of the PBiblioEntry.
const PString & getLabel() const
Gets the label of the PBiblioEntry.
void setId(size_t id)
Sets the id of the PBiblioEntry.
void setTitle(const PString &title)
Sets the title of the PBiblioEntry.
void setJournal(const PString &journal)
Sets the journal of the PBiblioEntry.
void setYear(const PString &year)
Sets the year of the PBiblioEntry.
void setType(const PBiblioEntryType::PBiblioEntryType &type)
Sets the type of the PBiblioEntry.
void setAuthor(const PString &author)
Sets the author of the PBiblioEntry.
void setUrl(const PString &url)
Sets the url of the PBiblioEntry.
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
void setSeparator(const PString &separator)
Initialise la liste des caractères séparateurs.
bool open(const PPath &fileName)
Fonction qui ouvre le fichier que l'on va parser.
PString getNextToken()
Get the next token.
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
void setEscapeChar(char escapeChar)
Sets the escape character of the PFileParser.
PString getUntilKeyWithoutPaternRecurse(const PString &patern, const PString &beginPatern, const PString &allowedCharAfterBegin)
Get the string until end sequence and take account recursive patern (embeded strings)
bool isMatch(const PString &patern)
Says if the patern match with the current caracters of the PFileParser.
PLocation getLocation() const
Fonction qui renvoie la PLocation du PFileParser.
void skipWhiteSpace()
Skip the white space if there is at the current caracter position.
bool isEndOfFile() const
Dit si on est à la fin du fichier.
Path of a directory or a file.
PString replace(const PString &pattern, const PString &replaceStr) const
Replace a PString into an other PString.
PString eraseChar(char ch) const
Erase char ch of current string.
PString toLower() const
Convert PString in lower case.
PString eraseFirstLastChar(const PString &vecChar) const
Erase first and last char in a string.
PString pbiblio_checkAttrName(const PString &attrName)
Check the attribute name.
bool pbliblio_parser(PFileParser &parser, PMapBiblioEntry &mapBiblioEntry)
Parse the full bibliography file.
PString pbiblio_checkAttrValue(const PString &attrValue)
Check the attribute value.
bool pbiblio_parseAttribute(PFileParser &parser, PString &attrName, PString &attrValue)
Parse an attribute of the current bibliography entry.
bool pbliblio_parserEntry(PFileParser &parser, PMapStrEntry &mapStrEntry, PBiblioEntryType::PBiblioEntryType &type)
Parse the full bibliography file.
void pbliblio_convertMapStrToBibEntry(PBiblioEntry &biblioEntry, PMapStrEntry &mapStrEntry)
Convert the map of string into a PBiblioEntry.
PBiblioEntryType::PBiblioEntryType pbiblio_strToEntryType(const PString &str)
Convert a string into an entry type.
bool pbliblio_file(PMapBiblioEntry &mapBiblioEntry, const PPath &fileName)
Parse the full bibliography file.
std::map< PString, PString > PMapStrEntry
Describes one bibliograpy entry in string.
std::map< PString, PBiblioEntry > PMapBiblioEntry
Describes the map for all PBiblioEntry.