/*! * * Copyright (c) 2023 Diality Inc. - All Rights Reserved. * * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file PackageItem.h * \author (last) Phil Braica * \date (last) 23-Jan-2023 * \author (original) Phil Braica * \date (original) 23-Jan-2023 */ #ifndef PACKAGE_ITEM_H_ #define PACKAGE_ITEM_H_ #include #include /*! * \brief One item in a package. */ class PackageItem { public: std::string _fileType; ///< Either "LINUX", "UI", "DG", "HD", "DGFPGA", "HDFPGA" std::string _destPath; ///< Where to copy to and name (if any) std::string _desc; ///< Descriptive tracking info. uint32_t _security; ///< Security tag. uint32_t _version; ///< 2nd security tag. uint32_t _size; ///< Size bytes std::string _rawFilename; ///< The original raw filename, informational. bool _isScript; ///< Is this the update script? 1 per all package items. std::size_t _byteOffset; ///< Offset into the file (cumulative _size). PackageItem(); virtual ~PackageItem(); static std::vector fromXml(const std::string & xml_str); std::string to_xml() const; static std::string to_xml(const std::vector & catalog); static std::string unwrap(const std::string& xml_str, const std::string& tag); static std::string unwrap(const std::string& xml_str, const std::string& tag, std::size_t& offset); static std::string wrap(const std::string& tag, const std::string& content); protected: static std::string trim_text(const std::string& txt); }; #endif // PACKAGE_ITEM_H_