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

Go to the SVN repository for this file.

1 /* $Id: Id_pat.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  * 'biblio.asn'.
35  */
36 
37 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
42 
43 // generated classes
44 
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 // destructor
51 {
52 }
53 
54 
55 bool CId_pat::Id_Match(const C_Id& id1, const C_Id& id2)
56 {
57  C_Id::E_Choice type1 = id1.Which();
58  C_Id::E_Choice type2 = id2.Which();
59 
60  if (type1 != type2)
61  return false;
62 
63  switch ( type1 ) {
64  case C_Id::e_Number:
65  return AStrEquiv(id1.GetNumber(), id2.GetNumber(), PNocase());
66  case C_Id::e_App_number:
67  return AStrEquiv(id1.GetApp_number(), id2.GetApp_number(), PNocase());
68  default:
69  return false;
70  }
71 }
72 
73 
74 // comparison function
75 bool CId_pat::Match(const CId_pat& idp2) const
76 {
77  return AStrEquiv(GetCountry(), idp2.GetCountry(), PNocase()) &&
78  Id_Match(GetId(), idp2.GetId());
79 }
80 
81 
83 {
84  return x_GetLabelV1(label, false, 0, 0, 0, 0, 0,
85  &GetCountry(), &GetSomeNumber());
86 }
87 
88 
90 {
91  // Not handled in asn2gnb5.c; another option might be to return false.
92  return GetLabelV1(label, flags);
93 }
94 
95 
96 const string& CId_pat::GetSomeNumber(void) const
97 {
98  switch (GetId().Which()) {
99  case C_Id::e_Number: return GetId().GetNumber();
100  case C_Id::e_App_number: return GetId().GetApp_number();
101  default: return kEmptyStr;
102  }
103 }
104 
105 END_objects_SCOPE // namespace ncbi::objects::
106 
108 
109 /* Original file checksum: lines: 61, chars: 1877, CRC32: 1b7c366f */
static bool Id_Match(const C_Id &id1, const C_Id &id2)
Definition: Id_pat.cpp:55
bool GetLabelV2(string *label, TLabelFlags flags) const override
Definition: Id_pat.cpp:89
~CId_pat(void)
Definition: Id_pat.cpp:50
bool GetLabelV1(string *label, TLabelFlags flags) const override
Definition: Id_pat.cpp:82
const string & GetSomeNumber(void) const
Definition: Id_pat.cpp:96
bool Match(const CId_pat &idp2) const
Definition: Id_pat.cpp:75
int TLabelFlags
binary OR of ELabelFlags
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)
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
#define kEmptyStr
Definition: ncbistr.hpp:123
bool AStrEquiv(const Arg1 &x, const Arg2 &y, Pred pr)
Check equivalence of arguments using predicate.
Definition: ncbistr.hpp:5036
static const char label[]
E_Choice Which(void) const
Which variant is currently selected.
Definition: Id_pat_.hpp:397
E_Choice
Choice variants.
Definition: Id_pat_.hpp:104
const TId & GetId(void) const
Get the Id member data.
Definition: Id_pat_.hpp:525
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 TCountry & GetCountry(void) const
Get the Country member data.
Definition: Id_pat_.hpp:478
@ e_App_number
Patent Doc Appl Number.
Definition: Id_pat_.hpp:107
@ e_Number
Patent Document Number.
Definition: Id_pat_.hpp:106
Modified on Wed Nov 29 02:17:09 2023 by modify_doxy.py rev. 669887