Class taking care of bibliography. More...
#include <Citations.h>
Public Member Functions | |
std::string | cite (const std::string &) |
Add a citation. 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; }
Definition at line 54 of file Citations.h.
std::string PLMD::Citations::cite | ( | const std::string & | item | ) |
Add a citation.
It returns a string containing the reference number, something like "[10]"
Definition at line 30 of file Citations.cpp.
|
friend |
Dumps the bibliography.
It writes on the ostream the list of all the bibliographic items prefixed with their reference number
Definition at line 41 of file Citations.cpp.
|
private |
Definition at line 55 of file Citations.h.
Hosted by GitHub
![]() |
![]() |