=
"Row reader context: ";
128 context+=
"Last read line position in the stream: "+
130 "Last read line number: "+
134 context+=
"Position in the stream: "+
136 "No lines read yet; ";
142 context+=
"Raw line data are not available; ";
145 context+=
"Stream has reached end";
147 context+=
"Stream has not reached end yet";
162 boollines_already_read,
165 boolraw_data_available,
166 const string& raw_data,
248 return "eUnexpectedRowType";
250 return "eStreamFailure";
252 return "eFieldNoNotFound";
254 return "eDereferencingEndIterator";
256 return "eAdvancingEndIterator";
258 return "eDereferencingNoDataIterator";
260 return "eFileNotFound";
262 return "eNoReadPermissions";
264 return "eInvalidAction";
266 return "eLineProcessing";
268 return "eEndIteratorRowAccess";
270 return "eFieldNoOutOfRange";
272 return "eFieldAccess";
274 return "eFieldNameNotFound";
276 return "eFieldMetaInfoAccess";
278 return "eFieldConvert";
280 return "eNullField";
282 return "eValidating";
284 return "eNonEndIteratorCompare";
286 return "eIteratorWhileValidating";
288 return "eRowDataReading";
290 return "eTraitsOnEvent";
292 return "eFieldValueValidation";
294 return "eInvalidStream";
305 out<<
"No context available";
392 "Unexpected action to convert to a row type",
401 if( !
file.Exists() )
403 "File "+ sourcename +
" is not found",
407 "No read permissions for file "+ sourcename,
415converted =
CTime(
string(str_value.
data(), str_value.
size()));
433converted = str_value;
438 template<
typename T,
449eFieldConvert,
"Cannot convert field value '"+
450 string(str_value.
data(), str_value.
size()) +
451 "' to "+
typeid(
T).name(),
nullptr);
452}
catch(
constexception& exc) {
454 "Cannot convert field value '"+
455 string(str_value.
data(), str_value.
size()) +
456 "' to "+
typeid(
T).name() +
": "+
457exc.
what(),
nullptr);
460 "Unknown error while converting field value '"+
461 string(str_value.
data(), str_value.
size()) +
462 "' to "+
typeid(
T).name(),
nullptr);
469 const string& props)
472 switch(field_type) {
486 Uint8converted_uint8;
508 "Error validating field value '"+
509 string(str_value.
data(), str_value.
size()) +
513}
catch(
constexception& exc) {
515 "Error validating field value '"+
516 string(str_value.
data(), str_value.
size()) +
519 ": "+ exc.
what(),
nullptr);
522 "Unknown error while validating field value '"+
523 string(str_value.
data(), str_value.
size()) +
532 template<
typenameTTraits>
549 for(
size_tk = 0; k < other.
m_FieldsInfo.size(); ++k) {
570 for(
size_tindex = 0; index <
m_FieldsInfo.size(); ++index) {
607 m_FieldsInfo[field].m_FieldName = &inserted.first->first;
654 "Unknown field name '"+ field +
"'",
nullptr);
661 for(
size_tindex = 0; index <
m_FieldsInfo.size(); ++index)
670 const string* name_ptr =
m_FieldsInfo[field].m_FieldName;
671 size_tuse_count = 0;
690 friend class CRR_Row<TTraits>;
773 #define RR_TRAITS_PARENT_STREAM(TTraits) \ 776 typedef CRowReader<TTraits> TStreamType; \ 778 TStreamType& GetMyStream(void) const { return *m_MyStream; } \ 780 friend TStreamType; \ 782 void x_SetMyStream(TStreamType* my_stream) { m_MyStream = my_stream; } \ 783 TStreamType* m_MyStreamIncapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
The class represents the current delimited row stream context.
virtual string Serialize() const
virtual CRR_Context * Clone(void) const
string m_SourceName
Name of the data source, such as:
TStreamPos m_CurrentLinePos
CRR_Context(const string &sourcename, bool lines_already_read, TLineNo line_no, TStreamPos current_line_pos, bool raw_data_available, const string &raw_data, bool reached_end)
Represents one row from an input stream.
static void GetFieldValueConverted(const CTempString &str_value, CTime &converted)
static void GetFieldValueConverted(const CTempString &str_value, T &converted)
static void GetFieldValueConverted(const CTempString &str_value, CTempString &converted)
static string ERR_EventToString(ERR_Event event)
static void GetFieldValueConverted(const CTempString &str_value, string &converted)
static void GetFieldValueConverted(const CTempString &str_value, bool &converted)
static void CheckExistanceAndPermissions(const string &sourcename)
static ERR_RowType ActionToRowType(ERR_Action action)
static string ERR_ActionToString(ERR_Action action)
static void ValidateBasicTypeFieldValue(const CTempString &str_value, ERR_FieldType field_type, const string &props)
static string ERR_FieldTypeToString(ERR_FieldType type)
Exception to be used throughout API.
virtual CRowReaderException(const CDiagCompileInfo &info, const CException *prev_exception, EErrCode err_code, const string &message, CRR_Context *ctxt, EDiagSev severity=eDiag_Error) const char GetErrCodeString)(void) const override
virtual void ReportExtra(ostream &out) const override
Report "non-standard" attributes.
virtual void x_Assign(const CException &src) override
Helper method for copying exception data.
@ eIteratorWhileValidating
@ eDereferencingEndIterator
@ eDereferencingNoDataIterator
void SetContext(CRR_Context *ctxt)
unique_ptr< CRR_Context > m_Context
CRR_Context * GetContext(void) const
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
const_iterator end() const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
std::ofstream out("events_result.xml")
main entry point for tests
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
TErrCode GetErrCode(void) const
Get error code.
virtual void x_Assign(const CException &src)
Helper method for copying exception data.
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
EErrCode
Error types that an application can generate.
#define NCBI_RETHROW2(prev_exception, exception_class, err_code, message, extra)
Re-throw exception with extra parameter.
#define NCBI_EXCEPTION_DEFAULT_IMPLEMENTATION(exception_class, base_class)
Helper macro for default exception implementation.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static bool StringToBool(const CTempString str)
Convert string to bool.
static TNumeric StringToNumeric(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to a numeric value.
const char * data(void) const
Return a pointer to the array represented.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
size_type size(void) const
Return the length of the represented array.
const GenericPointer< typename T::ValueType > T2 value
Uint4 TFieldNo
Field number (zero based)
@ eRR_Metadata
row contains metadata
@ eRR_Invalid
row is invalid
@ eRR_Data
row contains data
@ eRR_Comment
row contains a comment
Uint8 TLineNo
Line number (in the data stream, zero based)
Uint8 TStreamPos
Position in the data stream (zero based)
ERR_FieldType
Basic field data types.
ERR_TranslationResult
The Translate() callback result. It is used to translate field values.
@ eRR_UseOriginal
No translation done.
@ eRR_Translated
The value has been translated to another string.
@ eRR_Null
The value has been translated to NULL.
ERR_Action
Delimited stream traits use the ERR_Action members to instruct what should be done next.
@ eRR_Continue_Data
Continue processing this line, in full.
@ eRR_Interrupt
Stop processing the stream.
@ eRR_Skip
Skip this line.
@ eRR_Continue_Metadata
Continue processing this line but skip Tokenize() and Translate()
@ eRR_Continue_Invalid
Continue processing this line but skip Tokenize() and Translate()
@ eRR_Continue_Comment
Continue processing this line but skip Tokenize() and Translate()
ERR_TraitsFlags
Miscellaneous trait-specific flags It is used when a row stream should be built on a file.
@ fRR_OpenFile_AsBinary
open file in a binary mode
@ fRR_Default
open file in a text mode
ERR_EventAction
How to react to the potentially disruptive events.
@ eRR_EventAction_Continue
Resume processing.
@ eRR_EventAction_Stop
Stop further processing.
@ eRR_EventAction_Default
Do some default action.
int TTraitsFlags
Bit-wise OR of ERR_TraitsFlags.
ERR_EventMode
Indicate whether the "ERR_Event" event (passed to the OnEvent() callback) occured during regular read...
@ eRR_EventMode_Validating
We are performing data validation.
@ eRR_EventMode_Iterating
We are iterating through the rows.
ERR_Event
CRowReader passes such events to the Traits via OnEvent() callback.
@ eRR_Event_SourceEnd
Data source has hit EOF.
@ eRR_Event_SourceBegin
Data source has started or been switched (no reads yet though).
@ eRR_Event_SourceError
Data source has hit an error on read.
SRR_SourceInfo(CNcbiIstream *s, const string &sourcename, bool owner)
static CS_CONTEXT * context
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4