GnuCash c935c2f+
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
gnc-tokenizer.hpp File Reference

Class convert a file into vector of string vectors. More...

#include <config.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <memory>

Go to the source code of this file.

Data Structures

class  GncTokenizer
 

Typedefs

using StrVec = std::vector< std::string >
 

Enumerations

enum class  GncImpFileFormat { UNKNOWN , CSV , FIXED_WIDTH }
 Enumeration for file formats supported by this importer. More...
 

Functions

std::unique_ptr< GncTokenizergnc_tokenizer_factory (GncImpFileFormat fmt)
 

Detailed Description

Class convert a file into vector of string vectors.

This is a generic base class that holds the functionality common to different specializations (eg a csv file parser, a fixed-width file parser,...) The child classes have to override the tokenize function to create a full tokenizer class.

gnc-tokenizer.hpp

Author
Copyright (c) 2015 Geert Janssens geert.nosp@m.@kob.nosp@m.altwi.nosp@m.t.be

Definition in file gnc-tokenizer.hpp.

Typedef Documentation

◆ StrVec

using StrVec = std::vector<std::string>

Definition at line 46 of file gnc-tokenizer.hpp.

Enumeration Type Documentation

◆ GncImpFileFormat

enum class GncImpFileFormat
strong

Enumeration for file formats supported by this importer.

Definition at line 49 of file gnc-tokenizer.hpp.

49 {
50 UNKNOWN,
51 CSV,
52 FIXED_WIDTH
53};

Function Documentation

◆ gnc_tokenizer_factory()

std::unique_ptr< GncTokenizer > gnc_tokenizer_factory ( GncImpFileFormat  fmt)

Definition at line 45 of file gnc-tokenizer.cpp.

46{
47 std::unique_ptr<GncTokenizer> tok(nullptr);
48 switch (fmt)
49 {
50 case GncImpFileFormat::CSV:
51 tok.reset(new GncCsvTokenizer());
52 break;
53 case GncImpFileFormat::FIXED_WIDTH:
54 tok.reset(new GncFwTokenizer());
55 break;
56 default:
57 tok.reset(new GncDummyTokenizer());
58 break;
59 }
60
61 return tok;
62}