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

Go to the SVN repository for this file.

1 /* $Id: cleanup_author.cpp 95852 2022-01-05 16:52:11Z stakhovv $
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: Colleen Bollin
27  *
28  * File Description:
29  * Code for cleaning up CAuthor
30  *
31  */
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbistd.hpp>
34 #include <serial/serialbase.hpp>
35 
36 #include <objects/biblio/Affil.hpp>
41 
44 #include "cleanup_utils.hpp"
45 
46 
49 
50 
51 bool CCleanup::CleanupAuthor(CAuthor& author, bool fix_initials)
52 {
53  bool any_change = false;
54  size_t n;
55  if (author.IsSetName()) {
56  switch (author.GetName().Which()) {
57  case CPerson_id::e_Name:
58  any_change = s_CleanupNameStdBC(author.SetName().SetName(), fix_initials);
59  break;
60  case CPerson_id::e_Ml:
61  n = author.GetName().GetMl().size();
62  NStr::TruncateSpacesInPlace(author.SetName().SetMl());
63  if (n != author.GetName().GetMl().size() ) {
64  any_change = true;
65  }
66  if (NStr::IsBlank(author.GetName().GetMl())) {
67  author.ResetName();
68  }
69  break;
70  case CPerson_id::e_Str:
71  n = author.GetName().GetStr().size();
72  NStr::TruncateSpacesInPlace(author.SetName().SetStr());
73  if (n != author.GetName().GetStr().size() ) {
74  any_change = true;
75  }
76  if (NStr::IsBlank(author.GetName().GetStr())) {
77  author.ResetName();
78  }
79  break;
81  n = author.GetName().GetConsortium().size();
82  NStr::TruncateSpacesInPlace(author.SetName().SetConsortium());
83  if (n != author.GetName().GetConsortium().size() ) {
84  any_change = true;
85  }
86  if (NStr::IsBlank(author.GetName().GetConsortium())) {
87  author.ResetName();
88  }
89  break;
90  default:
91  break;
92  }
93  }
94  return any_change;
95 }
96 
97 
98 bool CCleanup::s_CleanupNameStdBC ( CName_std& name, bool fix_initials )
99 {
100  // there's a lot of shuffling around (e.g. adding and removing
101  // periods in initials), so we can't determine
102  // if we've actually changed anything until we get to the end of
103  // this function.
104  CRef<CName_std> original_name( new CName_std );
105  original_name->Assign( name );
106 
107  // if initials starts with uppercase, we remember to
108  // upcase the whole thing later
109  bool upcaseinits = false;
110  if( name.IsSetInitials() && isupper( name.GetInitials()[0] ) ) {
111  upcaseinits = true;
112  }
113 
114  string first_initials;
115  string sDot(".");
116  if ( ! name.IsSetSuffix() && name.IsSetInitials() ) {
118  }
119 
120  if (name.IsSetFirst()) {
122  if (NStr::IsBlank(name.GetFirst())) {
123  name.ResetFirst();
124  }
125  }
126 
127  if( name.IsSetInitials() ) {
130  }
131  if( name.IsSetLast() ) {
133  }
134  if( name.IsSetMiddle() ) {
136  }
137  s_FixEtAl( name );
138 
139  // extract initials from first name
140  // like in C: FirstNameToInitials (first, first_initials, sizeof (first_initials) - 1);
141 
142  if ( name.IsSetFirst() ) {
143  const string &first = name.GetFirst();
144  string::size_type next_pos = 0;
145  while ( next_pos < first.length() ) {
146  // skip initial spaces and hyphens
147  next_pos = first.find_first_not_of(" -", next_pos);
148  if( string::npos == next_pos ) break;
149  // if we hit an letter after that, copy the letter to inits
150  if( isalpha( first[next_pos] ) ) {
151  first_initials += first[next_pos];
152  }
153  // find next space or hyphen
154  next_pos = first.find_first_of(" -", next_pos);
155  if( string::npos == next_pos ) break;
156  // if it's a hyphen, copy it
157  if( first[next_pos] == '-' ) {
158  first_initials += '-';
159  }
160  }
161  }
162 
163  // continue extracting initials from middle name, but only if existing Initials field is empty
164  if ((!name.IsSetInitials() || NStr::IsBlank(name.GetInitials()))
165  && name.IsSetMiddle()) {
166  const string &middle = name.GetMiddle();
167  string::size_type next_pos = 0;
168  while ( next_pos < middle.length() ) {
169  // skip initial spaces and hyphens
170  next_pos = middle.find_first_not_of(" -", next_pos);
171  if( string::npos == next_pos ) break;
172  // if we hit an letter after that, copy the to inits
173  if( isalpha( middle[next_pos] ) ) {
174  first_initials += middle[next_pos];
175  }
176  // find next space or hyphen
177  next_pos = middle.find_first_of(" -", next_pos);
178  if( string::npos == next_pos ) break;
179  // if it's a hyphen, copy it
180  if( middle[next_pos] == '-' ) {
181  first_initials += '-';
182  }
183  }
184  }
185 
186  if (!name.IsSetInitials() || NStr::IsBlank(name.GetInitials())) {
187  if (!first_initials.empty()) {
188  name.SetInitials(first_initials);
189  first_initials.clear();
190  }
191  } else if (fix_initials) {
192  string & initials = name.SetInitials();
193 
194  // skip part of initials that matches first_initials
195  string::size_type initials_first_good_idx = 0;
196  for( ; initials_first_good_idx < initials.length() &&
197  initials_first_good_idx < first_initials.length() &&
198  toupper(initials[initials_first_good_idx]) == toupper(first_initials[initials_first_good_idx]) ;
199  ++initials_first_good_idx )
200  {
201  // do nothing
202  }
203 
204  if( initials_first_good_idx > 0 ) {
205  initials.erase( 0, initials_first_good_idx );
206  }
207  }
208 
209  // like in C: nsp = TabbedStringToNameStdPtr (str, fixInitials);
210 
211  if( fix_initials && ! first_initials.empty() ) {
212  name.SetInitials(
213  first_initials + (name.IsSetInitials() ? name.GetInitials() : kEmptyStr));
214  }
215  if( name.IsSetInitials() ) {
216  string & initials = name.SetInitials();
217  NStr::ReplaceInPlace( initials, " ", "" );
218  NStr::ReplaceInPlace( initials, ",", "." );
219  NStr::ReplaceInPlace( initials, ".ST.", ".St." );
220 
221  string new_initials;
222  string::const_iterator initials_iter = initials.begin();
223  // modify initials. New version will be built in new_initials
224  for( ; initials_iter != initials.end(); ++initials_iter ) {
225  const char ch = *initials_iter;
226  switch( ch ) {
227  case '-':
228  // keep hyphens
229  new_initials += '-';
230  break;
231  case '.':
232  case ' ':
233  // erase periods and spaces
234  break;
235  default:
236  // other characters: keep them, BUT...
237  new_initials += ch;
238 
239  if( (initials_iter + 1) != initials.end()) {
240  const char next_char = *(initials_iter + 1);
241  if (! islower(next_char) ) {
242  // if next character is not lower, add period
243  new_initials += '.';
244  }
245  }
246  }
247  }
248 
249  if( initials != new_initials ) {
250  initials.swap(new_initials); // swap is faster than assignment
251  new_initials.clear();
252  }
253 
254  // add period if string is not empty and doesn't end with a period
255  if( ! initials.empty() && ! NStr::EndsWith(initials, ".") ) {
256  initials += '.';
257  }
258  }
259 
260  // side effect of C Toolkit converting to tabbed string and back
261  // is that some fields are removed
262  if ( name.IsSetFull()) {
263  name.ResetFull();
264  }
265  if (name.IsSetTitle()) {
266  name.ResetTitle();
267  }
268 
269  if(name.IsSetLast()) {
270  // add dot to "et al"
271  if ( NStr::Equal(name.GetLast(), "et al") ) {
272  name.SetLast("et al.");
273  }
274 
275  CleanVisString(name.SetLast());
276  if (NStr::IsBlank(name.GetLast())) {
277  name.ResetLast();
278  }
279  }
280 
281  if(name.IsSetFirst()) {
282  CleanVisString(name.SetFirst());
283  NStr::ReplaceInPlace(name.SetFirst(), sDot, "");
284  if (NStr::IsBlank(name.GetFirst())) {
285  name.ResetFirst();
286  }
287  }
288 
289  if(name.IsSetMiddle()) {
290  CleanVisString(name.SetMiddle());
291  if (NStr::IsBlank(name.GetMiddle())) {
292  name.ResetMiddle();
293  }
294  }
295 
296  if(name.IsSetInitials()) {
297  if (upcaseinits && islower(name.GetInitials()[0]) ) {
298  name.SetInitials()[0] = toupper(name.GetInitials()[0]);
299  }
300  CleanVisString(name.SetInitials());
301  if (NStr::IsBlank(name.GetInitials())) {
302  name.ResetInitials();
303  }
304  }
305 
306  if (name.IsSetSuffix()) {
307  NStr::ReplaceInPlace( name.SetSuffix(), sDot, kEmptyStr );
309 
310  name.FixSuffix(name.SetSuffix());
311 
312  CleanVisString(name.SetSuffix());
313  if (NStr::IsBlank(name.GetSuffix())) {
314  name.ResetSuffix();
315  }
316  }
317 
318  s_FixEtAl( name );
319 
320  if( ! name.IsSetLast() ) {
321  name.SetLast(kEmptyCStr);
322  }
323 
325 
326  if( name.IsSetInitials() && (!name.IsSetSuffix() || NStr::IsBlank(name.GetSuffix()))) {
327  string & initials = name.SetInitials();
328  if( NStr::EndsWith(initials, ".Jr.") || NStr::EndsWith(initials, ".Sr.") ) {
329  name.SetSuffix(initials.substr( initials.length() - 3 ) );
330  initials.resize( initials.length() - 3 );
331  NStr::TruncateSpacesInPlace( initials );
332  if (NStr::IsBlank(initials)) {
333  name.ResetInitials();
334  }
335  }
336  }
337 
338  if (fix_initials &&
339  name.IsSetInitials() && !NStr::IsBlank(name.GetInitials()) &&
340  (!name.IsSetFirst() || NStr::IsBlank(name.GetFirst()))) {
341  string temp = name.GetInitials();
342  size_t pos = NStr::Find(temp, "-");
343  if (pos == 2 && temp.length() >= 5 && temp[1] == '.' && temp [4] == '.') {
344  name.SetFirst(temp.substr(0, 1) + '-' + temp.substr(3, 1));
345  }
346  }
347 
348  return(!original_name->Equals(name));
349 }
350 
351 // mapping of wrong suffixes to the correct ones.
353 static const TStringPair bad_sfxs[] = {
354  { "1d" , "I" },
355  { "1st" , "I" },
356  { "2d" , "II" },
357  { "2nd" , "II" },
358  { "3d" , "III" },
359  { "3rd" , "III" },
360  { "4th" , "IV" },
361  { "5th" , "V" },
362  { "6th" , "VI" },
363  //{ "I." , "I" }, // presumably commented out since it resembles initials
364  { "II." , "II" },
365  { "III.", "III" },
366  { "IV." , "IV" },
367  { "Jr" , "Jr." },
368  { "Sr" , "Sr." },
369  //{ "V." , "V" }, // presumably commented out since it resembles initials
370  { "VI." , "VI" }
371 };
374 
376 {
377  _ASSERT( name.IsSetInitials() && ! name.IsSetSuffix() );
378 
379  string& initials = name.SetInitials();
380 
381  if (initials.find('.') == NPOS) {
382  return;
383  }
384 
385 // this macro is arguably more convenient than a function
386 #define EXTRACTSUFFIXFROMINITIALS( OLD, NEW ) \
387  if( NStr::EndsWith(initials, OLD) ) { \
388  initials.resize( initials.length() - strlen(OLD) ); \
389  name.SetSuffix(NEW); \
390  return; \
391  }
392 
393  EXTRACTSUFFIXFROMINITIALS( "III", "III" )
394  EXTRACTSUFFIXFROMINITIALS( "III.", "III" )
395  EXTRACTSUFFIXFROMINITIALS( "Jr", "Jr" )
396  EXTRACTSUFFIXFROMINITIALS( "2nd", "II" )
397  EXTRACTSUFFIXFROMINITIALS( "IV", "IV" )
398  EXTRACTSUFFIXFROMINITIALS( "IV.", "IV" )
399 
400 #undef EXTRACTSUFFIXFROMINITIALS
401 }
402 
404 {
405  if (!name.IsSetLast() || !name.IsSetInitials()) {
406  return;
407  }
408  if (name.IsSetFirst() && !NStr::Equal(name.GetFirst(), "a") &&
409  !NStr::IsBlank(name.GetFirst()) ) {
410  return;
411  }
412  const string& init = name.GetInitials();
413  if( NStr::Equal(name.GetLast(), "et") &&
414  ( NStr::Equal(init, "al") ||
415  NStr::Equal(init, "al.") ||
416  NStr::Equal(init, "Al.") )) {
417  name.ResetInitials();
418  name.ResetFirst();
419  name.SetLast("et al." );
420  }
421 }
422 
423 
425 {
426  if (affil.IsStr()) {
427  return NStr::IsBlank(affil.GetStr());
428  }
429  else if (affil.IsStd()) {
430  const CAuth_list::TAffil::TStd& std = affil.GetStd();
431  return !(std.IsSetAffil() || std.IsSetDiv() || std.IsSetCity() ||
432  std.IsSetSub() || std.IsSetCountry() || std.IsSetStreet() ||
433  std.IsSetEmail() || std.IsSetFax() || std.IsSetPhone() ||
434  std.IsSetPostal_code());
435  }
436  return true;
437 }
438 
439 
440 // Helpers for cleaning authors
442 {
444  {
445  if (!cauth) {
446  return true;
447  }
448  const CAuthor& auth = *cauth;
449  if (!auth.IsSetName()) {
450  return true;
451  }
452 
453  const CAuthor::TName& name = auth.GetName();
454 
455  const string* str = nullptr;
456  switch (name.Which()) {
458  return true;
459 
461  {
462  const CName_std& nstd = name.GetName();
463  // last name is required
464  if (!nstd.IsSetLast() || NStr::IsBlank(nstd.GetLast())) {
465  return true;
466  }
467  break;
468  }
469 
471  str = &(name.GetMl());
472  break;
474  str = &(name.GetStr());
475  break;
477  str = &(name.GetConsortium());
478  break;
479 
480  default:
481  break;
482  };
483  if (str && NStr::IsBlank(*str)) {
484  return true;
485  }
486  return false;
487  }
488 };
489 
490 
491 bool CCleanup::CleanupAuthList(CAuth_list& al, bool fix_initials)
492 {
493  bool rval = false;
494 
495  if (al.IsSetAffil()) {
496  if (CleanupAffil(al.SetAffil())) {
497  rval = true;
498  }
499  if (IsEmpty(al.GetAffil())) {
500  al.ResetAffil();
501  rval = true;
502  }
503  }
504  if (al.IsSetNames()) {
505  typedef CAuth_list::TNames TNames;
506  switch (al.GetNames().Which()) {
507  case TNames::e_Ml:
508  al.ConvertMlToStandard(false);
509  rval = true;
511  // ( since we just converted the ml to an std, we need to do the
512  // std clean-up step )
513  case TNames::e_Std:
514  {
515  auto& alnames = al.SetNames();
516  auto& std = alnames.SetStd();
517  auto cleaner = [&rval, fix_initials](CRef<CAuthor>& author) {
518  if (CCleanup::CleanupAuthor(*author, fix_initials)) {
519  rval = true;
520  }
521  };
522  std::for_each(std.begin(), std.end(), cleaner);
523  size_t before = std.size();
524  SAuthorEmpty em;
525  std.erase(std::remove_if(std.begin(), std.end(), em), std.end());
526  if (std.size() != before) {
527  rval = true;
528  }
529 
530  if (std.empty()) {
531  ResetAuthorNames(alnames);
532  rval = true;
533  }
534  break;
535  }
536  case TNames::e_Str:
537  {
538  TNames& names = al.SetNames();
539  for (string& it : names.SetStr()) {
540  if (Asn2gnbkCompressSpaces(it)) {
541  rval = true;
542  }
543  }
544  if (CleanVisStringContainer(names.SetStr())) {
545  rval = true;
546  }
547  if (names.GetStr().empty()) {
549  rval = true;
550  }
551  break;
552  }
553  default:
554  break;
555  }
556  }
557  // if no remaining authors, put in default author for legal ASN.1
558  if (!al.IsSetNames()) {
559  al.SetNames().SetStr().push_back("?");
560  rval = true;
561  }
562  return rval;
563 }
564 
565 
566 // when we reset author names, we need to put in a place holder - otherwise the ASN.1 becomes invalid
568 {
569  names.Reset();
570  list< string > &auth_list = names.SetStr();
571  auth_list.clear();
572  auth_list.push_back("?");
573 }
574 
575 
576 static bool CleanAndCompressJunk(string& str)
577 {
578  bool rval = false;
579  rval |= Asn2gnbkCompressSpaces(str);
580  rval |= CleanVisStringJunk(str);
581  return rval;
582 }
583 
584 
586 {
587  bool rval = false;
588  switch (af.Which()) {
589  case CAffil::e_Str:
590  rval |= Asn2gnbkCompressSpaces(af.SetStr());
591  rval |= CleanVisString(af.SetStr());
592  break;
593  case CAffil::e_Std:
594  {
595  CAffil::TStd& std = af.SetStd();
596 #define CLEAN_AFFIL_MEMBER(x) \
597  if (std.IsSet##x()) { \
598  string& val = std.Set##x(); \
599  rval |= CleanAndCompressJunk(val); \
600  if (val.empty()) { \
601  std.Reset##x(); \
602  rval = true; \
603  } \
604  }
605 
606  CLEAN_AFFIL_MEMBER(Affil);
607  CLEAN_AFFIL_MEMBER(Div);
608  CLEAN_AFFIL_MEMBER(City);
609  CLEAN_AFFIL_MEMBER(Sub);
610  CLEAN_AFFIL_MEMBER(Country);
611  CLEAN_AFFIL_MEMBER(Street);
612  CLEAN_AFFIL_MEMBER(Email);
613  CLEAN_AFFIL_MEMBER(Fax);
614  CLEAN_AFFIL_MEMBER(Phone);
615  CLEAN_AFFIL_MEMBER(Postal_code);
616 #undef CLEAN_AFFIL_MEMBER
617 
618  if (std.IsSetCountry()) {
619  const string& country = std.GetCountry();
620  if (NStr::EqualNocase(country, "U.S.A.")) {
621  std.SetCountry("USA");
622  rval = true;
623  } else if (NStr::EqualNocase(country, "USA") && !NStr::EqualCase(country, "USA")) {
624  std.SetCountry("USA");
625  rval = true;
626  }
627  }
628 
629  if (std.IsSetSub() && std.IsSetCountry()) {
630  if (NStr::EqualCase(std.GetCountry(), "USA")) {
631  string oldsub = std.GetSub();
632  string newsub = NStr::Replace(oldsub, ".", "");
633  if (!NStr::EqualNocase(oldsub, newsub)) {
634  std.SetSub(newsub);
635  rval = true;
636  }
637  }
638  }
639  break;
640  }
641  default:
642  break;
643  }
644  return rval;
645 }
646 
647 
648 
#define bool
Definition: bool.h:34
void remove_if(Container &c, Predicate *__pred)
Definition: chainer.hpp:69
std representation
Definition: Affil_.hpp:91
@Affil.hpp User-defined methods of the data storage class.
Definition: Affil.hpp:56
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
void ConvertMlToStandard(bool normalize_suffix=false)
Definition: Auth_list.cpp:187
CAuthor –.
Definition: Author.hpp:59
static bool CleanupAffil(CAffil &af)
static void s_FixEtAl(CName_std &name)
static bool CleanupAuthList(CAuth_list &al, bool fix_initials=true)
static bool CleanupAuthor(CAuthor &author, bool fix_initials=true)
static bool IsEmpty(const CAuth_list::TAffil &affil)
static void ResetAuthorNames(CAuth_list::TNames &names)
static bool s_CleanupNameStdBC(CName_std &name, bool fix_initials)
static void s_ExtractSuffixFromInitials(CName_std &name)
@Name_std.hpp User-defined methods of the data storage class.
Definition: Name_std.hpp:56
bool ExtractSuffixFromLastName()
Definition: Name_std.cpp:64
static void FixSuffix(string &suffix)
Definition: Name_std.cpp:99
CRef –.
Definition: ncbiobj.hpp:618
class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...
Definition: static_map.hpp:175
#define CLEAN_AFFIL_MEMBER(x)
static const TStringPair bad_sfxs[]
CStaticArrayMap< string, string > TSuffixMap
#define EXTRACTSUFFIXFROMINITIALS(OLD, NEW)
SStaticPair< const char *, const char * > TStringPair
DEFINE_STATIC_ARRAY_MAP_WITH_COPY(TSuffixMap, sc_BadSuffixes, bad_sfxs)
static bool CleanAndCompressJunk(string &str)
bool CleanVisString(string &str)
bool CleanVisStringJunk(string &str, bool allow_ellipses)
bool Asn2gnbkCompressSpaces(string &val)
weird space compression from C Toolkit
bool CleanVisStringContainer(C &str_cont)
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const struct name_t names[]
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:40
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
pair< string, string > TStringPair
CDocsumTableModel.
#define NCBI_FALLTHROUGH
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define kEmptyStr
Definition: ncbistr.hpp:123
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
#define NPOS
Definition: ncbistr.hpp:133
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3197
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2887
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
Definition: ncbistr.hpp:5325
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
Definition: ncbistr.cpp:3310
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
Definition: ncbistr.hpp:5384
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.
Definition: ncbistr.cpp:3401
const char *const kEmptyCStr
Empty "C" string (points to a '\0').
Definition: ncbistr.cpp:68
@ eTrunc_Begin
Truncate leading spaces only.
Definition: ncbistr.hpp:2240
bool IsSetAffil(void) const
author affiliation Check if a value has been assigned to Affil data member.
Definition: Auth_list_.hpp:498
void SetCountry(const TCountry &value)
Assign a value to Country data member.
Definition: Affil_.hpp:897
void SetSub(const TSub &value)
Assign a value to Sub data member.
Definition: Affil_.hpp:850
bool IsSetPhone(void) const
Check if a value has been assigned to Phone data member.
Definition: Affil_.hpp:1064
const TAffil & GetAffil(void) const
Get the Affil member data.
Definition: Auth_list_.hpp:510
bool IsSetStreet(void) const
street address, not ANSI Check if a value has been assigned to Street data member.
Definition: Affil_.hpp:923
const TStr & GetStr(void) const
Get the variant data.
Definition: Affil_.hpp:1193
bool IsSetCity(void) const
Author Affiliation, City Check if a value has been assigned to City data member.
Definition: Affil_.hpp:782
void SetAffil(TAffil &value)
Assign a value to Affil data member.
Definition: Auth_list_.cpp:160
bool IsSetEmail(void) const
Check if a value has been assigned to Email data member.
Definition: Affil_.hpp:970
const TName & GetName(void) const
Get the Name member data.
Definition: Author_.hpp:352
const TSub & GetSub(void) const
Get the Sub member data.
Definition: Affil_.hpp:841
bool IsStr(void) const
Check if variant Str is selected.
Definition: Affil_.hpp:1187
TStr & SetStr(void)
Select the variant.
Definition: Affil_.hpp:1200
bool IsSetNames(void) const
Check if a value has been assigned to Names data member.
Definition: Auth_list_.hpp:464
E_Choice Which(void) const
Which variant is currently selected.
Definition: Affil_.hpp:1158
void SetNames(TNames &value)
Assign a value to Names data member.
Definition: Auth_list_.cpp:149
bool IsSetFax(void) const
Check if a value has been assigned to Fax data member.
Definition: Affil_.hpp:1017
bool IsSetDiv(void) const
Author Affiliation, Division Check if a value has been assigned to Div data member.
Definition: Affil_.hpp:735
const TCountry & GetCountry(void) const
Get the Country member data.
Definition: Affil_.hpp:888
const TStd & GetStd(void) const
Get the variant data.
Definition: Affil_.cpp:214
bool IsSetName(void) const
Author, Primary or Secondary Check if a value has been assigned to Name data member.
Definition: Author_.hpp:340
const TNames & GetNames(void) const
Get the Names member data.
Definition: Auth_list_.hpp:478
void ResetAffil(void)
Reset Affil data member.
Definition: Auth_list_.cpp:155
bool IsStd(void) const
Check if variant Std is selected.
Definition: Affil_.hpp:1207
bool IsSetPostal_code(void) const
Check if a value has been assigned to Postal_code data member.
Definition: Affil_.hpp:1111
bool IsSetCountry(void) const
Author Affiliation, Country Check if a value has been assigned to Country data member.
Definition: Affil_.hpp:876
bool IsSetAffil(void) const
Author Affiliation, Name Check if a value has been assigned to Affil data member.
Definition: Affil_.hpp:688
TStd & SetStd(void)
Select the variant.
Definition: Affil_.cpp:220
E_Choice Which(void) const
Which variant is currently selected.
Definition: Auth_list_.hpp:375
bool IsSetSub(void) const
Author Affiliation, County Sub Check if a value has been assigned to Sub data member.
Definition: Affil_.hpp:829
@ e_Str
unparsed string
Definition: Affil_.hpp:545
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
void ResetLast(void)
Reset Last data member.
Definition: Name_std_.cpp:50
void SetInitials(const TInitials &value)
Assign a value to Initials data member.
Definition: Name_std_.hpp:619
bool IsSetSuffix(void) const
Jr, Sr, III Check if a value has been assigned to Suffix data member.
Definition: Name_std_.hpp:645
void ResetInitials(void)
Reset Initials data member.
Definition: Name_std_.cpp:74
const TInitials & GetInitials(void) const
Get the Initials member data.
Definition: Name_std_.hpp:610
void ResetFirst(void)
Reset First data member.
Definition: Name_std_.cpp:56
bool IsSetMiddle(void) const
Check if a value has been assigned to Middle data member.
Definition: Name_std_.hpp:504
void SetLast(const TLast &value)
Assign a value to Last data member.
Definition: Name_std_.hpp:431
bool IsSetFull(void) const
full name eg.
Definition: Name_std_.hpp:551
void SetFirst(const TFirst &value)
Assign a value to First data member.
Definition: Name_std_.hpp:478
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
Definition: Name_std_.hpp:598
bool IsSetTitle(void) const
Dr., Sister, etc Check if a value has been assigned to Title data member.
Definition: Name_std_.hpp:692
const TMl & GetMl(void) const
Get the variant data.
Definition: Person_id_.hpp:371
bool IsSetLast(void) const
Check if a value has been assigned to Last data member.
Definition: Name_std_.hpp:410
void SetMiddle(const TMiddle &value)
Assign a value to Middle data member.
Definition: Name_std_.hpp:525
const TMiddle & GetMiddle(void) const
Get the Middle member data.
Definition: Name_std_.hpp:516
const TConsortium & GetConsortium(void) const
Get the variant data.
Definition: Person_id_.hpp:411
void SetSuffix(const TSuffix &value)
Assign a value to Suffix data member.
Definition: Name_std_.hpp:666
const TSuffix & GetSuffix(void) const
Get the Suffix member data.
Definition: Name_std_.hpp:657
void ResetTitle(void)
Reset Title data member.
Definition: Name_std_.cpp:86
const TFirst & GetFirst(void) const
Get the First member data.
Definition: Name_std_.hpp:469
void ResetFull(void)
Reset Full data member.
Definition: Name_std_.cpp:68
void ResetMiddle(void)
Reset Middle data member.
Definition: Name_std_.cpp:62
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
bool IsSetFirst(void) const
Check if a value has been assigned to First data member.
Definition: Name_std_.hpp:457
void ResetSuffix(void)
Reset Suffix data member.
Definition: Name_std_.cpp:80
@ 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
@ e_not_set
No variant selected.
Definition: Person_id_.hpp:94
yy_size_t n
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
int toupper(Uchar c)
Definition: ncbictype.hpp:73
int islower(Uchar c)
Definition: ncbictype.hpp:66
int isupper(Uchar c)
Definition: ncbictype.hpp:70
static const char * str(char *buf, int n)
Definition: stats.c:84
bool operator()(CRef< CAuthor > &cauth)
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Definition: static_set.hpp:60
#define _ASSERT
Modified on Sat Mar 02 10:56:06 2024 by modify_doxy.py rev. 669887