1 /* $Id: Title.cpp 272610 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
47 BEGIN_NCBI_SCOPE
48
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50
51 // destructor
~CTitle(void)52 CTitle::~CTitle(void)
53 {
54 }
55
GetTitle(C_E::E_Choice type) const56 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 }
68 NCBI_THROW(CException, eUnknown,
69 "No title of requested type " + C_E::SelectionName(type));
70 }
71 }
72
73
GetTitle(const C_E & t)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:
88 NCBI_THROW(CException, eUnknown,
89 "Unsupported title type" + C_E::SelectionName(t.Which()));
90 }
91 }
92
93 END_objects_SCOPE // namespace ncbi::objects::
94
95 END_NCBI_SCOPE
96
97 /* Original file checksum: lines: 61, chars: 1874, CRC32: f44f543e */
98