Class taking care of bibliography.
More...
#include <Citations.h>
Public Member Functions | |
std::string | cite (const std::string &) |
Add a citation. More... | |
void | clear () |
Delete all references. More... | |
bool | empty () const |
Check if bibliography is empty. More... | |
Private Attributes | |
std::vector< std::string > | items |
Friends | |
std::ostream & | operator<< (std::ostream &, const Citations &) |
Dumps the bibliography. More... | |
Class taking care of bibliography.
This class contains a vector of citations. To add a new citations, use cite(). To print the entire bibliography, just dump on a ostream. Everytime cite is used, a string containing the number of the citation is returned. If the same citation is added twice, the same string is returned, so that this example will produce only two bibliographic items:
#include "Citations.h" #include <iostream> int main(int argc,char**argv){ PLMD::Citations citations; std::cout << citations.cite("Pinco e Pallino, Il Piccolo 33, 444 (2012)") << "\n"; std::cout << citations.cite("Other cite") << "\n"; std::cout << citations.cite("Pinco e Pallino, Il Piccolo 33, 444 (2012)") << "\n"; std::cout << "Bibliography\n"<< citations; return 0; }
std::string PLMD::Citations::cite | ( | const std::string & | item | ) |
Add a citation.
It returns a string containing the reference number, something like "[10]"
void PLMD::Citations::clear | ( | ) |
Delete all references.
bool PLMD::Citations::empty | ( | ) | const |
Check if bibliography is empty.
|
friend |
Dumps the bibliography.
It writes on the ostream the list of all the bibliographic items prefixed with their reference number
|
private |
Hosted by GitHub | 1.8.14 |