Build Packages / Unit tests (push) Successful in 1h31m59s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m43s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m5s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m27s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m24s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 10m27s
Build Packages / build:rpm (rocky8) (push) Successful in 9m20s
Build Packages / build:rpm (rocky9) (push) Successful in 10m50s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m54s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 8m38s
Build Packages / DIALS test (push) Successful in 12m13s
Build Packages / XDS test (durin plugin) (push) Successful in 7m8s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m8s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m50s
Build Packages / Generate python client (push) Successful in 16s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Skipped
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use. * jfjoch_broker: Add EXPERIMENTAL pixelrefine mode for image processing * jfjoch_broker: Allow to load user mask from 8-bit and 16-bit TIFF files * jfjoch_broker: Add ROI calculation in non-FPGA workflow * jfjoch_broker: Fixes to TCP image pusher * jfjoch_broker: Remove NUMA bindings * jfjoch_broker: Improvements to indexing * jfjoch_broker: For PSI EIGER, trimming energies are taken from the detector configuration (now compulsory) instead of hardcoded values * jfjoch_writer: Save ROI definitions and the per-pixel ROI bitmap in the master file; azimuthal ROIs support phi (angular) sectors * jfjoch_viewer: Major redesign with dockable panels and saved layouts, plus on-canvas creation/move/resize of box, circle and azimuthal ROIs * jfjoch_viewer: Run jfjoch_process reprocessing jobs from inside the GUI and overlay per-run results Reviewed-on: #63
79 lines
2.4 KiB
C++
79 lines
2.4 KiB
C++
// Copyright 2017 Global Phasing Ltd.
|
|
//
|
|
// Conversion between UTF-8 and wchar. Used only for file names on Windows.
|
|
|
|
#ifndef GEMMI_UTF_HPP_
|
|
#define GEMMI_UTF_HPP_
|
|
|
|
#include <string>
|
|
|
|
namespace gemmi {
|
|
|
|
// from Mark Ransom's answer
|
|
// https://stackoverflow.com/questions/148403/utf8-to-from-wide-char-conversion-in-stl/148766#148766
|
|
inline std::wstring UTF8_to_wchar(const char* in) {
|
|
std::wstring out;
|
|
unsigned int codepoint = 0;
|
|
while (*in != 0) {
|
|
unsigned char ch = static_cast<unsigned char>(*in);
|
|
if (ch <= 0x7f)
|
|
codepoint = ch;
|
|
else if (ch <= 0xbf)
|
|
codepoint = (codepoint << 6) | (ch & 0x3f);
|
|
else if (ch <= 0xdf)
|
|
codepoint = ch & 0x1f;
|
|
else if (ch <= 0xef)
|
|
codepoint = ch & 0x0f;
|
|
else
|
|
codepoint = ch & 0x07;
|
|
++in;
|
|
if ((*in & 0xc0) != 0x80 && codepoint <= 0x10ffff) {
|
|
if (sizeof(wchar_t) > 2) {
|
|
out.append(1, static_cast<wchar_t>(codepoint));
|
|
} else if (codepoint > 0xffff) {
|
|
out.append(1, static_cast<wchar_t>(0xd800 + (codepoint >> 10)));
|
|
out.append(1, static_cast<wchar_t>(0xdc00 + (codepoint & 0x03ff)));
|
|
} else if (codepoint < 0xd800 || codepoint >= 0xe000) {
|
|
out.append(1, static_cast<wchar_t>(codepoint));
|
|
}
|
|
}
|
|
}
|
|
return out;
|
|
}
|
|
|
|
inline std::string wchar_to_UTF8(const wchar_t* in) {
|
|
std::string out;
|
|
unsigned int codepoint = 0;
|
|
while (*in != 0) {
|
|
if (*in >= 0xd800 && *in <= 0xdbff) {
|
|
codepoint = ((*in - 0xd800) << 10) + 0x10000;
|
|
} else {
|
|
if (*in >= 0xdc00 && *in <= 0xdfff)
|
|
codepoint |= *in - 0xdc00;
|
|
else
|
|
codepoint = *in;
|
|
if (codepoint <= 0x7f) {
|
|
out += static_cast<char>(codepoint);
|
|
} else if (codepoint <= 0x7ff) {
|
|
out += static_cast<char>(0xc0 | ((codepoint >> 6) & 0x1f));
|
|
out += static_cast<char>(0x80 | (codepoint & 0x3f));
|
|
} else if (codepoint <= 0xffff) {
|
|
out += static_cast<char>(0xe0 | ((codepoint >> 12) & 0x0f));
|
|
out += static_cast<char>(0x80 | ((codepoint >> 6) & 0x3f));
|
|
out += static_cast<char>(0x80 | (codepoint & 0x3f));
|
|
} else {
|
|
out += static_cast<char>(0xf0 | ((codepoint >> 18) & 0x07));
|
|
out += static_cast<char>(0x80 | ((codepoint >> 12) & 0x3f));
|
|
out += static_cast<char>(0x80 | ((codepoint >> 6) & 0x3f));
|
|
out += static_cast<char>(0x80 | (codepoint & 0x3f));
|
|
}
|
|
codepoint = 0;
|
|
}
|
|
++in;
|
|
}
|
|
return out;
|
|
}
|
|
|
|
} // namespace gemmi
|
|
#endif
|