xref: /netbsd-src/external/bsd/elftosb/dist/common/Version.h (revision 993229b6fea628ff8b1fa09146c80b0cfb2768eb)
1 /*
2  * File:	Version.h
3  *
4  * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5  * See included license file for license details.
6  */
7 #if !defined(_Version_h_)
8 #define _Version_h_
9 
10 #include <string>
11 #include "stdafx.h"
12 
13 namespace elftosb
14 {
15 
16 //! Same version struct used for 3600 boot image.
17 struct version_t
18 {
19 	uint16_t m_major;
20 	uint16_t m_pad0;
21 	uint16_t m_minor;
22 	uint16_t m_pad1;
23 	uint16_t m_revision;
24 	uint16_t m_pad2;
25 
version_tversion_t26 	version_t()
27 	:	m_major(0x999), m_pad0(0), m_minor(0x999), m_pad1(0), m_revision(0x999), m_pad2(0)
28 	{
29 	}
30 
version_tversion_t31 	version_t(uint16_t maj, uint16_t min, uint16_t rev)
32 	:	m_major(maj), m_pad0(0), m_minor(min), m_pad1(0), m_revision(rev), m_pad2(0)
33 	{
34 	}
35 
version_tversion_t36 	version_t(const std::string & versionString)
37 	:	m_major(0x999), m_pad0(0), m_minor(0x999), m_pad1(0), m_revision(0x999), m_pad2(0)
38 	{
39 		set(versionString);
40 	}
41 
42 	//! \brief Sets the version by parsing a string.
43 	void set(const std::string & versionString);
44 
45 	//! \brief
46 	void fixByteOrder();
47 };
48 
49 }; // namespace elftosb
50 
51 #endif // _Version_h_
52