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

Go to the SVN repository for this file.

1 /* $Id: Cit_sub.cpp 63908 2014-08-04 18:03:35Z 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 data definition file
34  * 'biblio.asn'.
35  */
36 
37 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
42 #include <objects/general/Date.hpp>
43 
44 // generated classes
45 
47 
48 BEGIN_objects_SCOPE // namespace ncbi::objects::
49 
50 // destructor
52 {
53 }
54 
55 
57 {
58  string date;
59  if ( IsSetDate() ) {
60  GetDate().GetDate(&date, "%{%M-%D-%}%Y");
61  }
62  return x_GetLabelV1(label, (flags & fLabel_Unique) != 0, &GetAuthors(),
63  IsSetImp() ? &GetImp() : 0,
64  0, 0, 0, 0, 0, 0, IsSetDate() ? &date : 0);
65 }
66 
67 
68 // Based on FormatCitSub from the C Toolkit's api/asn2gnb5.c.
70 {
71  static const char* kToINSD = " to the EMBL/GenBank/DDBJ databases.";
72 
74 
75  string date;
76  if (CanGetDate()) {
77  GetDate().GetDate(&date, "%{%2D%|\?\?%}-%{%3N%|\?\?%}-%4Y");
78  NStr::ToUpper(date);
79  }
80  if ( !HasText(date) ) {
81  date = "\?\?-\?\?\?-\?\?\?\?";
82  }
83  *label += "Submitted (" + date + ')';
84 
85  if (GetAuthors().CanGetAffil()) {
86  string affil;
88  if ((flags & fLabel_FlatEMBL) != 0
89  && !NStr::StartsWith(affil, kToINSD)) {
90  *label += kToINSD;
91  *label += '\n';
92  } else {
93  *label += ' ';
94  }
95  *label += affil;
96  } else if ((flags & fLabel_FlatEMBL) != 0) {
97  *label += kToINSD;
98  *label += '\n';
99  }
100 
101  return true;
102 }
103 
104 
105 END_objects_SCOPE // namespace ncbi::objects::
106 
108 
109 /* Original file checksum: lines: 64, chars: 1875, CRC32: ed1dd5e3 */
~CCit_sub(void)
Definition: Cit_sub.cpp:51
bool GetLabelV1(string *label, TLabelFlags flags) const override
Definition: Cit_sub.cpp:56
bool GetLabelV2(string *label, TLabelFlags flags) const override
Definition: Cit_sub.cpp:69
void GetDate(string *label, bool year_only=false) const
Append a standardized string representation of the date to the label.
Definition: Date.hpp:149
@ eLabel_V2
New implementation, in line with GenBank/GenPept REFERENCE JOURNAL fields and the like.
int TLabelFlags
binary OR of ELabelFlags
@ fLabel_FlatEMBL
For EMBL or EMBLPept [V2].
@ fLabel_Unique
Append a unique tag [V1].
static bool HasText(const string &s)
static bool x_GetLabelV1(string *label, bool unique, const CAuth_list *authors, const CImprint *imprint, const CTitle *title, const CCit_book *book, const CCit_jour *journal, const string *title1=0, const string *title2=0, const string *titleunique=0, const string *date=0, const string *volume=0, const string *issue=0, const string *pages=0, bool unpublished=false)
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 void MaybeAddSpace(string *label)
static uch flags
#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 StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:424
static const char label[]
const TDate & GetDate(void) const
Get the Date member data.
Definition: Cit_sub_.hpp:455
const TAffil & GetAffil(void) const
Get the Affil member data.
Definition: Auth_list_.hpp:510
bool CanGetDate(void) const
Check if it is safe to call GetDate method.
Definition: Cit_sub_.hpp:449
const TAuthors & GetAuthors(void) const
Get the Authors member data.
Definition: Cit_sub_.hpp:357
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
const TImp & GetImp(void) const
Get the Imp member data.
Definition: Cit_sub_.hpp:387
bool IsSetImp(void) const
this only used to get date.
Definition: Cit_sub_.hpp:375
Modified on Mon Apr 22 04:00:58 2024 by modify_doxy.py rev. 669887