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

Go to the SVN repository for this file.

1 /* $Id: memberid.cpp 72439 2016-05-09 11:30:33Z ivanov $
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: Eugene Vasilchenko
27 *
28 * File Description:
29 * !!! PUT YOUR DESCRIPTION HERE !!!
30 *
31 */
32 
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbistd.hpp>
35 #include <serial/impl/memberid.hpp>
37 
39 
41  : m_Tag(eNoExplicitTag),
42  m_TagClass(CAsnBinaryDefs::eContextSpecific),
43  m_TagType(CAsnBinaryDefs::eAutomatic),
44  m_TagConstructed(CAsnBinaryDefs::eConstructed),
45  m_NoPrefix(false), m_Attlist(false), m_Notag(false), m_AnyContent(false),
46  m_Compressed(false), m_Nillable(false), m_NsqMode(eNSQNotSet)
47 {
48 }
49 
50 CMemberId::CMemberId(TTag tag, bool /*explicitTag*/)
51  : m_Tag(tag),
52  m_TagClass(CAsnBinaryDefs::eContextSpecific),
53  m_TagType(CAsnBinaryDefs::eAutomatic),
54  m_TagConstructed(CAsnBinaryDefs::eConstructed),
55  m_NoPrefix(false), m_Attlist(false), m_Notag(false), m_AnyContent(false),
56  m_Compressed(false), m_Nillable(false), m_NsqMode(eNSQNotSet)
57 {
58 }
59 
60 CMemberId::CMemberId(const string& name)
61  : m_Name(name), m_Tag(eNoExplicitTag),
62  m_TagClass(CAsnBinaryDefs::eContextSpecific),
63  m_TagType(CAsnBinaryDefs::eAutomatic),
64  m_TagConstructed(CAsnBinaryDefs::eConstructed),
65  m_NoPrefix(false), m_Attlist(false), m_Notag(false), m_AnyContent(false),
66  m_Compressed(false), m_Nillable(false), m_NsqMode(eNSQNotSet)
67 {
68 }
69 
70 CMemberId::CMemberId(const string& name, TTag tag, bool /*explicitTag*/)
71  : m_Name(name), m_Tag(tag),
72  m_TagClass(CAsnBinaryDefs::eContextSpecific),
73  m_TagType(CAsnBinaryDefs::eAutomatic),
74  m_TagConstructed(CAsnBinaryDefs::eConstructed),
75  m_NoPrefix(false), m_Attlist(false), m_Notag(false), m_AnyContent(false),
76  m_Compressed(false), m_Nillable(false), m_NsqMode(eNSQNotSet)
77 {
78 }
79 
80 CMemberId::CMemberId(const char* name)
81  : m_Name(name), m_Tag(eNoExplicitTag),
82  m_TagClass(CAsnBinaryDefs::eContextSpecific),
83  m_TagType(CAsnBinaryDefs::eAutomatic),
84  m_TagConstructed(CAsnBinaryDefs::eConstructed),
85  m_NoPrefix(false), m_Attlist(false), m_Notag(false), m_AnyContent(false),
86  m_Compressed(false), m_Nillable(false), m_NsqMode(eNSQNotSet)
87 {
88  _ASSERT(name);
89 }
90 
91 CMemberId::CMemberId(const char* name, TTag tag, bool /*explicitTag*/)
92  : m_Name(name), m_Tag(tag),
93  m_TagClass(CAsnBinaryDefs::eContextSpecific),
94  m_TagType(CAsnBinaryDefs::eAutomatic),
95  m_TagConstructed(CAsnBinaryDefs::eConstructed),
96  m_NoPrefix(false), m_Attlist(false), m_Notag(false), m_AnyContent(false),
97  m_Compressed(false), m_Nillable(false), m_NsqMode(eNSQNotSet)
98 {
99  _ASSERT(name);
100 }
101 
103 {
104 }
105 
107 {
108  m_Tag = eParentTag;
111 }
112 
113 string CMemberId::ToString(void) const
114 {
115  if ( !m_Name.empty() )
116  return m_Name;
117  else
118  return '[' + NStr::IntToString(GetTag()) + ']';
119 }
120 
122 {
123  m_NoPrefix = true;
124 }
125 
127 {
128  m_Attlist = true;
129 }
130 
132 {
133  m_Notag = true;
134 }
135 
137 {
138  m_AnyContent = true;
139 }
140 
142 {
143  m_Compressed = true;
144 }
145 
147 {
148  m_Nillable = true;
149 }
150 bool CMemberId::IsNillable(void) const
151 {
152  return m_Nillable;
153 }
154 
155 void CMemberId::SetNsQualified(bool qualified)
156 {
157  m_NsqMode = qualified ? eNSQualified : eNSUnqualified;
158 }
159 
160 
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define false
Definition: bool.h:36
void SetAttlist(void)
Definition: memberid.cpp:126
CMemberId(void)
Definition: memberid.cpp:40
bool m_Notag
Definition: memberid.hpp:120
bool m_Attlist
Definition: memberid.hpp:119
void SetNoPrefix(void)
Definition: memberid.cpp:121
void SetAnyContent(void)
Definition: memberid.cpp:136
bool m_AnyContent
Definition: memberid.hpp:121
string m_Name
Definition: memberid.hpp:113
bool IsNillable(void) const
Definition: memberid.cpp:150
bool m_Nillable
Definition: memberid.hpp:123
bool m_Compressed
Definition: memberid.hpp:122
CAsnBinaryDefs::TLongTag TTag
Definition: memberid.hpp:54
void SetNotag(void)
Definition: memberid.cpp:131
CAsnBinaryDefs::ETagConstructed m_TagConstructed
Definition: memberid.hpp:117
void SetCompressed(void)
Definition: memberid.cpp:141
TTag GetTag(void) const
ENsQualifiedMode m_NsqMode
Definition: memberid.hpp:124
CAsnBinaryDefs::ETagClass m_TagClass
Definition: memberid.hpp:115
bool m_NoPrefix
Definition: memberid.hpp:118
void SetNsQualified(bool qualified)
Definition: memberid.cpp:155
~CMemberId(void)
Definition: memberid.cpp:102
TTag m_Tag
Definition: memberid.hpp:114
void SetNillable(void)
Definition: memberid.cpp:146
void SetParentTag(void)
Definition: memberid.cpp:106
string ToString(void) const
Definition: memberid.cpp:113
@ eParentTag
Definition: memberid.hpp:57
@ eNSQualified
Definition: serialdef.hpp:201
@ eNSQNotSet
Definition: serialdef.hpp:199
@ eNSUnqualified
Definition: serialdef.hpp:200
#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 string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
const char * tag
#define _ASSERT
Modified on Mon May 20 05:00:26 2024 by modify_doxy.py rev. 669887