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

Go to the SVN repository for this file.

1 /* $Id: Pub_set.cpp 49240 2011-04-08 18:57:08Z ucko $
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 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
41 #include <objects/pub/Pub_set.hpp>
42 
43 // generated classes
44 
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 // destructor
51 {
52 }
53 
54 // Handles looping thru list of pub, medline, article, journal, book,
55 // proceeding, or patent, creating a label by concatenting labels
56 // for objects in the list
57 template <class T>
58 static bool s_GetLabel(string* label, const list<CRef<T> >& the_list,
61 {
62  bool first = true;
63  ITERATE(typename list<CRef<T> >, it, the_list) {
64  if (!first) {
65  *label += ",";
66  }
67  first &= !(*it)->GetLabel(label, flags, version);
68  }
69  return !first;
70 }
71 
72 // Determines the type of set and calls the appropriately instantiated
73 // s_GetLabel
75  ELabelVersion version) const
76 {
77  // Ensure label exists
78  if (!label) {
79  return false;
80  }
81 
82  switch (Which()) {
83  case e_Pub:
84  return s_GetLabel<CPub>(label, GetPub(), flags, version);
85  case e_Medline:
86  return s_GetLabel<CMedline_entry>(label, GetMedline(), flags, version);
87  case e_Article:
88  return s_GetLabel<CCit_art>(label, GetArticle(), flags, version);
89  case e_Journal:
90  return s_GetLabel<CCit_jour>(label, GetJournal(), flags, version);
91  case e_Book:
92  return s_GetLabel<CCit_book>(label, GetBook(), flags, version);
93  case e_Proc:
94  return s_GetLabel<CCit_proc>(label, GetProc(), flags, version);
95  case e_Patent:
96  return s_GetLabel<CCit_pat>(label, GetPatent(), flags, version);
97  default:
98  return false;
99  }
100 }
101 
102 END_objects_SCOPE // namespace ncbi::objects::
103 
105 
106 /* Original file checksum: lines: 61, chars: 1874, CRC32: 8b72a069 */
static bool s_GetLabel(string *label, const list< CRef< T > > &the_list, CPub_set::TLabelFlags flags, CPub_set::ELabelVersion version)
Definition: Pub_set.cpp:58
bool GetLabel(string *label, TLabelFlags flags=0, ELabelVersion version=eLabel_DefaultVersion) const override
Get a label that is the concatenation of the pub labels for the pubs in the set.
Definition: Pub_set.cpp:74
~CPub_set(void)
Definition: Pub_set.cpp:50
int TLabelFlags
binary OR of ELabelFlags
static uch flags
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static const char label[]
E_Choice Which(void) const
Which variant is currently selected.
Definition: Pub_set_.hpp:351
const TArticle & GetArticle(void) const
Get the variant data.
Definition: Pub_set_.hpp:426
const TBook & GetBook(void) const
Get the variant data.
Definition: Pub_set_.hpp:466
const TMedline & GetMedline(void) const
Get the variant data.
Definition: Pub_set_.hpp:406
const TPub & GetPub(void) const
Get the variant data.
Definition: Pub_set_.hpp:386
const TJournal & GetJournal(void) const
Get the variant data.
Definition: Pub_set_.hpp:446
const TPatent & GetPatent(void) const
Get the variant data.
Definition: Pub_set_.hpp:506
const TProc & GetProc(void) const
Get the variant data.
Definition: Pub_set_.hpp:486
@ e_Proc
proceedings of a meeting
Definition: Pub_set_.hpp:103
static int version
Definition: mdb_load.c:29
Modified on Sat Dec 02 09:19:58 2023 by modify_doxy.py rev. 669887