Skip to content

Commit 76b0d5b

Browse files
committed
Fix: removed <functional> include (not available for standard Arduino boards)
1 parent 793d545 commit 76b0d5b

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

CSV_Parser.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,24 @@ void CSV_Parser::parseLeftover() {
551551
}
552552
}
553553

554-
void CSV_Parser::setFeedRowParserCallback(std::function<char()> func) {
554+
// void CSV_Parser::setFeedRowParserCallback(std::function<char()> func) {
555+
// this->feedRowParser_callback = func;
556+
// }
557+
// void CSV_Parser::setFeedRowParserStrCallback(std::function<char*()> func) {
558+
// this->feedRowParserStr_callback = func;
559+
// }
560+
// void CSV_Parser::setRowParserFinishedCallback(std::function<bool()> func) {
561+
// this->rowParserFinished_callback = func;
562+
// }
563+
564+
void CSV_Parser::setFeedRowParserCallback(FeedRowParserCallback func) {
555565
this->feedRowParser_callback = func;
556566
}
557-
void CSV_Parser::setFeedRowParserStrCallback(std::function<char*()> func) {
567+
568+
void CSV_Parser::setFeedRowParserStrCallback(FeedRowParserStrCallback func) {
558569
this->feedRowParserStr_callback = func;
559570
}
560-
void CSV_Parser::setRowParserFinishedCallback(std::function<bool()> func) {
571+
572+
void CSV_Parser::setRowParserFinishedCallback(RowParserFinishedCallback func) {
561573
this->rowParserFinished_callback = func;
562574
}

CSV_Parser.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
extern SerialClass Serial;
3131
#endif
3232

33-
#include <functional>
33+
typedef char (*FeedRowParserCallback)();
34+
typedef char* (*FeedRowParserStrCallback)();
35+
typedef bool (*RowParserFinishedCallback)();
3436

3537
class CSV_Parser {
3638
char ** keys;
@@ -68,9 +70,13 @@ class CSV_Parser {
6870
int current_col;
6971
bool header_parsed;
7072

71-
std::function<char()> feedRowParser_callback;
72-
std::function<char*()> feedRowParserStr_callback;
73-
std::function<bool()> rowParserFinished_callback;
73+
// std::function<char()> feedRowParser_callback;
74+
// std::function<char*()> feedRowParserStr_callback;
75+
// std::function<bool()> rowParserFinished_callback;
76+
77+
FeedRowParserCallback feedRowParser_callback;
78+
FeedRowParserStrCallback feedRowParserStr_callback;
79+
RowParserFinishedCallback rowParserFinished_callback;
7480

7581
/* Private methods */
7682
char * parseStringValue(const char *, int * chars_occupied);
@@ -203,9 +209,13 @@ class CSV_Parser {
203209
If the csv string did not end with "\n" or "\r\n" then endChunks() must be called, otherwise the last row won't be returned when using "GetValues". */
204210
void parseLeftover();
205211

206-
void setFeedRowParserCallback(std::function<char()> feedRowParser_callback);
207-
void setFeedRowParserStrCallback(std::function<char*()> feedRowParserStr_callback);
208-
void setRowParserFinishedCallback(std::function<bool()> rowParserFinished_callback);
212+
// void setFeedRowParserCallback(std::function<char()> feedRowParser_callback);
213+
// void setFeedRowParserStrCallback(std::function<char*()> feedRowParserStr_callback);
214+
// void setRowParserFinishedCallback(std::function<bool()> rowParserFinished_callback);
215+
216+
void setFeedRowParserCallback(FeedRowParserCallback feedRowParser_callback);
217+
void setFeedRowParserStrCallback(FeedRowParserStrCallback feedRowParserStr_callback);
218+
void setRowParserFinishedCallback(RowParserFinishedCallback rowParserFinished_callback);
209219

210220
/** @brief If invalid parameters are supplied to this class, then debug serial is used to output error information.
211221
This function is static, which means that it supposed to be called like:

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=CSV Parser
2-
version=1.4.0
2+
version=1.4.1
33
author=Michal Borowski <[email protected]>
44
maintainer=Michal Borowski <[email protected]>
55
sentence=CSV Parser for Arduino.

0 commit comments

Comments
 (0)