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

Go to the SVN repository for this file.

1 /* $Id: Pub.cpp 101487 2023-12-19 16:34:07Z 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: .......
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() 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_Medline :
160  return (GetMedline().IsSetCit() && GetMedline().GetCit().IsSetAuthors());
161  case CPub::e_Article :
162  return (GetArticle().IsSetAuthors());
163  case CPub::e_Book :
164  return (GetBook().IsSetAuthors());
165  case CPub::e_Proc :
166  return (GetProc().IsSetBook() && GetProc().GetBook().IsSetAuthors());
167  case CPub::e_Patent :
168  return (GetPatent().IsSetAuthors());
169  case CPub::e_Man :
170  return (GetMan().IsSetCit() && GetMan().GetCit().IsSetAuthors());
171  default :
172  break;
173  }
174 
175  return false;
176 }
177 
179 {
180  switch (Which()) {
181  case CPub::e_Gen :
182  return (GetGen().GetAuthors());
183  case CPub::e_Sub :
184  return (GetSub().GetAuthors());
185  case CPub::e_Medline :
186  return (GetMedline().GetCit().GetAuthors());
187  case CPub::e_Article :
188  return (GetArticle().GetAuthors());
189  case CPub::e_Book :
190  return (GetBook().GetAuthors());
191  case CPub::e_Proc :
192  return (GetProc().GetBook().GetAuthors());
193  case CPub::e_Patent :
194  return (GetPatent().GetAuthors());
195  case CPub::e_Man :
196  return (GetMan().GetCit().GetAuthors());
197  default :
198  NCBI_THROW(CSerialException, eNotImplemented,
199  "CPub::GetAuthors: unsupported entry type "
200  + SelectionName(Which()));
201  }
202 }
203 
205 {
206  switch (Which()) {
207  case CPub::e_Gen :
208  return (SetGen().SetAuthors());
209  case CPub::e_Sub :
210  return (SetSub().SetAuthors());
211  case CPub::e_Medline :
212  return (SetMedline().SetCit().SetAuthors());
213  case CPub::e_Article :
214  return (SetArticle().SetAuthors());
215  case CPub::e_Book :
216  return (SetBook().SetAuthors());
217  case CPub::e_Proc :
218  return (SetProc().SetBook().SetAuthors());
219  case CPub::e_Patent :
220  return (SetPatent().SetAuthors());
221  case CPub::e_Man :
222  return (SetMan().SetCit().SetAuthors());
223  default :
224  NCBI_THROW(CSerialException, eNotImplemented,
225  "CPub::SetAuthors: unsupported entry type "
226  + SelectionName(Which()));
227  }
228 }
229 
231  TOneTitleRefVec & out_title,
232  size_t iMaxToGet ) const
233 {
234  // this "if" lets us assume below this point that
235  // we have room for at least one
236  if( iMaxToGet <= 0 ) {
237  return;
238  }
239 
240  switch( Which() ) {
241  case CPub::e_not_set:
242  case CPub::e_Medline:
243  case CPub::e_Pmid:
244  case CPub::e_Pat_id:
245  // these types don't have titles, so nothing to do
246  break;
247  case CPub::e_Gen:
248  if( GetGen().IsSetTitle() ) {
249  out_title.push_back(
251  GetGen().GetTitle()) );
252  }
253  break;
254  case CPub::e_Sub:
255  if( GetSub().IsSetDescr() ) {
256  out_title.push_back(
258  GetSub().GetDescr()) );
259  }
260  break;
261  case CPub::e_Article:
262  if( GetArticle().IsSetTitle() && GetArticle().GetTitle().IsSet() ) {
263  xs_AppendTitles( out_title, iMaxToGet, GetArticle().GetTitle() );
264  }
265  break;
266  case CPub::e_Journal:
267  if( GetJournal().IsSetTitle() ) {
268  xs_AppendTitles( out_title, iMaxToGet, GetJournal().GetTitle() );
269  }
270  break;
271  case CPub::e_Book:
272  if( GetBook().IsSetTitle() ) {
273  xs_AppendTitles( out_title, iMaxToGet, GetBook().GetTitle() );
274  }
275  break;
276  case CPub::e_Proc:
277  // what to do here? It has a book and meeting
278  // It's not entirely clear if this is the best course of action
279  if( FIELD_CHAIN_OF_2_IS_SET(GetProc(), Book, Title) ) {
280  xs_AppendTitles( out_title, iMaxToGet,
281  GetProc().GetBook().GetTitle() );
282  }
283  break;
284  case CPub::e_Patent:
285  if( GetPatent().IsSetTitle() ) {
286  out_title.push_back(
288  GetPatent().GetTitle()) );
289  }
290  break;
291  case CPub::e_Man:
292  if( FIELD_CHAIN_OF_2_IS_SET(GetMan(), Cit, Title) ) {
293  xs_AppendTitles( out_title, iMaxToGet,
294  GetMan().GetCit().GetTitle() );
295  }
296  break;
297  case CPub::e_Equiv:
298  {
299  size_t iMaxTitleSizeAllowed = ( out_title.size() + iMaxToGet );
300  if( iMaxTitleSizeAllowed < out_title.size() ) {
301  // integer overflowed
302  iMaxTitleSizeAllowed =
304  }
306  if( out_title.size() >= iMaxTitleSizeAllowed ) {
307  break;
308  }
309 
310  // dig down recursively
311  (*pub_it)->GetTitles(out_title,
312  (iMaxTitleSizeAllowed - out_title.size()) );
313  }
314  }
315  break;
316  default:
317  NCBI_THROW(CException, eUnknown, "unhandled pub type");
318  }
319 }
320 
321 // static
323 CPub::xs_GetTitleFromPlainString(const string & sTitle)
324 {
325  CRef<CTitle::C_E> pRval( new CTitle::C_E );
326  pRval->SetName( sTitle );
327  return pRval;
328 }
329 
330 // static
332  size_t iMaxToGet,
333  const CTitle & in_title )
334 {
335  if( iMaxToGet <= 0 ) {
336  return;
337  }
338 
339  if( ! in_title.IsSet() ) {
340  return;
341  }
342 
343  size_t iNumCopiedSoFar = 0;
344  CTitle::Tdata::const_iterator src_it = in_title.Get().begin();
345  CTitle::Tdata::const_iterator src_it_end = in_title.Get().end();
346  for( ; src_it != src_it_end && iNumCopiedSoFar < iMaxToGet;
347  ++src_it, ++iNumCopiedSoFar)
348  {
349  out_title.push_back( *src_it );
350  }
351 }
352 
353 
354 typedef struct {
355  string country;
356  string number;
357  string app_number;
361 } SPubMatchInfo;
362 
363 
364 string s_GetTitleString(const CTitle::C_E& title)
365 {
366  string str;
367 
368  switch (title.Which()) {
369  case CTitle::C_E::e_Name:
370  str = title.GetName();
371  break;
372  case CTitle::C_E::e_Abr:
373  str = title.GetAbr();
374  break;
376  str = title.GetCoden();
377  break;
378  case CTitle::C_E::e_Isbn:
379  str = title.GetIsbn();
380  break;
382  str = title.GetIso_jta();
383  break;
384  case CTitle::C_E::e_Issn:
385  str = title.GetIssn();
386  break;
387  case CTitle::C_E::e_Jta:
388  str = title.GetJta();
389  break;
391  str = title.GetMl_jta();
392  break;
394  str = title.GetTrans();
395  break;
396  case CTitle::C_E::e_Tsub:
397  str = title.GetTsub();
398  break;
400  break;
401  }
402  return str;
403 }
404 
405 
406 bool s_TitleMatch(const CTitle& title1, const CTitle& title2, CTitle::C_E::E_Choice title_type)
407 {
408  string compare1;
409  string compare2;
410 
411  ITERATE(CTitle::Tdata, it, title1.Get()) {
412  if ((*it)->Which() == title_type) {
413  compare1 = s_GetTitleString(**it);
414  break;
415  }
416  }
417  ITERATE(CTitle::Tdata, it, title2.Get()) {
418  if ((*it)->Which() == title_type) {
419  compare2 = s_GetTitleString(**it);
420  break;
421  }
422  }
423  if (!NStr::IsBlank(compare1) && NStr::EqualNocase(compare1, compare2)) {
424  return true;
425  } else {
426  return false;
427  }
428 }
429 
430 
431 #define FIELD(Obj,Field) (Obj.IsSet##Field() ? Obj.Get##Field() : "")
432 #define FIELD_MATCH(Obj1,Obj2,Field) (NStr::EqualNocase(FIELD(Obj1,Field), FIELD(Obj2,Field)))
433 #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()))
434 
435 #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())))
436 #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())))
437 
438 bool s_MatchDate(const CDate& date1, const CDate& date2)
439 {
440  return date1.Equals(date2);
441 }
442 
443 
444 bool s_MatchImp(const CImprint& imp1, const CImprint& imp2)
445 {
446  if (!S_MATCH(imp1, imp2, Date)) {
447  return false;
448  }
449 
450  if (!FIELD_MATCH(imp1, imp2, Volume) ||
451  !FIELD_MATCH(imp1, imp2, Issue) ||
452  !FIELD_MATCH(imp1, imp2, Pages) ||
453  !FIELD_MATCH(imp1, imp2, Section) ||
454  !FIELD_MATCH(imp1, imp2, Part_sup) ||
455  !FIELD_MATCH(imp1, imp2, Language)) {
456  return false;
457  }
458 
459  if (imp1.IsSetCprt() && imp2.IsSetCprt() && !imp1.GetCprt().Equals(imp2.GetCprt())) {
460  return false;
461  }
462  return true;
463 }
464 
465 
466 // try to match one of these title types
475 };
476 
477 
478 bool s_MatchTitle(const CTitle& title1, const CTitle& title2)
479 {
480  bool match_title = false;
481 
482  for (size_t i = 0; !match_title && s_MatchJournalTypes[i] != CTitle::C_E::e_not_set; i++) {
483  match_title = s_TitleMatch(title1, title2, s_MatchJournalTypes[i]);
484  }
485 
486  return match_title;
487 }
488 
489 
490 bool s_JournalMatch(const CCit_jour& jour1, const CCit_jour& jour2)
491 {
492  // look for matching title
493  if (!S_MATCH(jour1, jour2, Title)) {
494  return false;
495  }
496 
497  return S_MATCH(jour1, jour2, Imp);
498 }
499 
500 
501 bool s_MatchBook(const CCit_book& book1, const CCit_book& book2)
502 {
503  if (!S_MATCH_A(book1, book2, Authors)) {
504  return false;
505  }
506 
507  if (!S_MATCH(book1, book2, Imp)) {
508  return false;
509  }
510 
511  if ((!book1.IsSetTitle() && book2.IsSetTitle()) ||
512  (book1.IsSetTitle() && !book2.IsSetTitle()) ||
513  !s_TitleMatch(book1.GetTitle(), book2.GetTitle(), CTitle::C_E::e_Name)) {
514  return false;
515  }
516 
517  return true;
518 }
519 
520 
521 bool s_ProcMatch(const CCit_proc& book1, const CCit_proc& book2)
522 {
523  return S_MATCH(book1, book2, Book);
524 }
525 
526 
527 bool s_ManMatch(const CCit_let& book1, const CCit_let& book2)
528 {
529  return ((!book1.IsSetCit() && !book2.IsSetCit()) ||
530  (book1.IsSetCit() && book2.IsSetCit() && s_MatchBook(book1.GetCit(), book2.GetCit())));
531 }
532 
533 
534 bool s_CitArtMatch(const CCit_art& art1, const CCit_art& art2)
535 {
536  if (!art1.IsSetFrom() || !art2.IsSetFrom()) {
537  return false;
538  }
539  if (art1.GetFrom().Which() != art2.GetFrom().Which()) {
540  return false;
541  }
542 
543  if (art1.GetFrom().IsJournal()) {
544  // make sure journals match
545  if (!s_JournalMatch(art1.GetFrom().GetJournal(), art2.GetFrom().GetJournal())) {
546  return false;
547  }
548  } else if (art1.GetFrom().IsBook()) {
549  // make sure books match
550  if (!s_MatchBook(art1.GetFrom().GetBook(), art2.GetFrom().GetBook())) {
551  return false;
552  }
553  } else if (art1.GetFrom().IsProc()) {
554  // make sure proceedings match
555  if (!s_ProcMatch(art1.GetFrom().GetProc(), art2.GetFrom().GetProc())) {
556  return false;
557  }
558  }
559 
560  if (!S_MATCH_A(art1, art2, Authors)) {
561  return false;
562  }
563 
564  if (!art1.IsSetTitle() && !art2.IsSetTitle()) {
565  // ok, no title for either
566  } else if (!art1.IsSetTitle() || !art2.IsSetTitle()) {
567  return false;
568  } else if (!s_TitleMatch(art1.GetTitle(), art2.GetTitle(), CTitle::C_E::e_Name)) {
569  return false;
570  }
571 
572  return true;
573 }
574 
575 
576 bool s_CitGenMatch(const CCit_gen& gen1, const CCit_gen& gen2)
577 {
578  if (!FIELD_MATCH(gen1, gen2, Volume) ||
579  !FIELD_MATCH(gen1, gen2, Issue) ||
580  !FIELD_MATCH(gen1, gen2, Pages) ||
581  !FIELD_MATCH(gen1, gen2, Title) ||
582  !FIELD_MATCH(gen1, gen2, Cit)) {
583  return false;
584  }
585  if (!S_MATCH_A(gen1, gen2, Authors)) {
586  return false;
587  }
588 
589  if (!INT_FIELD_MATCH(gen1, gen2, Muid) ||
590  !INT_FIELD_MATCH(gen1, gen2, Serial_number)) {
591  return false;
592  }
593 
594  if (!gen1.IsSetJournal() && !gen2.IsSetJournal()) {
595  // both empty, ok
596  } else if (!gen1.IsSetJournal() || !gen2.IsSetJournal()) {
597  return false;
598  } else if (!s_MatchTitle(gen1.GetJournal(), gen2.GetJournal())) {
599  return false;
600  }
601 
602  if (!S_MATCH(gen1, gen2, Date)) {
603  return false;
604  }
605 
606  return true;
607 
608 }
609 
610 
611 bool s_CitSubMatch(const CCit_sub& sub1, const CCit_sub& sub2)
612 {
613  if (!S_MATCH_A(sub1, sub2, Authors)) {
614  return false;
615  }
616 
617  bool rval = false;
618 
619  if (sub1.IsSetImp() && sub2.IsSetImp()) {
620  rval = s_MatchImp(sub1.GetImp(), sub2.GetImp());
621  } else {
622  // compare date from imprint or in sub
623  CConstRef<CDate> date1(NULL);
624  CConstRef<CDate> date2(NULL);
625  if (sub1.IsSetImp() && sub1.GetImp().IsSetDate()) {
626  date1.Reset(&(sub1.GetImp().GetDate()));
627  } else if (sub1.IsSetDate()) {
628  date1.Reset(&(sub1.GetDate()));
629  }
630  if (sub2.IsSetImp() && sub2.GetImp().IsSetDate()) {
631  date2.Reset(&(sub2.GetImp().GetDate()));
632  } else if (sub2.IsSetDate()) {
633  date2.Reset(&(sub2.GetDate()));
634  }
635  if (!date1 && !date2) {
636  rval = true;
637  } else if (!date1 || !date2) {
638  rval = false;
639  } else {
640  rval = date1->Equals(*date2);
641  }
642  }
643  return rval;
644 }
645 
646 
647 bool s_MatchInfoMatches(const SPubMatchInfo& match1, const SPubMatchInfo& match2)
648 {
649  if (match1.muid > ZERO_ENTREZ_ID && match2.muid > ZERO_ENTREZ_ID) {
650  if (match1.muid == match2.muid) {
651  return true;
652  }
653  }
654 
655  if (match1.pmid > ZERO_ENTREZ_ID && match2.pmid > ZERO_ENTREZ_ID) {
656  if (match1.pmid == match2.pmid) {
657  return true;
658  }
659  }
660 
661  if (!NStr::IsBlank(match1.country) && !NStr::IsBlank(match2.country)) {
662  if (NStr::EqualNocase(match1.country, match2.country) &&
663  NStr::EqualNocase(match1.number, match2.number) &&
664  NStr::EqualNocase(match1.app_number, match2.app_number)) {
665  return true;
666  }
667  }
668 
669  if (match1.art && match2.art) {
670  if (s_CitArtMatch(*(match1.art), *(match2.art))) {
671  return true;
672  }
673  }
674 
675  return false;
676 }
677 
678 
680 {
681  if (patent.IsSetCountry()) {
682  match.country = patent.GetCountry();
683  }
684  if (patent.IsSetNumber()) {
685  match.number = patent.GetNumber();
686  }
687  if (patent.IsSetApp_number()) {
688  match.app_number = patent.GetApp_number();
689  }
690 }
691 
692 
694 {
695  if (patent.IsSetCountry()) {
696  match.country = patent.GetCountry();
697  }
698  if (patent.IsSetId()) {
699  if (patent.GetId().IsNumber()) {
700  match.number = patent.GetId().GetNumber();
701  } else if (patent.GetId().IsApp_number()) {
702  match.app_number = patent.GetId().GetApp_number();
703  }
704  }
705 }
706 
707 
709 {
710  match.muid = ZERO_ENTREZ_ID;
711  match.pmid = ZERO_ENTREZ_ID;
712  match.country = "";
713  match.number = "";
714  match.app_number = "";
715 
716  switch (pub.Which()) {
717  case CPub::e_Pmid:
718  match.pmid = pub.GetPmid();
719  break;
720  case CPub::e_Muid:
721  match.muid = pub.GetMuid();
722  break;
723  case CPub::e_Patent:
725  break;
726  case CPub::e_Pat_id:
728  break;
729  case CPub::e_Article:
730  match.art = new CCit_art();
731  match.art->Assign(pub.GetArticle());
732  break;
733  default:
734  break;
735  }
736 }
737 
738 
739 bool CPub::SameCitation(const CPub& other) const
740 {
741  if (Which() == CPub::e_Equiv) {
742  if (other.Which() == CPub::e_Equiv) {
743  return GetEquiv().SameCitation(other.GetEquiv());
744  } else {
745  return GetEquiv().SameCitation(other);
746  }
747  }
748  SPubMatchInfo match1, match2;
749 
750  s_GetPubMatchInfo(*this, match1);
751  s_GetPubMatchInfo(other, match2);
752  if (s_MatchInfoMatches(match1, match2)) {
753  return true;
754  }
755  // false if different pub types
756  if (Which() != other.Which()) {
757  return false;
758  }
759 
760  bool rval = false;
761 
762  switch (Which()) {
763  case CPub::e_Gen:
764  rval = s_CitGenMatch(GetGen(), other.GetGen());
765  break;
766  case CPub::e_Sub:
767  rval = s_CitSubMatch(GetSub(), other.GetSub());
768  break;
769  case CPub::e_Journal:
770  rval = s_JournalMatch(GetJournal(), other.GetJournal());
771  break;
772  case CPub::e_Book:
773  rval = s_MatchBook(GetBook(), other.GetBook());
774  break;
775  case CPub::e_Proc:
776  rval = s_ProcMatch(GetProc(), other.GetProc());
777  break;
778  case CPub::e_Man:
779  rval = s_ManMatch(GetMan(), other.GetMan());
780  break;
781  default:
782  break;
783  }
784  return rval;
785 }
786 
787 
788 END_objects_SCOPE // namespace ncbi::objects::
789 
791 
792 /* 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:406
#define S_MATCH_A(Obj1, Obj2, Field)
Definition: Pub.cpp:436
bool s_CitArtMatch(const CCit_art &art1, const CCit_art &art2)
Definition: Pub.cpp:534
bool s_ManMatch(const CCit_let &book1, const CCit_let &book2)
Definition: Pub.cpp:527
bool s_ProcMatch(const CCit_proc &book1, const CCit_proc &book2)
Definition: Pub.cpp:521
#define FIELD_MATCH(Obj1, Obj2, Field)
Definition: Pub.cpp:432
bool s_MatchImp(const CImprint &imp1, const CImprint &imp2)
Definition: Pub.cpp:444
bool s_MatchTitle(const CTitle &title1, const CTitle &title2)
Definition: Pub.cpp:478
bool s_JournalMatch(const CCit_jour &jour1, const CCit_jour &jour2)
Definition: Pub.cpp:490
bool s_MatchBook(const CCit_book &book1, const CCit_book &book2)
Definition: Pub.cpp:501
bool s_MatchDate(const CDate &date1, const CDate &date2)
Definition: Pub.cpp:438
static const CTitle::C_E::E_Choice s_MatchJournalTypes[]
Definition: Pub.cpp:467
string s_GetTitleString(const CTitle::C_E &title)
Definition: Pub.cpp:364
void s_GetPubMatchInfo(const CCit_pat &patent, SPubMatchInfo &match)
Definition: Pub.cpp:679
#define INT_FIELD_MATCH(Obj1, Obj2, Field)
Definition: Pub.cpp:433
bool s_CitGenMatch(const CCit_gen &gen1, const CCit_gen &gen2)
Definition: Pub.cpp:576
bool s_MatchInfoMatches(const SPubMatchInfo &match1, const SPubMatchInfo &match2)
Definition: Pub.cpp:647
#define S_MATCH(Obj1, Obj2, Field)
Definition: Pub.cpp:435
bool s_CitSubMatch(const CCit_sub &sub1, const CCit_sub &sub2)
Definition: Pub.cpp:611
@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:331
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:178
CAuth_list & SetAuthors(void)
Definition: Pub.cpp:204
static TOneTitleRef xs_GetTitleFromPlainString(const string &sTitle)
Definition: Pub.cpp:323
bool SameCitation(const CPub &other) const
Definition: Pub.cpp:739
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:230
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
static const char * str(char *buf, int n)
Definition: stats.c:84
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:5353
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
TMedline & SetMedline(void)
Select the variant.
Definition: Pub_.cpp:217
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.
string country
Definition: Pub.cpp:355
string number
Definition: Pub.cpp:356
TEntrezId muid
Definition: Pub.cpp:358
TEntrezId pmid
Definition: Pub.cpp:359
CRef< CCit_art > art
Definition: Pub.cpp:360
string app_number
Definition: Pub.cpp:357
Definition: entry.h:13
Definition: type.c:6
Modified on Sun Apr 14 05:26:47 2024 by modify_doxy.py rev. 669887