libutil++  1.9.3
 All Classes Functions Variables
GZCSVPathReader.h
1 /*
2 ** libutil++
3 ** $Id: GZCSVPathReader.h 1653 2016-02-28 19:54:59Z sella $
4 ** Copyright (c) 2011-2016 Digital Genesis, LLC. All Rights Reserved.
5 ** Released under the LGPL Version 2.1 License.
6 ** http://www.digitalgenesis.com
7 */
8 
9 #ifndef __sella__file__GZCSVPathReader_H__
10 #define __sella__file__GZCSVPathReader_H__
11 
12 #include "../util/CommonMacro.h"
13 #include "IOException.h"
14 
15 #include <sys/types.h>
16 #include <stdint.h>
17 #include <zlib.h>
18 #include <fcntl.h>
19 #include <dirent.h>
20 
21 #include <string>
22 #include <vector>
23 #include <memory>
24 
25 namespace sella {
26  namespace file {
27  class GZCSVPathReader;
28  }
29 }
30 
35  public:
36  // Public Type Definitions
37  STANDARD_TYPEDEF(sella::file::GZCSVPathReader);
38 
39  static const char * FileSuffix;
40 
41  static const char DefaultDelimiter = 0x1e;
42  static const char DefaultSeperator = 0x1d;
43 
44  // Constructors
45  GZCSVPathReader(const std::string & path, char delimiter = DefaultDelimiter, char seperator = DefaultSeperator) THROWS(IOException);
46 
47  // Public Member Functions
48  void read(std::vector<std::vector<std::string>> & data) THROWS(IOException);
49 
50  protected:
51  static int filter(const struct dirent * file) NO_EXCEPTIONS;
52 
53  private:
54  std::string path;
55 
56  char delimiter;
57  char seperator;
58 };
59 
60 #endif
61 
62 /*
63 ** vim: noet ts=3 sw=3
64 */
static const char DefaultDelimiter
The default delimiter used between the fields of a record; the ASCII record seperator character...
void read(std::vector< std::vector< std::string >> &data) THROWS(IOException)
static int filter(const struct dirent *file) NO_EXCEPTIONS
A GZIP compressed CSV path reader class.
GZCSVPathReader(const std::string &path, char delimiter=DefaultDelimiter, char seperator=DefaultSeperator) THROWS(IOException)
static const char DefaultSeperator
The default seperator used between the records of a file; the ASCII group seperator character...
static const char * FileSuffix
The file suffix for matching files in the directory for reading.