67 switch (pid.
Which()) {
101 if (name.
size() <= 6 && (
SWNC(name,
"et al") ||
SWNC(name,
"et,al"))) {
133 string normal_initials;
134 for (
char ch : raw_initials) {
135 normal_initials += ch;
137 normal_initials +=
'.';
140 return normal_initials;
161 auto search = smap.
find(raw_suffix);
162 if (search != smap.
end()) {
163 return search->second;
175 vector<string> parts;
180 if (parts.size() == 1) {
188 const string& last_part = parts[parts.size() - 1];
190 if (parts.size() == 2) {
207 const string& second_to_last_part = parts[parts.size() - 2];
210 last =
NStr::Join(vector<string>(parts.begin(), parts.end() - 2),
" ");
222 last =
NStr::Join(vector<string>(parts.begin(), parts.end() - 1),
" ");
246 if (!initials.empty()) {
247 person_id->
SetName().SetInitials(initials);
263 new_author->
SetName(*std_name);
272 new_author->
Assign(author);
279 new_author->
SetName(*std_name);
static bool x_GetLabelV2(string *label, TLabelFlags flags, CTempString name, CTempString initials=kEmptyStr, CTempString suffix=kEmptyStr)
bool GetLabelV1(string *label, TLabelFlags flags) const override
static CRef< CAuthor > ConvertMlToStandard(const CAuthor &author, bool normalize_suffix=false)
static CRef< CPerson_id > x_ConvertMlToStandard(const string &name, bool normalize_suffix=false)
bool GetLabelV2(string *label, TLabelFlags flags) const override
@Name_std.hpp User-defined methods of the data storage class.
void GetLabel(string *label, ETypeLabel type=eGenbank) const
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
int TLabelFlags
binary OR of ELabelFlags
@ fLabel_FlatEMBL
For EMBL or EMBLPept [V2].
static bool HasText(const string &s)
static bool SWNC(const string &str, const string &pfx)
const_iterator end() const
const_iterator find(const key_type &key) const
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
static bool IsUpper(const CTempString str)
Checks if all letters in the given string have a upper case.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
size_type size(void) const
Return the length of the represented array.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
static const char label[]
void SetName(TName &value)
Assign a value to Name data member.
void ResetName(void)
Reset Name data member.
const TName & GetName(void) const
Get the Name member data.
bool IsSetName(void) const
Author, Primary or Secondary Check if a value has been assigned to Name data member.
E_Choice Which(void) const
Which variant is currently selected.
const TStr & GetStr(void) const
Get the variant data.
bool IsMl(void) const
Check if variant Ml is selected.
bool CanGetInitials(void) const
Check if it is safe to call GetInitials method.
const TInitials & GetInitials(void) const
Get the Initials member data.
const TFull & GetFull(void) const
Get the Full member data.
bool IsSetFull(void) const
full name eg.
const TMl & GetMl(void) const
Get the variant data.
const TConsortium & GetConsortium(void) const
Get the variant data.
const TSuffix & GetSuffix(void) const
Get the Suffix member data.
TName & SetName(void)
Select the variant.
bool CanGetSuffix(void) const
Check if it is safe to call GetSuffix method.
const TLast & GetLast(void) const
Get the Last member data.
const TName & GetName(void) const
Get the variant data.
@ e_Ml
MEDLINE name (semi-structured) eg. "Jones RM".
@ e_Consortium
consortium name
void s_SplitMLAuthorName(string name, string &last, string &initials, string &suffix, bool normalize_suffix)
static string s_NormalizeSuffix(const string &raw_suffix)
static string s_NormalizeInitials(const string &raw_initials)
static const char * suffix[]