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

Go to the SVN repository for this file.

1 /* $Id: Title.cpp 49239 2011-04-08 18:53:18Z 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  * 'biblio.asn'.
35  */
36 
37 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
41 #include <objects/biblio/Title.hpp>
42 
43 #include <corelib/ncbiexpt.hpp>
44 
45 // generated classes
46 
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 // destructor
53 {
54 }
55 
56 const string& CTitle::GetTitle(C_E::E_Choice type) const
57 {
58  if (Get().empty()) {
59  NCBI_THROW(CException, eUnknown, "Title not set");
60  } else if (type == C_E::e_not_set) {
61  return GetTitle(*Get().front());
62  } else {
63  ITERATE (Tdata, it, Get()) {
64  if ((*it)->Which() == type) {
65  return GetTitle(**it);
66  }
67  }
69  "No title of requested type " + C_E::SelectionName(type));
70  }
71 }
72 
73 
74 const string& CTitle::GetTitle(const C_E& t)
75 {
76  switch (t.Which()) {
77  case C_E::e_Name: return t.GetName();
78  case C_E::e_Tsub: return t.GetTsub();
79  case C_E::e_Trans: return t.GetTrans();
80  case C_E::e_Jta: return t.GetJta();
81  case C_E::e_Iso_jta: return t.GetIso_jta();
82  case C_E::e_Ml_jta: return t.GetMl_jta();
83  case C_E::e_Coden: return t.GetCoden();
84  case C_E::e_Issn: return t.GetIssn();
85  case C_E::e_Abr: return t.GetAbr();
86  case C_E::e_Isbn: return t.GetIsbn();
87  default:
89  "Unsupported title type" + C_E::SelectionName(t.Which()));
90  }
91 }
92 
93 END_objects_SCOPE // namespace ncbi::objects::
94 
96 
97 /* Original file checksum: lines: 61, chars: 1874, CRC32: f44f543e */
C_E –.
Definition: Title_.hpp:96
~CTitle(void)
Definition: Title.cpp:52
const string & GetTitle(C_E::E_Choice type=C_E::e_not_set) const
If the internal list contains a title (of the specified type, if given), returns the corresponding st...
Definition: Title.cpp:56
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#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
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
list< CRef< C_E > > Tdata
Definition: Title_.hpp:477
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Title_.cpp:112
const Tdata & Get(void) const
Get the member data.
Definition: Title_.hpp:781
@ 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
constexpr auto front(list< Head, As... >, T=T()) noexcept -> Head
constexpr bool empty(list< Ts... >) noexcept
EIPRangeType t
Definition: ncbi_localip.c:101
Defines NCBI C++ exception handling.
Definition: type.c:6
Modified on Sat Apr 13 11:48:51 2024 by modify_doxy.py rev. 669887