NCBI C++ ToolKit
Person_id.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: Person_id.cpp 64665 2014-10-02 00:45:40Z kans $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the ASN data definition file
34  * 'general.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <algorithm>
40 
41 // generated includes
44 
45 // generated classes
46 
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 // destructor
53 {
54 }
55 
56 
58 {
59  if (!label) {
60  return;
61  }
62 
63  char sep = (type == eGenbank) ? ',' : ' ';
64  switch (Which()) {
65  case e_Name:
66  if (!GetName().GetLast().empty()) {
67  *label += GetName().GetLast();
68  if (GetName().IsSetInitials()) {
69  string initials = GetName().GetInitials();
70  if (! initials.empty()) {
71  *label += sep;
72  *label += initials;
73  }
74  }
75  if (GetName().IsSetSuffix()) {
76  *label += string(" ");
77  *label += GetName().GetSuffix();
78  }
79  } else if (GetName().IsSetFull()) {
80  *label += GetName().GetFull();
81  }
82  return;
83  case e_Ml:
84  *label += GetMl();
85  break;
86  case e_Str:
87  *label += GetStr();
88  break;
89  case e_Consortium:
90  *label += GetConsortium();
91  break;
92  default:
93  *label += "Unsupported PersonID";
94  return;
95  }
96 
97  if (type == eEmbl) {
98  // Replace comma with a space
99  replace(label->begin(), label->end(), ',', ' ');
100  }
101 }
102 
103 
104 END_objects_SCOPE // namespace ncbi::objects::
105 
107 
108 /* Original file checksum: lines: 61, chars: 1888, CRC32: 542a93ef */
~CPerson_id(void)
Definition: Person_id.cpp:52
void GetLabel(string *label, ETypeLabel type=eGenbank) const
Definition: Person_id.cpp:57
string
Definition: cgiapp.hpp:687
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static const char label[]
E_Choice Which(void) const
Which variant is currently selected.
Definition: Person_id_.hpp:324
const TStr & GetStr(void) const
Get the variant data.
Definition: Person_id_.hpp:391
const TInitials & GetInitials(void) const
Get the Initials member data.
Definition: Name_std_.hpp:610
const TFull & GetFull(void) const
Get the Full member data.
Definition: Name_std_.hpp:563
const TMl & GetMl(void) const
Get the variant data.
Definition: Person_id_.hpp:371
const TConsortium & GetConsortium(void) const
Get the variant data.
Definition: Person_id_.hpp:411
const TSuffix & GetSuffix(void) const
Get the Suffix member data.
Definition: Name_std_.hpp:657
const TLast & GetLast(void) const
Get the Last member data.
Definition: Name_std_.hpp:422
const TName & GetName(void) const
Get the variant data.
Definition: Person_id_.cpp:137
@ e_Ml
MEDLINE name (semi-structured) eg. "Jones RM".
Definition: Person_id_.hpp:97
@ e_Consortium
consortium name
Definition: Person_id_.hpp:99
@ e_Name
structured name
Definition: Person_id_.hpp:96
@ e_Str
unstructured name
Definition: Person_id_.hpp:98
Definition: type.c:6
Modified on Fri Dec 01 04:48:38 2023 by modify_doxy.py rev. 669887