All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Citations.cpp
Go to the documentation of this file.
1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  Copyright (c) 2013 The plumed team
3  (see the PEOPLE file at the root of the distribution for a list of names)
4 
5  See http://www.plumed-code.org for more information.
6 
7  This file is part of plumed, version 2.0.
8 
9  plumed is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  plumed is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with plumed. If not, see <http://www.gnu.org/licenses/>.
21 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22 #include "Citations.h"
23 #include "Exception.h"
24 #include "Tools.h"
25 #include <iostream>
26 
27 using namespace std;
28 namespace PLMD{
29 
30 std::string Citations::cite(const std::string & item){
31  unsigned i;
32  for(i=0;i<items.size();++i) if(items[i]==item) break;
33  if(i==items.size()) items.push_back(item);
34  plumed_assert(i<items.size());
35  string ret;
36  Tools::convert(i+1,ret);
37  ret="["+ret+"]";
38  return ret;
39 }
40 
41 std::ostream & operator<<(std::ostream &log,const Citations&cit){
42  for(unsigned i=0;i<cit.items.size();++i)
43  log<<" ["<<i+1<<"] "<<cit.items[i]<<"\n";
44  return log;
45 }
46 }
47 
48 
std::vector< std::string > items
Definition: Citations.h:55
STL namespace.
Class taking care of bibliography.
Definition: Citations.h:54
std::ostream & operator<<(std::ostream &log, const Citations &cit)
Definition: Citations.cpp:41