OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DelimitedParserUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * @file DelimitedParserUtils.h
19  * @author Mehmet Sariyuce <mehmet.sariyuce@omnisci.com>
20  * @brief DelimitedParserUtils class for parsing delimited data
21  */
22 
23 #pragma once
24 
25 #include <string>
26 #include <vector>
27 
28 #include "Import/CopyParams.h"
29 
30 namespace Importer_NS {
32  public:
44  static size_t find_beginning(const char* buffer,
45  size_t begin,
46  size_t end,
47  const CopyParams& copy_params);
48 
60  static size_t find_end(const char* buffer,
61  size_t size,
62  const CopyParams& copy_params,
63  unsigned int& num_rows_this_buffer);
64 
79  static const char* get_row(const char* buf,
80  const char* buf_end,
81  const char* entire_buf_end,
82  const Importer_NS::CopyParams& copy_params,
83  const bool* is_array,
84  std::vector<std::string>& row,
85  bool& try_single_thread);
86 
94  static void parseStringArray(const std::string& s,
95  const Importer_NS::CopyParams& copy_params,
96  std::vector<std::string>& string_vec);
97 };
98 } // namespace Importer_NS
static size_t find_end(const char *buffer, size_t size, const CopyParams &copy_params, unsigned int &num_rows_this_buffer)
Finds the closest possible row ending to the end of the given buffer.
static const char * get_row(const char *buf, const char *buf_end, const char *entire_buf_end, const Importer_NS::CopyParams &copy_params, const bool *is_array, std::vector< std::string > &row, bool &try_single_thread)
Parses the first row in the given buffer and inserts fields into given vector.
static size_t find_beginning(const char *buffer, size_t begin, size_t end, const CopyParams &copy_params)
Finds the closest possible row beginning in the given buffer.
static void parseStringArray(const std::string &s, const Importer_NS::CopyParams &copy_params, std::vector< std::string > &string_vec)
Parses given string array and inserts into given vector of strings.