You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.1 KiB

  1. #ifndef PCB_PLOT_PARAMS_PARSER_H_
  2. #define PCB_PLOT_PARAMS_PARSER_H_
  3. /*
  4. * This program source code file is part of KiCad, a free EDA CAD application.
  5. *
  6. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. #include <pcb_plot_params_lexer.h>
  26. class wxString;
  27. class PCB_PLOT_PARAMS;
  28. class LINE_READER;
  29. /**
  30. * The parser for PCB_PLOT_PARAMS.
  31. */
  32. class PCB_PLOT_PARAMS_PARSER : public PCB_PLOT_PARAMS_LEXER
  33. {
  34. public:
  35. PCB_PLOT_PARAMS_PARSER( LINE_READER* aReader );
  36. PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource );
  37. LINE_READER* GetReader() { return reader; };
  38. void Parse( PCB_PLOT_PARAMS* aPcbPlotParams );
  39. private:
  40. bool parseBool();
  41. /**
  42. * Parse an integer and constrains it between two values.
  43. *
  44. * @param aMin is the smallest return value.
  45. * @param aMax is the largest return value.
  46. * @return the parsed integer.
  47. */
  48. int parseInt( int aMin, int aMax );
  49. /**
  50. * Parse a double precision floating point number.
  51. *
  52. * @return the parsed double.
  53. */
  54. double parseDouble();
  55. /**
  56. * Skip the current token level.
  57. *
  58. * Search for the RIGHT parenthesis which closes the current description.
  59. */
  60. void skipCurrent();
  61. };
  62. #endif // PCB_PLOT_PARAMS_PARSER_H_