NCBI C++ ToolKit
|
Search Toolkit Book for CTabDelimitedValidator
#include "tab_table_reader.hpp"
(Private to src/app/tableval
.)
Public Types | |
enum | e_Flags { e_tab_tab_delim = 1 , e_tab_comma_delim = 2 , e_tab_noheader = 4 , e_tab_ignore_empty_rows = 8 , e_tab_xml_report = 16 , e_tab_tab_report = 32 , e_tab_text_report = 16+32 , e_tab_html_report = 64 , e_tab_ignore_unknown_types = 128 } |
Public Member Functions | |
CTabDelimitedValidator (e_Flags flags=e_tab_tab_delim) | |
void | ValidateInput (ILineReader &reader, const string &default_columns, const string &required, const string &ignored, const string &unique, const string &discouraged, const vector< string > &require_one) |
void | GenerateOutput (CNcbiOstream *out_stream, bool no_headers) |
Static Public Member Functions | |
static void | RegisterAliases (CNcbiIstream *in_stream) |
Private Member Functions | |
bool | _Validate (int col_number, const CTempString &value) |
void | _OperateRows (ILineReader &reader) |
bool | _ProcessHeader (ILineReader &reader, const CTempString &default_cols) |
bool | _CheckHeader (const string &discouraged, const vector< string > &require_one) |
bool | _MakeColumns (const string &message, const CTempString &columns, vector< bool > &col_defs) |
void | _ReportError (int col_number, const CTempString &error, const CTempString &colname, bool warning=false) |
void | _ReportWarning (int col_number, const CTempString &error, const CTempString &colname) |
void | _ReportTab (CNcbiOstream *out_stream) |
void | _ReportXML (CNcbiOstream *out_stream, bool no_headers) |
Private Attributes | |
int | m_current_row_number |
CTempString | m_delim |
vector< string > | m_col_defs |
vector< bool > | m_required_cols |
vector< bool > | m_ignored_cols |
vector< bool > | m_unique_cols |
vector< set< string > > | m_require_one_cols |
vector< map< string, int > > | m_unique_values |
list< CTabDelimitedValidatorMessage > | m_errors |
e_Flags | m_flags |
Definition at line 31 of file tab_table_reader.hpp.
Enumerator | |
---|---|
e_tab_tab_delim | |
e_tab_comma_delim | |
e_tab_noheader | |
e_tab_ignore_empty_rows | |
e_tab_xml_report | |
e_tab_tab_report | |
e_tab_text_report | |
e_tab_html_report | |
e_tab_ignore_unknown_types |
Definition at line 34 of file tab_table_reader.hpp.
|
inline |
Definition at line 49 of file tab_table_reader.hpp.
|
private |
Definition at line 80 of file tab_table_reader.cpp.
References _ReportError(), set< Key, Compare >::insert(), CColumnValidator::IsDiscouraged(), ITERATE, m_col_defs, m_ignored_cols, m_require_one_cols, and NStr::Split().
Referenced by ValidateInput().
|
private |
Definition at line 227 of file tab_table_reader.cpp.
References _ReportError(), columns, NStr::fConvErr_NoThrow, i, m_col_defs, names, NStr::Split(), and NStr::StringToInt().
Referenced by ValidateInput().
|
private |
Definition at line 295 of file tab_table_reader.cpp.
References _ReportError(), _Validate(), ILineReader::AtEOF(), count, e_tab_ignore_empty_rows, ctll::empty(), CTempString::empty(), ILineReader::GetCurrentLine(), ILineReader::GetLineNumber(), i, ITERATE, NStr::Join(), m_col_defs, m_current_row_number, m_delim, m_flags, m_ignored_cols, m_require_one_cols, m_required_cols, m_unique_cols, m_unique_values, ILineReader::ReadLine(), and NStr::Split().
Referenced by ValidateInput().
|
private |
Definition at line 261 of file tab_table_reader.cpp.
References _ReportError(), ILineReader::AtEOF(), CTempString::empty(), ILineReader::GetCurrentLine(), ILineReader::GetLineNumber(), m_col_defs, m_current_row_number, m_delim, ILineReader::ReadLine(), NStr::Split(), and NStr::ToLower().
Referenced by ValidateInput().
|
private |
Definition at line 69 of file tab_table_reader.cpp.
References CTabDelimitedValidatorMessage::m_col, CTabDelimitedValidatorMessage::m_colname, m_current_row_number, m_errors, CTabDelimitedValidatorMessage::m_msg, CTabDelimitedValidatorMessage::m_row, and CTabDelimitedValidatorMessage::m_warning.
Referenced by _CheckHeader(), _MakeColumns(), _OperateRows(), _ProcessHeader(), _ReportWarning(), _Validate(), and ValidateInput().
|
private |
Definition at line 179 of file tab_table_reader.cpp.
References ITERATE, and m_errors.
Referenced by GenerateOutput().
|
private |
Definition at line 64 of file tab_table_reader.cpp.
References _ReportError().
|
private |
Definition at line 194 of file tab_table_reader.cpp.
References xml::node::get_attributes(), xml::document::get_root_node(), i, xml::attributes::insert(), xml::node::insert(), NStr::IntToString(), ITERATE, m_errors, xml::document::set_encoding(), and xml::document::set_is_standalone().
Referenced by GenerateOutput().
|
private |
Definition at line 48 of file tab_table_reader.cpp.
References _ReportError(), CColumnValidatorRegistry::GetInstance(), m_col_defs, and rapidjson::value.
Referenced by _OperateRows().
void CTabDelimitedValidator::GenerateOutput | ( | CNcbiOstream * | out_stream, |
bool | no_headers | ||
) |
Definition at line 373 of file tab_table_reader.cpp.
References _ReportTab(), _ReportXML(), e_tab_tab_report, e_tab_xml_report, and m_flags.
Referenced by CTAbleValApp::ProcessOneFile().
|
static |
Definition at line 386 of file tab_table_reader.cpp.
References ILineReader::AtEOF(), CTempString::empty(), NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, ILineReader::GetCurrentLine(), CColumnValidatorRegistry::GetInstance(), ILineReader::New(), r(), ILineReader::ReadLine(), and NStr::SplitInTwo().
Referenced by CTAbleValApp::Run().
void CTabDelimitedValidator::ValidateInput | ( | ILineReader & | reader, |
const string & | default_columns, | ||
const string & | required, | ||
const string & | ignored, | ||
const string & | unique, | ||
const string & | discouraged, | ||
const vector< string > & | require_one | ||
) |
Definition at line 125 of file tab_table_reader.cpp.
References _CheckHeader(), _MakeColumns(), _OperateRows(), _ProcessHeader(), _ReportError(), count, e_tab_comma_delim, e_tab_ignore_unknown_types, fatal(), CColumnValidatorRegistry::GetInstance(), i, CColumnValidatorRegistry::IsSupported(), m_col_defs, m_current_row_number, m_delim, m_flags, m_ignored_cols, m_required_cols, m_unique_cols, m_unique_values, and types.
Referenced by CTAbleValApp::ProcessOneFile().
|
private |
Definition at line 82 of file tab_table_reader.hpp.
Referenced by _CheckHeader(), _MakeColumns(), _OperateRows(), _ProcessHeader(), _Validate(), and ValidateInput().
|
private |
Definition at line 80 of file tab_table_reader.hpp.
Referenced by _OperateRows(), _ProcessHeader(), _ReportError(), and ValidateInput().
|
private |
Definition at line 81 of file tab_table_reader.hpp.
Referenced by _OperateRows(), _ProcessHeader(), and ValidateInput().
|
private |
Definition at line 90 of file tab_table_reader.hpp.
Referenced by _ReportError(), _ReportTab(), and _ReportXML().
|
private |
Definition at line 91 of file tab_table_reader.hpp.
Referenced by _OperateRows(), GenerateOutput(), and ValidateInput().
|
private |
Definition at line 84 of file tab_table_reader.hpp.
Referenced by _CheckHeader(), _OperateRows(), and ValidateInput().
Definition at line 86 of file tab_table_reader.hpp.
Referenced by _CheckHeader(), and _OperateRows().
|
private |
Definition at line 83 of file tab_table_reader.hpp.
Referenced by _OperateRows(), and ValidateInput().
|
private |
Definition at line 85 of file tab_table_reader.hpp.
Referenced by _OperateRows(), and ValidateInput().
Definition at line 88 of file tab_table_reader.hpp.
Referenced by _OperateRows(), and ValidateInput().