Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
basic::citation_manager::Citation Class Reference

Data structure for storing a citation. More...

#include <Citation.hh>

Inheritance diagram for basic::citation_manager::Citation:
Inheritance graph
[legend]

Public Member Functions

 Citation ()=default
 Constructor. More...
 
 Citation (std::string const &citation_as_string)
 Initialization constructor. More...
 
 Citation (Citation const &)=default
 Copy constructor. More...
 
 ~Citation () override=default
 
CitationOP clone () const
 
void clear ()
 Completely clear the data in this citation. More...
 
void initialize_from_string (std::string const &citation_as_string)
 Initializes from a string formatted as in the Rosetta database. See initialization constructor's description for an example. More...
 
void add_primary_author (std::string const &given_names, std::string const &surname, std::string const &initials)
 Add a primary author. More...
 
void add_co_author (std::string const &given_names, std::string const &surname, std::string const &initials)
 Add a co-author. More...
 
void add_senior_author (std::string const &given_names, std::string const &surname, std::string const &initials)
 Add a primary author. More...
 
void set_year_and_article (int const year_in, std::string const &article_title, std::string const &journal_title, std::string const &volume_issue_pages, std::string const &doi)
 Set the year, article title, journal title, and the string for the volume/issue/pages. More...
 
void get_formatted_citation (std::ostream &outstream, CitationFormat const format=CitationFormat::DefaultStyle) const
 Get this citation as a string, in a particular format. More...
 
utility::vector1< AuthorNames >
const & 
primary_authors () const
 Access the list of primary authors. More...
 
utility::vector1< AuthorNames >
const & 
co_authors () const
 Access the list of coauthors. More...
 
utility::vector1< AuthorNames >
const & 
senior_authors () const
 Access the list of senior authors. More...
 
int year () const
 Get the year. More...
 
std::string const & article_title () const
 Get the article title. More...
 
std::string const & journal_title () const
 Get the journal title. More...
 
std::string const & volume_issue_pages () const
 Get the volume, issue, and pages. More...
 
std::string const & doi () const
 Get the DOI. More...
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Private Member Functions

void get_default_formatted_citation (std::ostream &outstream) const
 Get the formatted citation, in default format. More...
 
void get_nature_formatted_citation (std::ostream &outstream) const
 Get the formatted citation, in Nature format. More...
 
void parse_authors (std::string const &section_name, utility::vector1< AuthorNames > &destination, utility::vector1< std::string > const &lines)
 Given a list of lines, parse out a list of author names from a block of the format: [BEGIN_SECTION_NAME] "Given names" "Surname" "Initials" "Given names" "Surname" "Initials" "Given names" "Surname" "Initials" [END_SECTION_NAME]. More...
 
void parse_year (utility::vector1< std::string > const &lines)
 Given a list of lines, parse out an integer from a block of the format: [BEGIN_YEAR] 1982 [END_YEAR]. More...
 
void parse_string_entry (std::string const &section_name, std::string &destination, utility::vector1< std::string > const &lines)
 Given a list of lines, parse out a string from a block of the format: [BEGIN_SECTION_NAME] The string to parse out [END_SECTION_NAME]. More...
 

Private Attributes

utility::vector1< AuthorNamesprimary_authors_
 
utility::vector1< AuthorNamesco_authors_
 
utility::vector1< AuthorNamessenior_authors_
 
int year_ = 0
 
std::string article_title_ = ""
 
std::string journal_title_ = ""
 
std::string volume_issue_pages_ = ""
 
std::string doi_ = ""
 

Detailed Description

Data structure for storing a citation.

Constructor & Destructor Documentation

basic::citation_manager::Citation::Citation ( )
default

Constructor.

basic::citation_manager::Citation::Citation ( std::string const &  citation_as_string)

Initialization constructor.

Initializes from input string. Below is an example of the format: [BEGIN_CITATION] [BEGIN_PRIMARY_AUTHORS] "Bobo" "Dang" "B" "Haifan" "Wu" "H" "Vikram Khipple" "Mulligan" "VK" [END_PRIMARY_AUTHORS] [BEGIN_COAUTHORS] "Marco" "Mravic" "M" "Yibing" "Wu" "Y" "Thomas" "Lemmin" "T" "Alexander" "Ford" "A" "Daniel-Adriano" "Silva" "D-A" "David" "Baker" "D" [END_COAUTHORS] [BEGIN_SENIOR_AUTHORS] "William" "DeGrado" "WF" [END_SENIOR_AUTHORS] [BEGIN_YEAR] 2017 [END_YEAR] [BEGIN_TITLE] De novo design of covalently constrained mesosize protein scaffolds with unique tertiary structures [END_TITLE] [BEGIN_JOURNAL] Proc Natl Acad Sci USA [END_JOURNAL] [BEGIN_VOLUME_ISSUE_PAGES] 114(41):10852–10857 [END_VOLUME_ISSUE_PAGES] [BEGIN_DOI] 10.1073/pnas.1710695114 [END_DOI] [END_CITATION]

References initialize_from_string().

basic::citation_manager::Citation::Citation ( Citation const &  )
default

Copy constructor.

basic::citation_manager::Citation::~Citation ( )
overridedefault

Member Function Documentation

void basic::citation_manager::Citation::add_co_author ( std::string const &  given_names,
std::string const &  surname,
std::string const &  initials 
)

Add a co-author.

Must be added in order of appearance.

Note
If I were adding "John Fitzgerald Kennedy Jr.", I would set given_names="John Fitzgerald", surname="Kennedy", initials="JF Jr.".

References co_authors_.

void basic::citation_manager::Citation::add_primary_author ( std::string const &  given_names,
std::string const &  surname,
std::string const &  initials 
)

Add a primary author.

Must be added in order of appearance.

Note
If I were adding "James Tiberius Kirk", I would set given_names="James Tiberius", surname="Kirk", initials="JT".

References primary_authors_.

void basic::citation_manager::Citation::add_senior_author ( std::string const &  given_names,
std::string const &  surname,
std::string const &  initials 
)

Add a primary author.

Must be added in order of appearance.

Note
If I were adding "Mary-Kate Olsen", I would set given_names="Mary-Kate", surname="Olsen", initials="M-K".

References senior_authors_.

std::string const& basic::citation_manager::Citation::article_title ( ) const
inline

Get the article title.

References article_title_.

Referenced by set_year_and_article().

void basic::citation_manager::Citation::clear ( )
CitationOP basic::citation_manager::Citation::clone ( ) const
utility::vector1< AuthorNames > const& basic::citation_manager::Citation::co_authors ( ) const
inline

Access the list of coauthors.

References co_authors_.

std::string const& basic::citation_manager::Citation::doi ( ) const
inline

Get the DOI.

References doi_.

Referenced by set_year_and_article().

void basic::citation_manager::Citation::get_default_formatted_citation ( std::ostream &  outstream) const
private

Get the formatted citation, in default format.

References article_title_, conf::author, co_authors_, doi_, journal_title_, primary_authors_, senior_authors_, volume_issue_pages_, and year_.

Referenced by get_formatted_citation().

void basic::citation_manager::Citation::get_formatted_citation ( std::ostream &  outstream,
CitationFormat const  format = CitationFormat::DefaultStyle 
) const
void basic::citation_manager::Citation::get_nature_formatted_citation ( std::ostream &  outstream) const
private

Get the formatted citation, in Nature format.

References article_title_, conf::author, co_authors_, doi_, journal_title_, primary_authors_, senior_authors_, volume_issue_pages_, and year_.

Referenced by get_formatted_citation().

void basic::citation_manager::Citation::initialize_from_string ( std::string const &  citation_as_string)

Initializes from a string formatted as in the Rosetta database. See initialization constructor's description for an example.

Calls clear() before initializing.

References article_title_, clear(), co_authors_, doi_, errmsg(), journal_title_, erraser_analysis::lines, parse_authors(), parse_string_entry(), parse_year(), primary_authors_, runtime_assert_string_msg, senior_authors_, utility::split_by_newlines(), utility::strip(), and volume_issue_pages_.

Referenced by Citation().

std::string const& basic::citation_manager::Citation::journal_title ( ) const
inline

Get the journal title.

References journal_title_.

Referenced by set_year_and_article().

void basic::citation_manager::Citation::parse_authors ( std::string const &  section_name,
utility::vector1< AuthorNames > &  destination,
utility::vector1< std::string > const &  lines 
)
private

Given a list of lines, parse out a list of author names from a block of the format: [BEGIN_SECTION_NAME] "Given names" "Surname" "Initials" "Given names" "Surname" "Initials" "Given names" "Surname" "Initials" [END_SECTION_NAME].

Stores the result in destination.

References line, utility::quoted_split(), runtime_assert_string_msg, and utility::strip().

Referenced by initialize_from_string().

void basic::citation_manager::Citation::parse_string_entry ( std::string const &  section_name,
std::string &  destination,
utility::vector1< std::string > const &  lines 
)
private

Given a list of lines, parse out a string from a block of the format: [BEGIN_SECTION_NAME] The string to parse out [END_SECTION_NAME].

Stores the result in destination.

References line, runtime_assert_string_msg, and utility::strip().

Referenced by initialize_from_string().

void basic::citation_manager::Citation::parse_year ( utility::vector1< std::string > const &  lines)
private

Given a list of lines, parse out an integer from a block of the format: [BEGIN_YEAR] 1982 [END_YEAR].

Stores the result in year_.

References line, runtime_assert_string_msg, utility::strip(), and year_.

Referenced by initialize_from_string().

utility::vector1< AuthorNames > const& basic::citation_manager::Citation::primary_authors ( ) const
inline

Access the list of primary authors.

References primary_authors_.

utility::vector1< AuthorNames > const& basic::citation_manager::Citation::senior_authors ( ) const
inline

Access the list of senior authors.

References senior_authors_.

void basic::citation_manager::Citation::set_year_and_article ( int const  year_in,
std::string const &  article_title,
std::string const &  journal_title,
std::string const &  volume_issue_pages,
std::string const &  doi 
)

Set the year, article title, journal title, and the string for the volume/issue/pages.

References article_title(), article_title_, doi(), doi_, journal_title(), journal_title_, runtime_assert_string_msg, volume_issue_pages(), volume_issue_pages_, and year_.

std::string const& basic::citation_manager::Citation::volume_issue_pages ( ) const
inline

Get the volume, issue, and pages.

References volume_issue_pages_.

Referenced by set_year_and_article().

int basic::citation_manager::Citation::year ( ) const
inline

Get the year.

References year_.

Member Data Documentation

std::string basic::citation_manager::Citation::article_title_ = ""
private
utility::vector1< AuthorNames > basic::citation_manager::Citation::co_authors_
private
std::string basic::citation_manager::Citation::doi_ = ""
private
std::string basic::citation_manager::Citation::journal_title_ = ""
private
utility::vector1< AuthorNames > basic::citation_manager::Citation::primary_authors_
private
utility::vector1< AuthorNames > basic::citation_manager::Citation::senior_authors_
private
std::string basic::citation_manager::Citation::volume_issue_pages_ = ""
private
int basic::citation_manager::Citation::year_ = 0
private

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