/* drawing (DXF) to G-code (NGC) converter
* Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
* Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/
*/
#ifndef CMDPARSER_H
#define CMDPARSER_H
#include <iostream>
#include <string>
#include "drawing.h"
#include "gcode.h"
#include "layer.h"
#include "polygons.h"
#include "settings.h"
/// command parser
class CmdParser {
public:
/**
* @brief get layer by name from stream
* @param[in] strm stream to read layer name from
* @param[out] name layer name from stream
* @param[out] layer layer indicated by name from stream
* @return if layer could be found
*/
bool getLayer(std::istream &strm, std::string &name,
const Layer *&layer) const;
/**
* @brief get layer by name from stream and convert to polygons
* @param[in] strm stream to read layer name from
* @param[out] name layer name from stream
* @param[out] layer layer indicated by name from stream
* @param[in,out] polys polygons created from layer
* @return if layer could be found and converted to polygons
*/
bool getLayerPolys(std::istream &strm, std::string &name,
const Layer *&layer, Polygons &polys) const;
/**
* @brief process cmd command
* @param[in] strm stream to read command arguments from
* @return if processing command was successful
*/
bool procCmd_cmd(std::istream &strm);
/**
* @brief process cut command
* @param[in] strm stream to read command arguments from