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

Go to the SVN repository for this file.

1 /* $Id: line_error.cpp 93579 2021-05-01 20:54:52Z stakhovv $
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 * Authors: Aaron Ucko, NCBI
27 *
28 * File Description:
29 * Basic reader interface
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 
37 
40 
41 // static
43  EProblem eProblem,
44  EDiagSev eSeverity,
45  const std::string& strSeqId,
46  unsigned int uLine,
47  const std::string & strFeatureName,
48  const std::string & strQualifierName,
49  const std::string & strQualifierValue,
50  const std::string & strErrorMessage,
51  const TVecOfLines & vecOfOtherLines)
52 {
53  // this triggers a deprecated-call warning, which should disappear
54  // once the constructors become protected instead of deprecated.
55  return new CLineError(
56  eProblem,
57  eSeverity,
58  strSeqId,
59  uLine,
60  strFeatureName,
61  strQualifierName,
62  strQualifierValue,
63  strErrorMessage,
64  vecOfOtherLines);
65 }
66 
67 void
68 CLineError::Throw(void) const {
69  // this triggers a deprecated-call warning, which should disappear
70  // once the constructors become protected instead of deprecated.
71  throw *this;
72 }
73 
75  EProblem eProblem,
76  EDiagSev eSeverity,
77  const std::string& strSeqId,
78  unsigned int uLine,
79  const std::string & strFeatureName,
80  const std::string & strQualifierName,
81  const std::string & strQualifierValue,
82  const std::string & strErrorMessage,
83  const TVecOfLines & vecOfOtherLines )
84  : m_eProblem(eProblem), m_eSeverity( eSeverity ), m_strSeqId(strSeqId), m_uLine( uLine ),
85  m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName),
86  m_strQualifierValue(strQualifierValue), m_strErrorMessage(strErrorMessage),
87  m_vecOfOtherLines(vecOfOtherLines)
88 { }
89 
91 m_eProblem(rhs.m_eProblem), m_eSeverity(rhs.m_eSeverity ), m_strSeqId(rhs.m_strSeqId), m_uLine(rhs.m_uLine ),
92  m_strFeatureName(rhs.m_strFeatureName), m_strQualifierName(rhs.m_strQualifierName),
93  m_strQualifierValue(rhs.m_strQualifierValue), m_strErrorMessage(rhs.m_strErrorMessage),
94  m_vecOfOtherLines(rhs.m_vecOfOtherLines)
95 { }
96 
98 {
99  return new CLineError(*this);
100 }
101 
102 
104  EProblem eProblem,
105  EDiagSev eSeverity,
106  int code,
107  int subcode,
108  const std::string& strSeqId,
109  unsigned int uLine,
110  const std::string & strErrorMessage,
111  const std::string & strFeatureName,
112  const std::string & strQualifierName,
113  const std::string & strQualifierValue,
114  const TVecOfLines & vecOfOtherLines)
115 {
116  // this triggers a deprecated-call warning, which should disappear
117  // once the constructors become protected instead of deprecated.
118  return new CLineErrorEx(
119  eProblem,
120  eSeverity,
121  code,
122  subcode,
123  strSeqId,
124  uLine,
125  strErrorMessage,
126  strFeatureName,
127  strQualifierName,
128  strQualifierValue,
129  vecOfOtherLines);
130 }
131 
132 
133 void
134 CLineErrorEx::Throw(void) const {
135  // this triggers a deprecated-call warning, which should disappear
136  // once the constructors become protected instead of deprecated.
137  throw *this;
138 }
139 
140 
142  EProblem eProblem,
143  EDiagSev eSeverity,
144  int code,
145  int subcode,
146  const std::string& strSeqId,
147  unsigned int uLine,
148  const std::string & strErrorMessage,
149  const std::string & strFeatureName,
150  const std::string & strQualifierName,
151  const std::string & strQualifierValue,
152  const TVecOfLines & vecOfOtherLines )
153  : m_eProblem(eProblem), m_eSeverity( eSeverity ),
154  m_Code(code), m_Subcode(subcode),
155  m_strSeqId(strSeqId), m_uLine( uLine ),
156  m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName),
157  m_strQualifierValue(strQualifierValue),
158  m_strErrorMessage(strErrorMessage),
159  m_vecOfOtherLines(vecOfOtherLines)
160 { }
161 
162 
164  CLineErrorEx(rhs.m_eProblem,
165  rhs.m_eSeverity,
166  rhs.m_Code,
167  rhs.m_Subcode,
168  rhs.m_strSeqId,
169  rhs.m_uLine,
170  rhs.m_strErrorMessage,
171  rhs.m_strFeatureName,
172  rhs.m_strQualifierName,
173  rhs.m_strQualifierValue,
174  rhs.m_vecOfOtherLines)
175 {}
176 
177 /*
178 m_eProblem(rhs.m_eProblem), m_eSeverity(rhs.m_eSeverity ), m_strSeqId(rhs.m_strSeqId), m_uLine(rhs.m_uLine ),
179  m_strFeatureName(rhs.m_strFeatureName), m_strQualifierName(rhs.m_strQualifierName),
180  m_strQualifierValue(rhs.m_strQualifierValue), m_strErrorMessage(rhs.m_strErrorMessage),
181  m_vecOfOtherLines(rhs.m_vecOfOtherLines)
182 { }
183 
184 */
185 
187 {
188  return new CLineErrorEx(*this);
189 }
190 
191 
192 
195  EDiagSev eSeverity,
196  unsigned int uLine,
197  const std::string &strMessage,
198  EProblem eProblem,
199  const std::string& strSeqId,
200  const std::string & strFeatureName,
201  const std::string & strQualifierName,
202  const std::string & strQualifierValue,
204  const TVecOfLines & vecOfOtherLines
205  )
206 {
207  // this triggers a deprecated-call warning, which should disappear
208  // once the constructors become protected instead of deprecated.
209  return new CObjReaderLineException(
210  eSeverity, uLine, strMessage, eProblem,
211  strSeqId, strFeatureName, strQualifierName, strQualifierValue,
212  eErrCode, vecOfOtherLines );
213 }
214 
216 {
217  return new CObjReaderLineException(*this);
218 }
219 
220 void
222  // this triggers a deprecated-call warning, which should disappear
223  // once the constructors become protected instead of deprecated.
224  throw *this;
225 }
226 
228  EDiagSev eSeverity,
229  unsigned int uLine,
230  const std::string &strMessage,
231  EProblem eProblem,
232  const std::string& strSeqId,
233  const std::string & strFeatureName,
234  const std::string & strQualifierName,
235  const std::string & strQualifierValue,
237  const TVecOfLines & vecOfOtherLines
238  )
239  : CObjReaderParseException( DIAG_COMPILE_INFO, 0, static_cast<CObjReaderParseException::EErrCode>(CException::eInvalid), strMessage, uLine,
240  eDiag_Info ),
241  m_eProblem(eProblem), m_strSeqId(strSeqId), m_uLineNumber(uLine),
242  m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName),
243  m_strQualifierValue(strQualifierValue), m_strErrorMessage(strMessage),
244  m_vecOfOtherLines(vecOfOtherLines)
245 {
246  SetSeverity( eSeverity );
247  x_InitErrCode(static_cast<CException::EErrCode>(eErrCode));
248 }
249 
252  m_eProblem(rhs.Problem()), m_strSeqId(rhs.SeqId()), m_uLineNumber(rhs.Line()),
253  m_strFeatureName(rhs.FeatureName()), m_strQualifierName(rhs.QualifierName()),
254  m_strQualifierValue(rhs.QualifierValue()), m_strErrorMessage(rhs.ErrorMessage()),
255  m_vecOfOtherLines(rhs.m_vecOfOtherLines)
256 {
257  SetSeverity( rhs.Severity() );
258  x_InitErrCode(static_cast<CException::EErrCode>(rhs.x_GetErrCode()));
259 }
260 
261 // this is here because of an apparent compiler bug
264 {
265  if (!m_strErrorMessage.empty()) {
266  return m_strErrorMessage;
267  }
268  return ILineError::ProblemStr();
269 }
270 
273 
void Throw(void) const
copy constructor is protected so please use this function to throw the object.
Definition: line_error.cpp:134
static CLineErrorEx * Create(EProblem eProblem, EDiagSev eSeverity, int code, int subcode, const std::string &strSeqId, unsigned int uLine, const std::string &strErrorMessage=string(""), const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), const TVecOfLines &vecOfOtherLines=TVecOfLines())
Use this because the constructor is protected.
Definition: line_error.cpp:103
virtual ILineError * Clone(void) const override
Use this because copy ctor is protected.
Definition: line_error.cpp:186
CLineErrorEx(EProblem eProblem, EDiagSev eSeverity, int code, int subcode, const std::string &strSeqId, unsigned int uLine, const std::string &strErrorMessage, const std::string &strFeatureName, const std::string &strQualifierName, const std::string &strQualifierValue, const TVecOfLines &m_vecOfOtherLine)
protected instead of public. Please use the Create function instead.
Definition: line_error.cpp:141
CLineError(EProblem eProblem, EDiagSev eSeverity, const std::string &strSeqId, unsigned int uLine, const std::string &strFeatureName, const std::string &strQualifierName, const std::string &strQualifierValue, const std::string &strErrorMessage, const TVecOfLines &m_vecOfOtherLine)
protected instead of public. Please use the Create function instead.
Definition: line_error.cpp:74
void Throw(void) const
copy constructor is protected so please use this function to throw the object.
Definition: line_error.cpp:68
virtual ILineError * Clone(void) const
Use this because copy ctor is protected.
Definition: line_error.cpp:97
std::string ProblemStr() const
Definition: line_error.cpp:263
CObjReaderLineException(EDiagSev eSeverity, unsigned int uLine, const std::string &strMessage, EProblem eProblem=eProblem_GeneralParsingError, const std::string &strSeqId=string(""), const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), CObjReaderLineException::EErrCode eErrCode=eFormat, const TVecOfLines &vecOfOtherLines=TVecOfLines())
protected instead of public. Please use the Create function instead.
Definition: line_error.cpp:227
EDiagSev Severity(void) const
Definition: line_error.hpp:653
virtual ILineError * Clone(void) const
Use instead of copy constructor, which is protected.
Definition: line_error.cpp:215
void Throw(void) const
this function to throw this object.
Definition: line_error.cpp:221
static CObjReaderLineException * Create(EDiagSev eSeverity, unsigned int uLine, const std::string &strMessage, EProblem eProblem=eProblem_GeneralParsingError, const std::string &strSeqId=string(""), const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), CObjReaderLineException::EErrCode eErrCode=eFormat, const TVecOfLines &vecOfOtherLines=TVecOfLines())
Please use this instead of the constructor because the ctor is protected.
Definition: line_error.cpp:194
std::string m_strErrorMessage
Definition: line_error.hpp:689
vector< unsigned int > TVecOfLines
Definition: line_error.hpp:128
virtual std::string ProblemStr(void) const
Definition: line_error.hpp:180
Definition: svg.hpp:432
string
Definition: cgiapp.hpp:687
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
@ eDiag_Info
Informational message.
Definition: ncbidiag.hpp:651
EErrCode
Error types that an application can generate.
Definition: ncbiexpt.hpp:884
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
Definition: inftrees.h:24
#define const
Definition: zconf.h:232
Modified on Sun Apr 14 05:26:07 2024 by modify_doxy.py rev. 669887