DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
rowStrategy.hpp
Go to the documentation of this file.
1// Copyright (c) 2020-2025 Cody R. Drisko. All rights reserved.
2// Licensed under the MIT License. See the LICENSE file in the project root for more information.
3//
4// Name: rowStrategy.hpp
5// Author: crdrisko
6// Date: 01/01/2021-14:15:47
7// Description: An implementations of file parser for parsing data as rows
8
9#ifndef DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_FILES_FILEPARSING_PARSERSTRATEGIES_ROWSTRATEGY_HPP
10#define DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_FILES_FILEPARSING_PARSERSTRATEGIES_ROWSTRATEGY_HPP
11
12#include <string>
13#include <vector>
14
16
17namespace CppUtils::Files
18{
19 class AsRows
20 {
21 private:
22 mutable std::vector<std::string> rowCache;
23
24 public:
32 auto operator()(const std::string& fileContents_) const
33 {
34 if (rowCache.empty())
35 {
36 Strings::Tokenizer tok {fileContents_, "\n"};
37 rowCache = tok.split();
38 }
39
40 return rowCache;
41 }
42 };
43} // namespace CppUtils::Files
44
45
46#endif
Definition rowStrategy.hpp:20
auto operator()(const std::string &fileContents_) const
Definition rowStrategy.hpp:32
std::vector< std::string > rowCache
Definition rowStrategy.hpp:22
Definition tokenizer.hpp:62
Definition fileParser.hpp:23