OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{DelimitedParserUtils.cpp} Namespace Reference

Functions

bool is_eol (const char &c, const import_export::CopyParams &copy_params)
 
void trim_space (const char *&field_begin, const char *&field_end)
 
void trim_quotes (const char *&field_begin, const char *&field_end, const import_export::CopyParams &copy_params)
 

Function Documentation

bool anonymous_namespace{DelimitedParserUtils.cpp}::is_eol ( const char &  c,
const import_export::CopyParams copy_params 
)
inline

Definition at line 32 of file DelimitedParserUtils.cpp.

References import_export::CopyParams::line_delim.

Referenced by import_export::delimited_parser::get_row().

32  {
33  return c == copy_params.line_delim || c == '\n' || c == '\r';
34 }

+ Here is the caller graph for this function:

void anonymous_namespace{DelimitedParserUtils.cpp}::trim_quotes ( const char *&  field_begin,
const char *&  field_end,
const import_export::CopyParams copy_params 
)
inline

Definition at line 46 of file DelimitedParserUtils.cpp.

References import_export::CopyParams::quote, import_export::CopyParams::quoted, and trim_space().

Referenced by import_export::delimited_parser::get_row().

48  {
49  auto quote_begin = field_begin, quote_end = field_end;
50  if (copy_params.quoted) {
51  trim_space(quote_begin, quote_end);
52  }
53  if (copy_params.quoted && quote_end - quote_begin > 0) {
54  if (*quote_begin == copy_params.quote && *(quote_end - 1) == copy_params.quote) {
55  field_begin = ++quote_begin;
56  field_end = (quote_begin == quote_end) ? quote_end : --quote_end;
57  } else {
59  "Unable to trim quotes.");
60  }
61  }
62 }
void trim_space(const char *&field_begin, const char *&field_end)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{DelimitedParserUtils.cpp}::trim_space ( const char *&  field_begin,
const char *&  field_end 
)
inline

Definition at line 36 of file DelimitedParserUtils.cpp.

Referenced by trim_quotes().

36  {
37  while (field_begin < field_end && (*field_begin == ' ' || *field_begin == '\r')) {
38  ++field_begin;
39  }
40  while (field_begin < field_end &&
41  (*(field_end - 1) == ' ' || *(field_end - 1) == '\r')) {
42  --field_end;
43  }
44 }

+ Here is the caller graph for this function: