0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
freebase_parser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef FREEBASE_PARSER_H
23 #define FREEBASE_PARSER_H
24 
25 #include <iostream>
26 #include <fstream>
27 #include <string>
28 #include <vector>
29 
30 #include "Hypertable/Lib/KeySpec.h"
31 
32 struct InsertRec {
34  const void *value;
35  uint32_t value_len;
36 };
37 
38 struct ColumnInfo {
39  const char *name;
40  size_t name_len;
41  const char *value;
42  size_t value_len;
43 };
44 
46 
47  public:
49  bool load(const std::string fname);
50  InsertRec *next(int *countp);
51 
52  private:
53  std::string m_fname;
54  std::ifstream m_fin;
55  std::string m_header_line;
56  std::string m_line;
57  std::vector<ColumnInfo> m_column_info;
59  std::string m_category;
62  int m_lineno;
63 };
64 
65 #endif // FREEBASE_PARSER_H
size_t name_len
Hypertable::KeySpec key
const char * name
std::string m_category
std::vector< ColumnInfo > m_column_info
bool load(const std::string fname)
const void * value
std::string m_header_line
size_t value_len
InsertRec * m_inserts
uint32_t value_len
std::ifstream m_fin
InsertRec * next(int *countp)
std::string m_fname
const char * value
std::string m_line