Rev 1598 | Rev 1642 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1598 | Rev 1602 | ||
|---|---|---|---|
| Line 22... | Line 22... | ||
| 22 | #define TYPE_COMMON_H |
22 | #define TYPE_COMMON_H |
| 23 | 23 | ||
| 24 | #include <iostream> |
24 | #include <iostream> |
| 25 | #include <string> |
25 | #include <string> |
| 26 | #include <vector> |
26 | #include <vector> |
| - | 27 | #include <map> |
|
| 27 | 28 | ||
| 28 | #include <stdio.h> |
29 | #include <stdio.h> |
| 29 | 30 | ||
| 30 | #include <boost/shared_ptr.hpp> |
31 | #include <boost/shared_ptr.hpp> |
| 31 | 32 | ||
| 32 | namespace atom { |
33 | namespace atom { |
| 33 | namespace type { |
34 | namespace type { |
| 34 | 35 | ||
| 35 | typedef boost::shared_ptr<unsigned char> BytePointer; |
36 | typedef boost::shared_ptr<unsigned char> BytePointer; |
| 36 | typedef std::vector<std::string> StringList; |
37 | typedef std::vector<std::string> StringList; |
| - | 38 | typedef std::map<std::string, std::string> StringMap; |
|
| 37 | 39 | /* |
|
| 38 | template <typename T> |
40 | template <typename T> |
| 39 | struct HexTo |
41 | struct HexTo |
| 40 | { |
42 | { |
| 41 | T value; |
43 | T value; |
| 42 | 44 | |
|
| 43 | operator T() const |
45 | operator T() const |
| 44 | { |
46 | { |
| 45 | return value; |
47 | return value; |
| 46 | } |
48 | } |
| 47 | 49 | |
|
| 48 | friend std::istream& operator>>(std::istream& in, HexTo& out) |
50 | friend std::istream& operator>>(std::istream& in, HexTo& out) |
| 49 | { |
51 | { |
| 50 | in >> std::hex >> out.value; |
52 | in >> std::hex >> out.value; |
| 51 | return in; |
53 | return in; |
| 52 | } |
54 | } |
| 53 | }; |
55 | }; |
| 54 | 56 | */ |
|
| 55 | inline std::string ToHex(unsigned int value) |
57 | inline std::string ToHex(unsigned int value) |
| 56 | { |
58 | { |
| 57 | char hex_string[11]; |
59 | char hex_string[11]; |
| 58 | 60 | ||
| 59 | snprintf(hex_string, sizeof(hex_string), "0x%08X", value); |
61 | snprintf(hex_string, sizeof(hex_string), "0x%08X", value); |