NCBI C++ ToolKit
|
Search Toolkit Book for CTableDelimiterRules
CTableDelimiterRules -. More...
#include <gui/widgets/loaders/table_import_data_source.hpp>
Public Member Functions | |
CTableDelimiterRules () | |
Ctor defaults to not having quotes. More... | |
bool | MatchingDelimiters (vector< char > other_delims) const |
Return true if the delimiters match (even if order is different) More... | |
void | Reset () |
Clear delimiters and set all values to defaults. More... | |
void | SetDelimiters (const vector< char > &d) |
Get/set delimiter characters. More... | |
const vector< char > & | GetDelimiters () const |
void | SetQuoteChar (char c) |
Get set quote character used for quoting strings. More... | |
char | GetQuoteChar () const |
void | SetMergeDelimiters (bool b) |
Get/set merge delimiters rule for tokenizing table into fields. More... | |
bool | GetMergeDelimiters () const |
void | SetMultipleSpacesOnly (bool b) |
Get/set merge delimiters rule for tokenizing table into fields. More... | |
bool | GetMultipleSpacesOnly () const |
void | LogDelims () const |
Write delims information to log. More... | |
void | SaveAsn (CUser_field &user_field) const |
Export delimiter rules in ASN user-object format. More... | |
void | LoadAsn (CUser_field &delimiter_object) |
Import delimiter rules from ASN user-object format. More... | |
Protected Attributes | |
vector< char > | m_Delimiters |
One or more single characters that divide the table entries into separate fields. More... | |
char | m_QuoteChar |
Any delimiters inside strings enclosed in m_QuoteChar are not considered as field separators. More... | |
bool | m_MultiLineQuotes |
CSV formats allows quotes to extend over multiple lines. More... | |
bool | m_MergeDelimiters |
If m_MergeDelimiters is true, adjacent delimiters (characters from m_Delimiters) next to each other are treated as a single delimiter. More... | |
bool | m_MultipleSpacesOnly |
This is a special delimiter for spaces only - more than one blank is considered a delimiter but a single blank space is not. More... | |
Hold all the delimiter information used to break up a table entry into separate fields. This includes the delimiter characters, how quoted strings are handled, and whether delimiters should be merged.
Definition at line 206 of file table_import_data_source.hpp.
|
inline |
Ctor defaults to not having quotes.
Definition at line 209 of file table_import_data_source.hpp.
Referenced by Reset().
|
inline |
Definition at line 223 of file table_import_data_source.hpp.
References m_Delimiters.
Referenced by CTableImportDataSource::GetDelimiters(), CTestApplication::LoadTable(), CTableImportDataSource::RecomputeFields(), CTableImportDataSource::RecomputeHeaders(), CTableImportDataSource::RecomputeRowFields(), CTableImportDataSource::ReplaceSpaces(), and CTableImportDataSource::SplitColumn().
|
inline |
Definition at line 231 of file table_import_data_source.hpp.
References m_MergeDelimiters.
Referenced by CTestApplication::LoadTable(), CTableImportDataSource::RecomputeFields(), CTableImportDataSource::RecomputeHeaders(), CTableImportDataSource::RecomputeRowFields(), CAttribTableDelimitersPanel::Show(), CTableDelimitersPanel::Show(), CAttribTableDelimitersPanel::UpdateDelimiters(), CTableDelimitersPanel::UpdateDelimiters(), and CAttribTableColumnIdPanel::x_TableReaderMacro().
|
inline |
Definition at line 235 of file table_import_data_source.hpp.
References m_MultipleSpacesOnly.
Referenced by CTableImportDataSource::MergeColumns(), CTableImportDataSource::RecomputeFields(), CTableImportDataSource::RecomputeHeaders(), CTableImportDataSource::RecomputeRowFields(), CTableImportDataSource::ReplaceSpaces(), CAttribTableDelimitersPanel::Show(), CTableImportDataSource::SplitColumn(), CAttribTableDelimitersPanel::UpdateDelimiters(), and CAttribTableColumnIdPanel::x_TableReaderMacro().
|
inline |
Definition at line 227 of file table_import_data_source.hpp.
References m_QuoteChar.
Referenced by CTableImportDataSource::RecomputeFields(), CTableImportDataSource::RecomputeHeaders(), CTableImportDataSource::RecomputeRowFields(), CAttribTableDelimitersPanel::Show(), CTableDelimitersPanel::Show(), CAttribTableDelimitersPanel::UpdateDelimiters(), CTableDelimitersPanel::UpdateDelimiters(), and CTableImportDataSource::x_RecomputeRowFields().
void CTableDelimiterRules::LoadAsn | ( | CUser_field & | delimiter_object | ) |
Import delimiter rules from ASN user-object format.
Definition at line 653 of file table_import_data_source.cpp.
References CUser_field_Base::C_Data::GetBool(), CUser_field_Base::GetData(), CUser_field::GetField(), CUser_field_Base::C_Data::GetInt(), CUser_field_Base::C_Data::GetInts(), CUser_field::HasField(), i, CUser_field_Base::C_Data::IsBool(), CUser_field_Base::C_Data::IsInt(), CUser_field_Base::C_Data::IsInts(), m_Delimiters, m_MergeDelimiters, m_MultiLineQuotes, and m_QuoteChar.
Referenced by CTableImportDataSource::ImportTableParms().
void CTableDelimiterRules::LogDelims | ( | ) | const |
Write delims information to log.
Definition at line 623 of file table_import_data_source.cpp.
References i, Info(), LOG_POST, m_Delimiters, m_MergeDelimiters, m_MultiLineQuotes, and m_QuoteChar.
Referenced by CTableImportDataSource::LoadTable(), CAttribTableDelimitersPanel::UpdateDelimiters(), and CTableDelimitersPanel::UpdateDelimiters().
bool CTableDelimiterRules::MatchingDelimiters | ( | std::vector< char > | other_delims | ) | const |
Return true if the delimiters match (even if order is different)
Definition at line 611 of file table_import_data_source.cpp.
References m_Delimiters, and ct::sort().
Referenced by CAttribTableDelimitersPanel::UpdateDelimiters(), and CTableDelimitersPanel::UpdateDelimiters().
|
inline |
Clear delimiters and set all values to defaults.
Definition at line 219 of file table_import_data_source.hpp.
References CTableDelimiterRules().
Referenced by CTableImportDataSource::ClearTable(), and CTableImportDataSource::LoadTable().
void CTableDelimiterRules::SaveAsn | ( | CUser_field & | user_field | ) | const |
Export delimiter rules in ASN user-object format.
Export delimiter rules in ASN user-data format.
Definition at line 640 of file table_import_data_source.cpp.
References CUser_field::AddField(), i, m_Delimiters, m_MergeDelimiters, m_MultiLineQuotes, and m_QuoteChar.
Referenced by CTableImportDataSource::ExportTableParms().
|
inline |
Get/set delimiter characters.
Definition at line 222 of file table_import_data_source.hpp.
References m_Delimiters.
Referenced by CTableImportDataSource::LoadTable(), CAttribTableDelimitersPanel::PreviewData(), ReadTabDelimitedTable(), CAttribTableDelimitersPanel::UpdateDelimiters(), CTableDelimitersPanel::UpdateDelimiters(), and CTableImportDataSource::x_PickFileType().
|
inline |
Get/set merge delimiters rule for tokenizing table into fields.
Definition at line 230 of file table_import_data_source.hpp.
References b, and m_MergeDelimiters.
Referenced by CTableImportDataSource::LoadTable(), CAttribTableDelimitersPanel::PreviewData(), CAttribTableDelimitersPanel::UpdateDelimiters(), CTableDelimitersPanel::UpdateDelimiters(), and CTableImportDataSource::x_PickFileType().
|
inline |
Get/set merge delimiters rule for tokenizing table into fields.
Definition at line 234 of file table_import_data_source.hpp.
References b, and m_MultipleSpacesOnly.
Referenced by CAttribTableDelimitersPanel::UpdateDelimiters().
|
inline |
Get set quote character used for quoting strings.
Definition at line 226 of file table_import_data_source.hpp.
References m_QuoteChar.
Referenced by CAttribTableDelimitersPanel::UpdateDelimiters(), and CTableDelimitersPanel::UpdateDelimiters().
|
protected |
One or more single characters that divide the table entries into separate fields.
Definition at line 249 of file table_import_data_source.hpp.
Referenced by GetDelimiters(), LoadAsn(), LogDelims(), MatchingDelimiters(), SaveAsn(), and SetDelimiters().
|
protected |
If m_MergeDelimiters is true, adjacent delimiters (characters from m_Delimiters) next to each other are treated as a single delimiter.
Definition at line 261 of file table_import_data_source.hpp.
Referenced by GetMergeDelimiters(), LoadAsn(), LogDelims(), SaveAsn(), and SetMergeDelimiters().
|
protected |
CSV formats allows quotes to extend over multiple lines.
This flag tells us to look for that (not yet supported)
Definition at line 257 of file table_import_data_source.hpp.
Referenced by LoadAsn(), LogDelims(), and SaveAsn().
|
protected |
This is a special delimiter for spaces only - more than one blank is considered a delimiter but a single blank space is not.
One of the characters in m_Delimiters must be ' '.
Definition at line 266 of file table_import_data_source.hpp.
Referenced by GetMultipleSpacesOnly(), and SetMultipleSpacesOnly().
|
protected |
Any delimiters inside strings enclosed in m_QuoteChar are not considered as field separators.
Valid values are: [blank, ", ']
Definition at line 253 of file table_import_data_source.hpp.
Referenced by GetQuoteChar(), LoadAsn(), LogDelims(), SaveAsn(), and SetQuoteChar().