looper/license.h

23 lines
No EOL
749 B
C++

#pragma once
#include <string>
#include <vector>
#include <cstring>
using std::string;
struct LicenseData {
string Project;
string Spdx;
string LicenseContents = "";
inline void load_contents(const unsigned int *license_data, const unsigned int license_size) {
std::vector<char> vec(license_size);
vec.resize(license_size);
memcpy(vec.data(), license_data, license_size);
vec.push_back('\0');
LicenseContents = string(vec.data());
}
inline LicenseData(string project, string spdx) {
this->Project = project;
this->Spdx = spdx;
}
};
#define LOAD_LICENSE(data, prefix) if (data.LicenseContents == "") data.load_contents(prefix##_license_data, prefix##_license_size);