00001 //Dear emacs, this is -*- c++ -*- 00002 00013 #ifndef EFORMAT_VERSION_H 00014 #define EFORMAT_VERSION_H 00015 00016 #include <stdint.h> 00017 #include <string> 00018 00019 namespace eformat { 00020 00024 const uint32_t DEFAULT_VERSION = 0x03000000; 00025 00029 const uint16_t MAJOR_DEFAULT_VERSION = 0x0300; 00030 00034 const uint16_t MAJOR_OLD_VERSION = 0x0204; 00035 00036 namespace helper { 00037 00041 class Version { 00042 00043 public: 00050 Version (uint16_t minor, uint16_t major=MAJOR_DEFAULT_VERSION) 00051 : m_minor(minor), m_major(major) {} 00052 00060 Version (uint32_t v=DEFAULT_VERSION); 00061 00065 inline uint16_t major2 (void) const { return m_major; } 00066 00070 inline uint16_t minor2 (void) const { return m_minor; } 00071 00076 uint32_t code (void) const; 00077 00081 std::string human_major (void) const; 00082 00086 std::string human_minor (void) const; 00087 00091 std::string human (void) const; 00092 00093 private: //representation 00094 00095 uint16_t m_minor; 00096 uint16_t m_major; 00097 00098 }; 00099 00100 } 00101 00102 } 00103 00104 #endif /* EFORMAT_VERSION_H */