srecord  1.65.0
spasm.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2001-2003, 2006-2008, 2010, 2011, 2013 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at your
8 // option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 // License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #ifndef SRECORD_INPUT_FILE_SPASM_H
20 #define SRECORD_INPUT_FILE_SPASM_H
21 
22 #include <srecord/endian.h>
23 #include <srecord/input/file.h>
24 
25 namespace srecord {
26 
27 /**
28  * The srecord::input_file_spasm class is used to represent the parse state
29  * of a SPASM formatted input file.
30  */
32  public input_file
33 {
34 public:
35  /**
36  * The destructor.
37  */
38  virtual ~input_file_spasm();
39 
40  /**
41  * The create_be class method is used to create new dynamically
42  * allocated instances of this class. This is used by the --guess
43  * format.
44  *
45  * @param file_name
46  * The name of the file to be read.
47  * @returns
48  * smart pointer to new instance
49  */
50  static pointer create_be(const std::string &file_name);
51 
52  /**
53  * The create class method is used to create new dynamically
54  * allocated instances of this class.
55  *
56  * @param file_name
57  * The name of the file to be read.
58  * @param end
59  * The byte order of the file
60  * @returns
61  * smart pointer to new instance
62  */
63  static pointer create(const std::string &file_name, endian_t end);
64 
65 protected:
66  // See base class for documentation.
67  bool read(record &record);
68 
69  // See base class for documentation.
70  const char *get_file_format_name(void) const;
71 
72  // See base class for documentation.
73  int format_option_number(void) const;
74 
75 private:
76  /**
77  * The constructor.
78  *
79  * @param file_name
80  * The name of the file to be read.
81  * @param end
82  * The byte order.
83  */
84  input_file_spasm(const std::string &file_name, endian_t end = endian_big);
85 
86  /**
87  * The read_inner method is used to read a record from the file.
88  * The read method is a wrapper around it.
89  */
90  bool read_inner(record &);
91 
92  /**
93  * The seen_some_input instance variable is used to remember whether
94  * or not any data has been seen from this file to date.
95  */
96  bool seen_some_input;
97 
98  /**
99  * The end instance variable is used to remember whether the
100  * file is big-endian or little-endian.
101  */
102  endian_t end;
103 
104  /**
105  * The default constructor. Do not use.
106  */
108 
109  /**
110  * The copy constructor. Do not use.
111  */
113 
114  /**
115  * The assigmne toperator. Do not use.
116  */
117  input_file_spasm &operator=(const input_file_spasm &);
118 };
119 
120 };
121 
122 #endif // SRECORD_INPUT_FILE_SPASM_H
123 // vim: set ts=8 sw=4 et :
The srecord::input_file_spasm class is used to represent the parse state of a SPASM formatted input f...
Definition: spasm.h:33
static pointer create(const std::string &file_name, endian_t end)
The create class method is used to create new dynamically allocated instances of this class.
int format_option_number(void) const
The format_option_number method is used to obtain the option number, which can then be turned into te...
bool read(record &record)
The read method is used to read one record from the input.
static pointer create_be(const std::string &file_name)
The create_be class method is used to create new dynamically allocated instances of this class.
virtual ~input_file_spasm()
The destructor.
const char * get_file_format_name(void) const
The get_file_format_name method is used to find out the name of the file format being read.
The srecord::input_file class is used to represent an generic input file.
Definition: file.h:37
std::shared_ptr< input > pointer
Definition: input.h:41
The srecord::record class is used to represent a data record read from a file.
Definition: record.h:35
endian_t
Definition: endian.h:27
@ endian_big
Definition: endian.h:28