-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport.h
More file actions
37 lines (26 loc) · 1002 Bytes
/
Copy pathexport.h
File metadata and controls
37 lines (26 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef EXPORT_H
#define EXPORT_H
#include <string>
#include <sstream>
#include "paper.h"
using namespace std;
string exportBibTeX(vector<paper>* paperList) {
// used for export buttom, to export BibTeX format references for all papers
stringstream txt;
paper current;
for (int i = 0; i < (int)paperList->size(); i++) {
current = paperList->at(i);
txt << "@inproceedings{" << i << "," << endl;
txt << "authors={" << (string)current.authors << "}," << endl;
txt << "booktitle={" << current.conference << "}," << endl;
txt << "title={" << current.title << "}," << endl;
txt << "year={" << current.year << "}," << endl;
txt << "keywords={" << current.keywords << "}," << endl;
txt << "doi={" << current.DOI << "}," << endl;
txt << "}" << endl << endl;
}
string str = txt.str(); // remove all '\0'
str.erase(remove(str.begin(), str.end(), '\0'), str.end());
return str;
}
#endif // EXPORT_H