All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | Friends | List of all members
PLMD::Citations Class Reference

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...
 

Detailed Description

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;
}

Member Function Documentation

std::string PLMD::Citations::cite ( const std::string &  item)

Add a citation.

It returns a string containing the reference number, something like "[10]"

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const Citations  
)
friend

Dumps the bibliography.

It writes on the ostream the list of all the bibliographic items prefixed with their reference number

Member Data Documentation

std::vector<std::string> PLMD::Citations::items
private

The documentation for this class was generated from the following files: