| 9 | |
| 10 | namespace MdfLibrary { |
| 11 | class MdfFileHistory { |
| 12 | private: |
| 13 | mdf::IFileHistory* history; |
| 14 | |
| 15 | public: |
| 16 | MdfFileHistory(mdf::IFileHistory* history) : history(history) { |
| 17 | if (history == nullptr) |
| 18 | throw std::runtime_error("MdfFileHistory Init failed"); |
| 19 | } |
| 20 | MdfFileHistory(const mdf::IFileHistory* history) |
| 21 | : MdfFileHistory(const_cast<mdf::IFileHistory*>(history)) {} |
| 22 | ~MdfFileHistory() { history = nullptr; } |
| 23 | int64_t GetIndex() const { return MdfFileHistoryGetIndex(history); } |
| 24 | uint64_t GetTime() const { return MdfFileHistoryGetTime(history); } |
| 25 | void SetTime(uint64_t time) { MdfFileHistorySetTime(history, time); } |
| 26 | const MdfMetaData GetMetaData() const { |
| 27 | return MdfFileHistoryGetMetaData(history); |
| 28 | } |
| 29 | std::string GetDescription() const { |
| 30 | std::string str(MdfFileHistoryGetDescription(history, nullptr) + 1, '\0'); |
| 31 | str.resize(MdfFileHistoryGetDescription(history, str.data())); |
| 32 | return str; |
| 33 | } |
| 34 | void SetDescription(const char* desc) { |
| 35 | MdfFileHistorySetDescription(history, desc); |
| 36 | } |
| 37 | std::string GetToolName() const { |
| 38 | std::string str(MdfFileHistoryGetToolName(history, nullptr) + 1, '\0'); |
| 39 | str.resize(MdfFileHistoryGetToolName(history, str.data())); |
| 40 | return str; |
| 41 | } |
| 42 | void SetToolName(const char* name) { |
| 43 | MdfFileHistorySetToolName(history, name); |
| 44 | } |
| 45 | std::string GetToolVendor() const { |
| 46 | std::string str(MdfFileHistoryGetToolVendor(history, nullptr) + 1, '\0'); |
| 47 | str.resize(MdfFileHistoryGetToolVendor(history, str.data())); |
| 48 | return str; |
| 49 | } |
| 50 | void SetToolVendor(const char* vendor) { |
| 51 | MdfFileHistorySetToolVendor(history, vendor); |
| 52 | } |
| 53 | std::string GetToolVersion() const { |
| 54 | std::string str(MdfFileHistoryGetToolVersion(history, nullptr) + 1, '\0'); |
| 55 | str.resize(MdfFileHistoryGetToolVersion(history, str.data())); |
| 56 | return str; |
| 57 | } |
| 58 | void SetToolVersion(const char* version) { |
| 59 | MdfFileHistorySetToolVersion(history, version); |
| 60 | } |
| 61 | std::string GetUserName() const { |
| 62 | std::string str(MdfFileHistoryGetUserName(history, nullptr) + 1, '\0'); |
| 63 | str.resize(MdfFileHistoryGetUserName(history, str.data())); |
| 64 | return str; |
| 65 | } |
| 66 | void SetUserName(const char* user) { |
| 67 | MdfFileHistorySetUserName(history, user); |
| 68 | } |
no outgoing calls
no test coverage detected