mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 09:31:58 +08:00
Refactor to provide an istream prototype for parse()
This commit is contained in:
parent
2f8c88cb96
commit
1bf8ca7a59
@ -17,8 +17,13 @@ void
|
|||||||
GCodeReader::parse(const std::string &gcode, callback_t callback)
|
GCodeReader::parse(const std::string &gcode, callback_t callback)
|
||||||
{
|
{
|
||||||
std::istringstream ss(gcode);
|
std::istringstream ss(gcode);
|
||||||
|
this->parse_stream(ss, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeReader::parse_stream(std::istream &gcode, callback_t callback)
|
||||||
|
{
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(ss, line))
|
while (std::getline(gcode, line))
|
||||||
this->parse_line(line, callback);
|
this->parse_line(line, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class GCodeReader {
|
|||||||
GCodeReader() : X(0), Y(0), Z(0), E(0), F(0), verbose(false), _extrusion_axis('E') {};
|
GCodeReader() : X(0), Y(0), Z(0), E(0), F(0), verbose(false), _extrusion_axis('E') {};
|
||||||
void apply_config(const PrintConfigBase &config);
|
void apply_config(const PrintConfigBase &config);
|
||||||
void parse(const std::string &gcode, callback_t callback);
|
void parse(const std::string &gcode, callback_t callback);
|
||||||
|
void parse_stream(std::istream &gcode, callback_t callback);
|
||||||
void parse_line(std::string line, callback_t callback);
|
void parse_line(std::string line, callback_t callback);
|
||||||
void parse_file(const std::string &file, callback_t callback);
|
void parse_file(const std::string &file, callback_t callback);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user