NCBI C++ ToolKit
Public Member Functions | Protected Attributes | List of all members
CTableDelimiterRules Class Reference

Search Toolkit Book for CTableDelimiterRules

CTableDelimiterRules -. More...

#include <gui/widgets/loaders/table_import_data_source.hpp>

+ Collaboration diagram for CTableDelimiterRules:

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...
 

Detailed Description

CTableDelimiterRules -.

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.

Constructor & Destructor Documentation

◆ CTableDelimiterRules()

CTableDelimiterRules::CTableDelimiterRules ( )
inline

Ctor defaults to not having quotes.

Definition at line 209 of file table_import_data_source.hpp.

Referenced by Reset().

Member Function Documentation

◆ GetDelimiters()

const vector<char>& CTableDelimiterRules::GetDelimiters ( ) const
inline

◆ GetMergeDelimiters()

bool CTableDelimiterRules::GetMergeDelimiters ( ) const
inline

◆ GetMultipleSpacesOnly()

bool CTableDelimiterRules::GetMultipleSpacesOnly ( ) const
inline

◆ GetQuoteChar()

char CTableDelimiterRules::GetQuoteChar ( ) const
inline

◆ LoadAsn()

void CTableDelimiterRules::LoadAsn ( CUser_field delimiter_object)

◆ LogDelims()

void CTableDelimiterRules::LogDelims ( ) const

◆ MatchingDelimiters()

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().

◆ Reset()

void CTableDelimiterRules::Reset ( void  )
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().

◆ SaveAsn()

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().

◆ SetDelimiters()

void CTableDelimiterRules::SetDelimiters ( const vector< char > &  d)
inline

◆ SetMergeDelimiters()

void CTableDelimiterRules::SetMergeDelimiters ( bool  b)
inline

◆ SetMultipleSpacesOnly()

void CTableDelimiterRules::SetMultipleSpacesOnly ( bool  b)
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().

◆ SetQuoteChar()

void CTableDelimiterRules::SetQuoteChar ( char  c)
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().

Member Data Documentation

◆ m_Delimiters

vector<char> CTableDelimiterRules::m_Delimiters
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().

◆ m_MergeDelimiters

bool CTableDelimiterRules::m_MergeDelimiters
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().

◆ m_MultiLineQuotes

bool CTableDelimiterRules::m_MultiLineQuotes
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().

◆ m_MultipleSpacesOnly

bool CTableDelimiterRules::m_MultipleSpacesOnly
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().

◆ m_QuoteChar

char CTableDelimiterRules::m_QuoteChar
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().


The documentation for this class was generated from the following files:
Modified on Wed Sep 04 15:05:37 2024 by modify_doxy.py rev. 669887