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

Go to the SVN repository for this file.

1 /* $Id: Pub.cpp 89897 2020-04-30 12:32:13Z grichenk $
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  * 'pub.asn'.
35  */
36 
37 #include <ncbi_pch.hpp>
38 
39 #include <objects/pub/Pub.hpp>
41 
60 
62 
63 // generated classes
64 
66 
67 BEGIN_objects_SCOPE // namespace ncbi::objects::
68 
69 // destructor
71 {
72 }
73 
74 
75 // Appends a label to "label"
76 bool CPub::GetLabel(string* label,
79  ELabelVersion version) const
80 {
81  static const char* s_PubTypes[14] = {
82  "Unknown",
83  "Generic",
84  "Submit",
85  "Medline",
86  "MUID",
87  "Article",
88  "Journal",
89  "Book",
90  "Proceedings",
91  "Patent",
92  "PatID",
93  "Manuscript",
94  "Equiv",
95  "PMID" };
96 
97  // Check that label exists
98  if (!label) {
99  return false;
100  }
101 
102  // Get the index into the s_PubTypes array corresponding to pub type
103  int idx = static_cast<int>(Which());
104  idx = idx >= 0 && idx < 14 ? idx : 0;
105 
106  if (type == eType) {
107  // Append pub type to label and return
108  *label += s_PubTypes[idx];
109  return true;
110  }
111 
112  if (type == eBoth) {
113  // Append pub type to label
114  *label += string(s_PubTypes[idx]) + ": ";
115  }
116 
117  switch (Which()) {
118  case e_Muid:
119  *label += "NLM" + NStr::NumericToString(GetMuid());
120  return true;
121  case e_Pmid:
122  *label += "PM" + NStr::NumericToString(GetPmid().Get());
123  return true;
124  case e_Equiv:
125  return GetEquiv().GetLabel(label, flags, version);
126  case e_Medline:
127  return GetMedline().GetLabel(label, flags, version);
128  case e_Article:
129  return GetArticle().GetLabel(label, flags, version);
130  case e_Journal:
131  return GetJournal().GetLabel(label, flags, version);
132  case e_Book:
133  return GetBook().GetLabel(label, flags, version);
134  case e_Proc:
135  return GetProc().GetLabel(label, flags, version);
136  case e_Man:
137  return GetMan().GetLabel(label, flags, version);
138  case e_Sub:
139  return GetSub().GetLabel(label, flags, version);
140  case e_Patent:
141  return GetPatent().GetLabel(label, flags, version);
142  case e_Pat_id:
143  return GetPat_id().GetLabel(label, flags, version);
144  case e_Gen:
145  return GetGen().GetLabel(label, flags, version);
146  default:
147  return false;
148  }
149 }
150 
151 
152 bool CPub::IsSetAuthors(void) const
153 {
154  switch (Which()) {
155  case CPub::e_Gen :
156  return (GetGen().IsSetAuthors());
157  case CPub::e_Sub :
158  return (GetSub().IsSetAuthors());
159  case CPub::e_Article :
160  return (GetArticle().IsSetAuthors());
161  case CPub::e_Book :
162  return (GetBook().IsSetAuthors());
163  case CPub::e_Proc :
164  return (GetProc().IsSetBook() && GetProc().GetBook().IsSetAuthors());
165  case CPub::e_Patent :
166  return (GetPatent().IsSetAuthors());
167  case CPub::e_Man :
168  return (GetMan().IsSetCit() && GetMan().GetCit().IsSetAuthors());
169  default :
170  break;
171  }
172 
173  return false;
174 }
175 
176 const CAuth_list& CPub::GetAuthors (void) const
177 {
178  switch (Which()) {
179  case CPub::e_Gen :
180  return (GetGen().GetAuthors());
181  case CPub::e_Sub :
182  return (GetSub().GetAuthors());
183  case CPub::e_Article :
184  return (GetArticle().GetAuthors());
185  case CPub::e_Book :
186  return (GetBook().GetAuthors());
187  case CPub::e_Proc :
188  return (GetProc().GetBook().GetAuthors());
189  case CPub::e_Patent :
190  return (GetPatent().GetAuthors());
191  case CPub::e_Man :
192  return (GetMan().GetCit().GetAuthors());
193  default :
194  NCBI_THROW(CSerialException, eNotImplemented,
195  "CPub::GetAuthors: unsupported entry type "
196  + SelectionName(Which()));
197  }
198 }
199 
201 {
202  switch (Which()) {
203  case CPub::e_Gen :
204  return (SetGen().SetAuthors());
205  case CPub::e_Sub :
206  return (SetSub().SetAuthors());
207  case CPub::e_Article :
208  return (SetArticle().SetAuthors());
209  case CPub::e_Book :
210  return (SetBook().SetAuthors());
211  case CPub::e_Proc :
212  return (SetProc().SetBook().SetAuthors());
213  case CPub::e_Patent :
214  return (SetPatent().SetAuthors());
215  case CPub::e_Man :
216  return (SetMan().SetCit().SetAuthors());
217  default :
218  NCBI_THROW(CSerialException, eNotImplemented,
219  "CPub::SetAuthors: unsupported entry type "
220  + SelectionName(Which()));
221  }
222 }
223 
225  TOneTitleRefVec & out_title,
226  size_t iMaxToGet ) const
227 {
228  // this "if" lets us assume below this point that
229  // we have room for at least one
230  if( iMaxToGet <= 0 ) {
231  return;
232  }
233 
234  switch( Which() ) {
235  case CPub::e_not_set:
236  case CPub::e_Medline:
237  case CPub::e_Pmid:
238  case CPub::e_Pat_id:
239  // these types don't have titles, so nothing to do
240  break;
241  case CPub::e_Gen:
242  if( GetGen().IsSetTitle() ) {
243  out_title.push_back(
245  GetGen().GetTitle()) );
246  }
247  break;
248  case CPub::e_Sub:
249  if( GetSub().IsSetDescr() ) {
250  out_title.push_back(
252  GetSub().GetDescr()) );
253  }
254  break;
255  case CPub::e_Article:
256  if( GetArticle().IsSetTitle() && GetArticle().GetTitle().IsSet() ) {
257  xs_AppendTitles( out_title, iMaxToGet, GetArticle().GetTitle() );
258  }
259  break;
260  case CPub::e_Journal:
261  if( GetJournal().IsSetTitle() ) {
262  xs_AppendTitles( out_title, iMaxToGet, GetJournal().GetTitle() );
263  }
264  break;
265  case CPub::e_Book:
266  if( GetBook().IsSetTitle() ) {
267  xs_AppendTitles( out_title, iMaxToGet, GetBook().GetTitle() );
268  }
269  break;
270  case CPub::e_Proc:
271  // what to do here? It has a book and meeting
272  // It's not entirely clear if this is the best course of action
273  if( FIELD_CHAIN_OF_2_IS_SET(GetProc(), Book, Title) ) {
274  xs_AppendTitles( out_title, iMaxToGet,
275  GetProc().GetBook().GetTitle() );
276  }
277  break;
278  case CPub::e_Patent:
279  if( GetPatent().IsSetTitle() ) {
280  out_title.push_back(
282  GetPatent().GetTitle()) );
283  }
284  break;
285  case CPub::e_Man:
286  if( FIELD_CHAIN_OF_2_IS_SET(GetMan(), Cit, Title) ) {
287  xs_AppendTitles( out_title, iMaxToGet,
288  GetMan().GetCit().GetTitle() );
289  }
290  break;
291  case CPub::e_Equiv:
292  {
293  size_t iMaxTitleSizeAllowed = ( out_title.size() + iMaxToGet );
294  if( iMaxTitleSizeAllowed < out_title.size() ) {
295  // integer overflowed
296  iMaxTitleSizeAllowed =
298  }
300  if( out_title.size() >= iMaxTitleSizeAllowed ) {
301  break;
302  }
303 
304  // dig down recursively
305  (*pub_it)->GetTitles(out_title,
306  (iMaxTitleSizeAllowed - out_title.size()) );
307  }
308  }
309  break;
310  default:
311  NCBI_THROW(CException, eUnknown, "unhandled pub type");
312  }
313 }
314 
315 // static
317 CPub::xs_GetTitleFromPlainString(const string & sTitle)
318 {
319  CRef<CTitle::C_E> pRval( new CTitle::C_E );
320  pRval->SetName( sTitle );
321  return pRval;
322 }
323 
324 // static
326  size_t iMaxToGet,
327  const CTitle & in_title )
328 {
329  if( iMaxToGet <= 0 ) {
330  return;
331  }
332 
333  if( ! in_title.IsSet() ) {
334  return;
335  }
336 
337  size_t iNumCopiedSoFar = 0;
338  CTitle::Tdata::const_iterator src_it = in_title.Get().begin();
339  CTitle::Tdata::const_iterator src_it_end = in_title.Get().end();
340  for( ; src_it != src_it_end && iNumCopiedSoFar < iMaxToGet;
341  ++src_it, ++iNumCopiedSoFar)
342  {
343  out_title.push_back( *src_it );
344  }
345 }
346 
347 
348 typedef struct {
349  string country;
350  string number;
351  string app_number;
355 } SPubMatchInfo;
356 
357 
358 string s_GetTitleString(const CTitle::C_E& title)
359 {
360  string str = "";
361 
362  switch (title.Which()) {
363  case CTitle::C_E::e_Name:
364  str = title.GetName();
365  break;
366  case CTitle::C_E::e_Abr:
367  str = title.GetAbr();
368  break;
370  str = title.GetCoden();
371  break;
372  case CTitle::C_E::e_Isbn:
373  str = title.GetIsbn();
374  break;
376  str = title.GetIso_jta();
377  break;
378  case CTitle::C_E::e_Issn:
379  str = title.GetIssn();
380  break;
381  case CTitle::C_E::e_Jta:
382  str = title.GetJta();
383  break;
385  str = title.GetMl_jta();
386  break;
388  str = title.GetTrans();
389  break;
390  case CTitle::C_E::e_Tsub:
391  str = title.GetTsub();
392  break;
394  break;
395  }
396  return str;
397 }
398 
399 
400 bool s_TitleMatch(const CTitle& title1, const CTitle& title2, CTitle::C_E::E_Choice title_type)
401 {
402  string compare1 = "";
403  string compare2 = "";
404 
405  ITERATE(CTitle::Tdata, it, title1.Get()) {
406  if ((*it)->Which() == title_type) {
407  compare1 = s_GetTitleString(**it);
408  break;
409  }
410  }
411  ITERATE(CTitle::Tdata, it, title2.Get()) {
412  if ((*it)->Which() == title_type) {
413  compare2 = s_GetTitleString(**it);
414  break;
415  }
416  }
417  if (!NStr::IsBlank(compare1) && NStr::EqualNocase(compare1, compare2)) {
418  return true;
419  } else {
420  return false;
421  }
422 }
423 
424 
425 #define FIELD(Obj,Field) (Obj.IsSet##Field() ? Obj.Get##Field() : "")
426 #define FIELD_MATCH(Obj1,Obj2,Field) (NStr::EqualNocase(FIELD(Obj1,Field), FIELD(Obj2,Field)))
427 #define INT_FIELD_MATCH(Obj1,Obj2,Field) ((Obj1.IsSet##Field() && Obj2.IsSet##Field() && Obj1.Get##Field() == Obj2.Get##Field()) || (!Obj1.IsSet##Field() && !Obj2.IsSet##Field()))
428 
429 #define S_MATCH(Obj1,Obj2,Field) ((!Obj1.IsSet##Field() && !Obj2.IsSet##Field()) || (Obj1.IsSet##Field() && Obj2.IsSet##Field() && s_Match##Field(Obj1.Get##Field(),Obj2.Get##Field())))
430 #define S_MATCH_A(Obj1,Obj2,Field) ((!Obj1.IsSet##Field() && !Obj2.IsSet##Field()) || (Obj1.IsSet##Field() && Obj2.IsSet##Field() && Obj1.Get##Field().SameCitation(Obj2.Get##Field())))
431 
432 bool s_MatchDate(const CDate& date1, const CDate& date2)
433 {
434  return date1.Equals(date2);
435 }
436 
437 
438 bool s_MatchImp(const CImprint& imp1, const CImprint& imp2)
439 {
440  if (!S_MATCH(imp1, imp2, Date)) {
441  return false;
442  }
443 
444  if (!FIELD_MATCH(imp1, imp2, Volume) ||
445  !FIELD_MATCH(imp1, imp2, Issue) ||
446  !FIELD_MATCH(imp1, imp2, Pages) ||
447  !FIELD_MATCH(imp1, imp2, Section) ||
448  !FIELD_MATCH(imp1, imp2, Part_sup) ||
449  !FIELD_MATCH(imp1, imp2, Language)) {
450  return false;
451  }
452 
453  if (imp1.IsSetCprt() && imp2.IsSetCprt() && !imp1.GetCprt().Equals(imp2.GetCprt())) {
454  return false;
455  }
456  return true;
457 }
458 
459 
460 // try to match one of these title types
469 };
470 
471 
472 bool s_MatchTitle(const CTitle& title1, const CTitle& title2)
473 {
474  bool match_title = false;
475 
476  for (size_t i = 0; !match_title && s_MatchJournalTypes[i] != CTitle::C_E::e_not_set; i++) {
477  match_title = s_TitleMatch(title1, title2, s_MatchJournalTypes[i]);
478  }
479 
480  return match_title;
481 }
482 
483 
484 bool s_JournalMatch(const CCit_jour& jour1, const CCit_jour& jour2)
485 {
486  // look for matching title
487  if (!S_MATCH(jour1, jour2, Title)) {
488  return false;
489  }
490 
491  return S_MATCH(jour1, jour2, Imp);
492 }
493 
494 
495 bool s_MatchBook(const CCit_book& book1, const CCit_book& book2)
496 {
497  if (!S_MATCH_A(book1, book2, Authors)) {
498  return false;
499  }
500 
501  if (!S_MATCH(book1, book2, Imp)) {
502  return false;
503  }
504 
505  if ((!book1.IsSetTitle() && book2.IsSetTitle()) ||
506  (book1.IsSetTitle() && !book2.IsSetTitle()) ||
507  !s_TitleMatch(book1.GetTitle(), book2.GetTitle(), CTitle::C_E::e_Name)) {
508  return false;
509  }
510 
511  return true;
512 }
513 
514 
515 bool s_ProcMatch(const CCit_proc& book1, const CCit_proc& book2)
516 {
517  return S_MATCH(book1, book2, Book);
518 }
519 
520 
521 bool s_ManMatch(const CCit_let& book1, const CCit_let& book2)
522 {
523  return ((!book1.IsSetCit() && !book2.IsSetCit()) ||
524  (book1.IsSetCit() && book2.IsSetCit() && s_MatchBook(book1.GetCit(), book2.GetCit())));
525 }
526 
527 
528 bool s_CitArtMatch(const CCit_art& art1, const CCit_art& art2)
529 {
530  if (!art1.IsSetFrom() || !art2.IsSetFrom()) {
531  return false;
532  }
533  if (art1.GetFrom().Which() != art2.GetFrom().Which()) {
534  return false;
535  }
536 
537  if (art1.GetFrom().IsJournal()) {
538  // make sure journals match
539  if (!s_JournalMatch(art1.GetFrom().GetJournal(), art2.GetFrom().GetJournal())) {
540  return false;
541  }
542  } else if (art1.GetFrom().IsBook()) {
543  // make sure books match
544  if (!s_MatchBook(art1.GetFrom().GetBook(), art2.GetFrom().GetBook())) {
545  return false;
546  }
547  } else if (art1.GetFrom().IsProc()) {
548  // make sure proceedings match
549  if (!s_ProcMatch(art1.GetFrom().GetProc(), art2.GetFrom().GetProc())) {
550  return false;
551  }
552  }
553 
554  if (!S_MATCH_A(art1, art2, Authors)) {
555  return false;
556  }
557 
558  if (!art1.IsSetTitle() && !art2.IsSetTitle()) {
559  // ok, no title for either
560  } else if (!art1.IsSetTitle() || !art2.IsSetTitle()) {
561  return false;
562  } else if (!s_TitleMatch(art1.GetTitle(), art2.GetTitle(), CTitle::C_E::e_Name)) {
563  return false;
564  }
565 
566  return true;
567 }
568 
569 
570 bool s_CitGenMatch(const CCit_gen& gen1, const CCit_gen& gen2)
571 {
572  if (!FIELD_MATCH(gen1, gen2, Volume) ||
573  !FIELD_MATCH(gen1, gen2, Issue) ||
574  !FIELD_MATCH(gen1, gen2, Pages) ||
575  !FIELD_MATCH(gen1, gen2, Title) ||
576  !FIELD_MATCH(gen1, gen2, Cit)) {
577  return false;
578  }
579  if (!S_MATCH_A(gen1, gen2, Authors)) {
580  return false;
581  }
582 
583  if (!INT_FIELD_MATCH(gen1, gen2, Muid) ||
584  !INT_FIELD_MATCH(gen1, gen2, Serial_number)) {
585  return false;
586  }
587 
588  if (!gen1.IsSetJournal() && !gen2.IsSetJournal()) {
589  // both empty, ok
590  } else if (!gen1.IsSetJournal() || !gen2.IsSetJournal()) {
591  return false;
592  } else if (!s_MatchTitle(gen1.GetJournal(), gen2.GetJournal())) {
593  return false;
594  }
595 
596  if (!S_MATCH(gen1, gen2, Date)) {
597  return false;
598  }
599 
600  return true;
601 
602 }
603 
604 
605 bool s_CitSubMatch(const CCit_sub& sub1, const CCit_sub& sub2)
606 {
607  if (!S_MATCH_A(sub1, sub2, Authors)) {
608  return false;
609  }
610 
611  bool rval = false;
612 
613  if (sub1.IsSetImp() && sub2.IsSetImp()) {
614  rval = s_MatchImp(sub1.GetImp(), sub2.GetImp());
615  } else {
616  // compare date from imprint or in sub
617  CConstRef<CDate> date1(NULL);
618  CConstRef<CDate> date2(NULL);
619  if (sub1.IsSetImp() && sub1.GetImp().IsSetDate()) {
620  date1.Reset(&(sub1.GetImp().GetDate()));
621  } else if (sub1.IsSetDate()) {
622  date1.Reset(&(sub1.GetDate()));
623  }
624  if (sub2.IsSetImp() && sub2.GetImp().IsSetDate()) {
625  date2.Reset(&(sub2.GetImp().GetDate()));
626  } else if (sub2.IsSetDate()) {
627  date2.Reset(&(sub2.GetDate()));
628  }
629  if (!date1 && !date2) {
630  rval = true;
631  } else if (!date1 || !date2) {
632  rval = false;
633  } else {
634  rval = date1->Equals(*date2);
635  }
636  }
637  return rval;
638 }
639 
640 
641 bool s_MatchInfoMatches(const SPubMatchInfo& match1, const SPubMatchInfo& match2)
642 {
643  if (match1.muid > ZERO_ENTREZ_ID && match2.muid > ZERO_ENTREZ_ID) {
644  if (match1.muid == match2.muid) {
645  return true;
646  }
647  }
648 
649  if (match1.pmid > ZERO_ENTREZ_ID && match2.pmid > ZERO_ENTREZ_ID) {
650  if (match1.pmid == match2.pmid) {
651  return true;
652  }
653  }
654 
655  if (!NStr::IsBlank(match1.country) && !NStr::IsBlank(match2.country)) {
656  if (NStr::EqualNocase(match1.country, match2.country) &&
657  NStr::EqualNocase(match1.number, match2.number) &&
658  NStr::EqualNocase(match1.app_number, match2.app_number)) {
659  return true;
660  }
661  }
662 
663  if (match1.art && match2.art) {
664  if (s_CitArtMatch(*(match1.art), *(match2.art))) {
665  return true;
666  }
667  }
668 
669  return false;
670 }
671 
672 
674 {
675  if (patent.IsSetCountry()) {
676  match.country = patent.GetCountry();
677  }
678  if (patent.IsSetNumber()) {
679  match.number = patent.GetNumber();
680  }
681  if (patent.IsSetApp_number()) {
682  match.app_number = patent.GetApp_number();
683  }
684 }
685 
686 
688 {
689  if (patent.IsSetCountry()) {
690  match.country = patent.GetCountry();
691  }
692  if (patent.IsSetId()) {
693  if (patent.GetId().IsNumber()) {
694  match.number = patent.GetId().GetNumber();
695  } else if (patent.GetId().IsApp_number()) {
696  match.app_number = patent.GetId().GetApp_number();
697  }
698  }
699 }
700 
701 
703 {
704  match.muid = ZERO_ENTREZ_ID;
705  match.pmid = ZERO_ENTREZ_ID;
706  match.country = "";
707  match.number = "";
708  match.app_number = "";
709 
710  switch (pub.Which()) {
711  case CPub::e_Pmid:
712  match.pmid = pub.GetPmid();
713  break;
714  case CPub::e_Muid:
715  match.muid = pub.GetMuid();
716  break;
717  case CPub::e_Patent:
719  break;
720  case CPub::e_Pat_id:
722  break;
723  case CPub::e_Article:
724  match.art = new CCit_art();
725  match.art->Assign(pub.GetArticle());
726  break;
727  default:
728  break;
729  }
730 }
731 
732 
733 bool CPub::SameCitation(const CPub& other) const
734 {
735  if (Which() == CPub::e_Equiv) {
736  if (other.Which() == CPub::e_Equiv) {
737  return GetEquiv().SameCitation(other.GetEquiv());
738  } else {
739  return GetEquiv().SameCitation(other);
740  }
741  }
742  SPubMatchInfo match1, match2;
743 
744  s_GetPubMatchInfo(*this, match1);
745  s_GetPubMatchInfo(other, match2);
746  if (s_MatchInfoMatches(match1, match2)) {
747  return true;
748  }
749  // false if different pub types
750  if (Which() != other.Which()) {
751  return false;
752  }
753 
754  bool rval = false;
755 
756  switch (Which()) {
757  case CPub::e_Gen:
758  rval = s_CitGenMatch(GetGen(), other.GetGen());
759  break;
760  case CPub::e_Sub:
761  rval = s_CitSubMatch(GetSub(), other.GetSub());
762  break;
763  case CPub::e_Journal:
764  rval = s_JournalMatch(GetJournal(), other.GetJournal());
765  break;
766  case CPub::e_Book:
767  rval = s_MatchBook(GetBook(), other.GetBook());
768  break;
769  case CPub::e_Proc:
770  rval = s_ProcMatch(GetProc(), other.GetProc());
771  break;
772  case CPub::e_Man:
773  rval = s_ManMatch(GetMan(), other.GetMan());
774  break;
775  default:
776  break;
777  }
778  return rval;
779 }
780 
781 
782 END_objects_SCOPE // namespace ncbi::objects::
783 
785 
786 /* Original file checksum: lines: 61, chars: 1862, CRC32: d27bbf43 */
User-defined methods of the data storage class.
User-defined methods of the data storage class.
bool s_TitleMatch(const CTitle &title1, const CTitle &title2, CTitle::C_E::E_Choice title_type)
Definition: Pub.cpp:400
#define S_MATCH_A(Obj1, Obj2, Field)
Definition: Pub.cpp:430
bool s_CitArtMatch(const CCit_art &art1, const CCit_art &art2)
Definition: Pub.cpp:528
bool s_ManMatch(const CCit_let &book1, const CCit_let &book2)
Definition: Pub.cpp:521
bool s_ProcMatch(const CCit_proc &book1, const CCit_proc &book2)
Definition: Pub.cpp:515
#define FIELD_MATCH(Obj1, Obj2, Field)
Definition: Pub.cpp:426
bool s_MatchImp(const CImprint &imp1, const CImprint &imp2)
Definition: Pub.cpp:438
bool s_MatchTitle(const CTitle &title1, const CTitle &title2)
Definition: Pub.cpp:472
bool s_JournalMatch(const CCit_jour &jour1, const CCit_jour &jour2)
Definition: Pub.cpp:484
bool s_MatchBook(const CCit_book &book1, const CCit_book &book2)
Definition: Pub.cpp:495
bool s_MatchDate(const CDate &date1, const CDate &date2)
Definition: Pub.cpp:432
static const CTitle::C_E::E_Choice s_MatchJournalTypes[]
Definition: Pub.cpp:461
string s_GetTitleString(const CTitle::C_E &title)
Definition: Pub.cpp:358
void s_GetPubMatchInfo(const CCit_pat &patent, SPubMatchInfo &match)
Definition: Pub.cpp:673
#define INT_FIELD_MATCH(Obj1, Obj2, Field)
Definition: Pub.cpp:427
bool s_CitGenMatch(const CCit_gen &gen1, const CCit_gen &gen2)
Definition: Pub.cpp:570
bool s_MatchInfoMatches(const SPubMatchInfo &match1, const SPubMatchInfo &match2)
Definition: Pub.cpp:641
#define S_MATCH(Obj1, Obj2, Field)
Definition: Pub.cpp:429
bool s_CitSubMatch(const CCit_sub &sub1, const CCit_sub &sub2)
Definition: Pub.cpp:605
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
CConstRef –.
Definition: ncbiobj.hpp:1266
Definition: Date.hpp:53
CImprint –.
Definition: Imprint.hpp:66
bool SameCitation(const CPub_equiv &other) const
Definition: Pub_equiv.cpp:127
bool GetLabel(string *label, TLabelFlags flags=0, ELabelVersion version=eLabel_DefaultVersion) const override
Append a label to "label" based on content.
Definition: Pub_equiv.cpp:56
Definition: Pub.hpp:56
static void xs_AppendTitles(TOneTitleRefVec &out_title, size_t iMaxToGet, const CTitle &in_title)
Definition: Pub.cpp:325
vector< TOneTitleRef > TOneTitleRefVec
Definition: Pub.hpp:90
~CPub(void)
Definition: Pub.cpp:70
ELabelType
Definition: Pub.hpp:64
@ eBoth
Definition: Pub.hpp:67
@ eType
Definition: Pub.hpp:65
bool GetLabel(string *label, ELabelType type=eContent, TLabelFlags flags=0, ELabelVersion version=eLabel_DefaultVersion) const
Concatenate a label for this pub to label.
Definition: Pub.cpp:76
const CAuth_list & GetAuthors(void) const
Definition: Pub.cpp:176
CAuth_list & SetAuthors(void)
Definition: Pub.cpp:200
static TOneTitleRef xs_GetTitleFromPlainString(const string &sTitle)
Definition: Pub.cpp:317
bool SameCitation(const CPub &other) const
Definition: Pub.cpp:733
void GetTitles(TOneTitleRefVec &out_title, size_t iMaxToGet=std::numeric_limits< std::size_t >::max()) const
This gets the titles on the CPub.
Definition: Pub.cpp:224
bool IsSetAuthors(void) const
Definition: Pub.cpp:152
CRef –.
Definition: ncbiobj.hpp:618
Root class for all serialization exceptions.
Definition: exception.hpp:50
C_E –.
Definition: Title_.hpp:96
Definition: Title.hpp:51
int TLabelFlags
binary OR of ELabelFlags
bool GetLabel(string *label, TLabelFlags flags=0, ELabelVersion version=eLabel_DefaultVersion) const override
Append a label to the specified string per the specified flags.
static uch flags
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
Definition: ncbimisc.hpp:1041
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define ZERO_ENTREZ_ID
Definition: ncbimisc.hpp:1102
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1439
#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 bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
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:5352
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
static const char label[]
bool IsProc(void) const
Check if variant Proc is selected.
Definition: Cit_art_.hpp:507
const TTitle & GetTitle(void) const
Get the Title member data.
Definition: Cit_book_.hpp:296
const TDate & GetDate(void) const
Get the Date member data.
Definition: Cit_sub_.hpp:455
const TCit & GetCit(void) const
Get the Cit member data.
Definition: Cit_let_.hpp:267
bool IsSetNumber(void) const
Patent Document Number Check if a value has been assigned to Number data member.
Definition: Cit_pat_.hpp:827
const TCprt & GetCprt(void) const
Get the Cprt member data.
Definition: Imprint_.hpp:967
const TJournal & GetJournal(void) const
Get the variant data.
Definition: Cit_art_.cpp:111
const TFrom & GetFrom(void) const
Get the From member data.
Definition: Cit_art_.hpp:567
bool IsApp_number(void) const
Check if variant App_number is selected.
Definition: Id_pat_.hpp:446
bool IsSetTitle(void) const
Title of book Check if a value has been assigned to Title data member.
Definition: Cit_book_.hpp:284
bool IsNumber(void) const
Check if variant Number is selected.
Definition: Id_pat_.hpp:426
bool IsSetCountry(void) const
Patent Document Country Check if a value has been assigned to Country data member.
Definition: Id_pat_.hpp:466
const TMl_jta & GetMl_jta(void) const
Get the variant data.
Definition: Title_.hpp:675
const TIssn & GetIssn(void) const
Get the variant data.
Definition: Title_.hpp:715
bool IsSetTitle(void) const
title of paper (ANSI requires) Check if a value has been assigned to Title data member.
Definition: Cit_art_.hpp:513
const TTitle & GetTitle(void) const
Get the Title member data.
Definition: Cit_art_.hpp:525
E_Choice Which(void) const
Which variant is currently selected.
Definition: Title_.hpp:540
bool IsSetFrom(void) const
Check if a value has been assigned to From data member.
Definition: Cit_art_.hpp:555
const TProc & GetProc(void) const
Get the variant data.
Definition: Cit_art_.cpp:155
E_Choice Which(void) const
Which variant is currently selected.
Definition: Cit_art_.hpp:466
list< CRef< C_E > > Tdata
Definition: Title_.hpp:477
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
Definition: Id_pat_.hpp:513
const TCoden & GetCoden(void) const
Get the variant data.
Definition: Title_.hpp:695
const TName & GetName(void) const
Get the variant data.
Definition: Title_.hpp:575
bool IsSetDate(void) const
replaces imp, will become required Check if a value has been assigned to Date data member.
Definition: Cit_sub_.hpp:443
E_Choice
Choice variants.
Definition: Title_.hpp:109
const TIso_jta & GetIso_jta(void) const
Get the variant data.
Definition: Title_.hpp:655
const TJournal & GetJournal(void) const
Get the Journal member data.
Definition: Cit_gen_.hpp:703
const TJta & GetJta(void) const
Get the variant data.
Definition: Title_.hpp:635
bool IsSetJournal(void) const
Check if a value has been assigned to Journal data member.
Definition: Cit_gen_.hpp:691
const TId & GetId(void) const
Get the Id member data.
Definition: Id_pat_.hpp:525
const TNumber & GetNumber(void) const
Get the Number member data.
Definition: Cit_pat_.hpp:839
const TAbr & GetAbr(void) const
Get the variant data.
Definition: Title_.hpp:735
bool IsSetDate(void) const
date of publication Check if a value has been assigned to Date data member.
Definition: Imprint_.hpp:716
const TIsbn & GetIsbn(void) const
Get the variant data.
Definition: Title_.hpp:755
const TImp & GetImp(void) const
Get the Imp member data.
Definition: Cit_sub_.hpp:387
bool IsSet(void) const
Check if a value has been assigned to data member.
Definition: Title_.hpp:769
bool IsBook(void) const
Check if variant Book is selected.
Definition: Cit_art_.hpp:501
const TTsub & GetTsub(void) const
Get the variant data.
Definition: Title_.hpp:595
bool IsJournal(void) const
Check if variant Journal is selected.
Definition: Cit_art_.hpp:495
bool IsSetCit(void) const
same fields as a book Check if a value has been assigned to Cit data member.
Definition: Cit_let_.hpp:255
bool IsSetImp(void) const
this only used to get date.
Definition: Cit_sub_.hpp:375
const TDate & GetDate(void) const
Get the Date member data.
Definition: Imprint_.hpp:728
bool IsSetApp_number(void) const
Patent Doc Appl Number Check if a value has been assigned to App_number data member.
Definition: Cit_pat_.hpp:920
bool IsSetCprt(void) const
copyright date, " " " Check if a value has been assigned to Cprt data member.
Definition: Imprint_.hpp:955
const TApp_number & GetApp_number(void) const
Get the App_number member data.
Definition: Cit_pat_.hpp:932
const TNumber & GetNumber(void) const
Get the variant data.
Definition: Id_pat_.hpp:432
const TApp_number & GetApp_number(void) const
Get the variant data.
Definition: Id_pat_.hpp:452
const TTrans & GetTrans(void) const
Get the variant data.
Definition: Title_.hpp:615
const Tdata & Get(void) const
Get the member data.
Definition: Title_.hpp:781
const TCountry & GetCountry(void) const
Get the Country member data.
Definition: Cit_pat_.hpp:745
const TCountry & GetCountry(void) const
Get the Country member data.
Definition: Id_pat_.hpp:478
const TBook & GetBook(void) const
Get the variant data.
Definition: Cit_art_.cpp:133
bool IsSetCountry(void) const
Patent Document Country Check if a value has been assigned to Country data member.
Definition: Cit_pat_.hpp:733
@ e_Ml_jta
specifically MEDLINE jta J
Definition: Title_.hpp:116
@ e_Trans
Title, Translated AJB.
Definition: Title_.hpp:113
@ e_Abr
Title, Abbreviated B.
Definition: Title_.hpp:119
@ e_Issn
ISSN J.
Definition: Title_.hpp:118
@ e_Jta
Title, Abbreviated J.
Definition: Title_.hpp:114
@ e_Tsub
Title, Subordinate A B.
Definition: Title_.hpp:112
@ e_not_set
No variant selected.
Definition: Title_.hpp:110
@ e_Coden
a coden J
Definition: Title_.hpp:117
@ e_Iso_jta
specifically ISO jta J
Definition: Title_.hpp:115
@ e_Isbn
ISBN B.
Definition: Title_.hpp:120
@ e_Name
Title, Anal,Coll,Mono AJB.
Definition: Title_.hpp:111
TProc & SetProc(void)
Select the variant.
Definition: Pub_.cpp:305
const TMedline & GetMedline(void) const
Get the variant data.
Definition: Pub_.cpp:211
const TMan & GetMan(void) const
Get the variant data.
Definition: Pub_.cpp:365
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Pub_.cpp:157
TBook & SetBook(void)
Select the variant.
Definition: Pub_.cpp:283
const TPmid & GetPmid(void) const
Get the variant data.
Definition: Pub_.hpp:683
const TArticle & GetArticle(void) const
Get the variant data.
Definition: Pub_.cpp:233
const TJournal & GetJournal(void) const
Get the variant data.
Definition: Pub_.cpp:255
const TSub & GetSub(void) const
Get the variant data.
Definition: Pub_.cpp:189
const TPatent & GetPatent(void) const
Get the variant data.
Definition: Pub_.cpp:321
const TProc & GetProc(void) const
Get the variant data.
Definition: Pub_.cpp:299
const TEquiv & GetEquiv(void) const
Get the variant data.
Definition: Pub_.cpp:387
E_Choice Which(void) const
Which variant is currently selected.
Definition: Pub_.hpp:555
const TPat_id & GetPat_id(void) const
Get the variant data.
Definition: Pub_.cpp:343
TMan & SetMan(void)
Select the variant.
Definition: Pub_.cpp:371
TSub & SetSub(void)
Select the variant.
Definition: Pub_.cpp:195
TGen & SetGen(void)
Select the variant.
Definition: Pub_.cpp:173
const TGen & GetGen(void) const
Get the variant data.
Definition: Pub_.cpp:167
TMuid GetMuid(void) const
Get the variant data.
Definition: Pub_.hpp:608
TPatent & SetPatent(void)
Select the variant.
Definition: Pub_.cpp:327
TArticle & SetArticle(void)
Select the variant.
Definition: Pub_.cpp:239
const TBook & GetBook(void) const
Get the variant data.
Definition: Pub_.cpp:277
@ e_Pmid
PubMedId.
Definition: Pub_.hpp:114
@ e_Article
Definition: Pub_.hpp:106
@ e_Pat_id
identify a patent
Definition: Pub_.hpp:111
@ e_Book
Definition: Pub_.hpp:108
@ e_Medline
Definition: Pub_.hpp:104
@ e_Gen
general or generic unparsed
Definition: Pub_.hpp:102
@ e_not_set
No variant selected.
Definition: Pub_.hpp:101
@ e_Journal
Definition: Pub_.hpp:107
@ e_Patent
Definition: Pub_.hpp:110
@ e_Muid
medline uid
Definition: Pub_.hpp:105
@ e_Proc
proceedings of a meeting
Definition: Pub_.hpp:109
@ e_Equiv
to cite a variety of ways
Definition: Pub_.hpp:113
@ e_Man
manuscript, thesis, or letter
Definition: Pub_.hpp:112
@ e_Sub
submission
Definition: Pub_.hpp:103
int i
static int version
Definition: mdb_load.c:29
const TYPE & Get(const CNamedParameterList *param)
static PyObject * Date(PyObject *self, PyObject *args)
T max(T x_, T y_)
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
Definition: pcre_exec.c:513
Utility macros and typedefs for exploring NCBI objects from pub.asn.
#define FOR_EACH_PUB_ON_PUBEQUIV(Itr, Var)
Definition: pub_macros.hpp:86
#define FIELD_CHAIN_OF_2_IS_SET(Var, Fld1, Fld2)
FIELD_CHAIN_OF_2_IS_SET.
static const char * str(char *buf, int n)
Definition: stats.c:84
string country
Definition: Pub.cpp:349
string number
Definition: Pub.cpp:350
TEntrezId muid
Definition: Pub.cpp:352
TEntrezId pmid
Definition: Pub.cpp:353
CRef< CCit_art > art
Definition: Pub.cpp:354
string app_number
Definition: Pub.cpp:351
Definition: entry.h:13
Definition: type.c:6
Modified on Sat Dec 09 04:46:40 2023 by modify_doxy.py rev. 669887