Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head There was a failure building this commit
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head There was a failure building this commit
### Issues * \#1 \[bug\] Unable to mount S3 due to 'item_not_found' exception * \#2 Require bucket name for S3 mounts * \#3 \[bug\] File size is not being updated in S3 mount * \#4 Upgrade to libfuse-3.x.x * \#5 Switch to renterd for Sia support * \#6 Switch to cpp-httplib to further reduce dependencies * \#7 Remove global_data and calculate used disk space per provider * \#8 Switch to libcurl for S3 mount support ### Changes from v1.x.x * Added read-only encrypt provider * Pass-through mount point that transparently encrypts source data using `XChaCha20-Poly1305` * Added S3 encryption support via `XChaCha20-Poly1305` * Added replay protection to remote mounts * Added support base64 writes in remote FUSE * Created static linked Linux binaries for `amd64` and `aarch64` using `musl-libc` * Removed legacy Sia renter support * Removed Skynet support * Fixed multiple remote mount WinFSP API issues on \*NIX servers * Implemented chunked read and write * Writes for non-cached files are performed in chunks of 8Mib * Removed `repertory-ui` support * Removed `FreeBSD` support * Switched to `libsodium` over `CryptoPP` * Switched to `XChaCha20-Poly1305` for remote mounts * Updated `GoogleTest` to v1.14.0 * Updated `JSON for Modern C++` to v3.11.2 * Updated `OpenSSL` to v1.1.1w * Updated `RocksDB` to v8.5.3 * Updated `WinFSP` to 2023 * Updated `boost` to v1.78.0 * Updated `cURL` to v8.3.0 * Updated `zlib` to v1.3 * Use `upload_manager` for all providers * Adds a delay to uploads to prevent excessive API calls * Supports re-upload after mount restart for incomplete uploads * NOTE: Uploads for all providers are full file (no resume support) * Multipart upload support is planned for S3 Reviewed-on: #9
98 lines
3.0 KiB
C++
98 lines
3.0 KiB
C++
#include "pugixml.hpp"
|
|
|
|
#include <fstream>
|
|
#include <iomanip>
|
|
#include <iostream>
|
|
|
|
void print_doc(const char* message, const pugi::xml_document& doc, const pugi::xml_parse_result& result)
|
|
{
|
|
std::cout
|
|
<< message
|
|
<< "\t: load result '" << result.description() << "'"
|
|
<< ", first character of root name: U+" << std::hex << std::uppercase << std::setw(4) << std::setfill('0') << pugi::as_wide(doc.first_child().name())[0]
|
|
<< ", year: " << doc.first_child().first_child().first_child().child_value()
|
|
<< std::endl;
|
|
}
|
|
|
|
bool try_imbue(std::wistream& stream, const char* name)
|
|
{
|
|
try
|
|
{
|
|
stream.imbue(std::locale(name));
|
|
|
|
return true;
|
|
}
|
|
catch (const std::exception&)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
int main()
|
|
{
|
|
pugi::xml_document doc;
|
|
|
|
{
|
|
// tag::code[]
|
|
std::ifstream stream("weekly-utf-8.xml");
|
|
pugi::xml_parse_result result = doc.load(stream);
|
|
// end::code[]
|
|
|
|
// first character of root name: U+9031, year: 1997
|
|
print_doc("UTF8 file from narrow stream", doc, result);
|
|
}
|
|
|
|
{
|
|
std::ifstream stream("weekly-utf-16.xml");
|
|
pugi::xml_parse_result result = doc.load(stream);
|
|
|
|
// first character of root name: U+9031, year: 1997
|
|
print_doc("UTF16 file from narrow stream", doc, result);
|
|
}
|
|
|
|
{
|
|
// Since wide streams are treated as UTF-16/32 ones, you can't load the UTF-8 file from a wide stream
|
|
// directly if you have localized characters; you'll have to provide a UTF8 locale (there is no
|
|
// standard one; you can use utf8_codecvt_facet from Boost or codecvt_utf8 from C++0x)
|
|
std::wifstream stream("weekly-utf-8.xml");
|
|
|
|
if (try_imbue(stream, "en_US.UTF-8")) // try Linux encoding
|
|
{
|
|
pugi::xml_parse_result result = doc.load(stream);
|
|
|
|
// first character of root name: U+00E9, year: 1997
|
|
print_doc("UTF8 file from wide stream", doc, result);
|
|
}
|
|
else
|
|
{
|
|
std::cout << "UTF-8 locale is not available\n";
|
|
}
|
|
}
|
|
|
|
{
|
|
// Since wide streams are treated as UTF-16/32 ones, you can't load the UTF-16 file from a wide stream without
|
|
// using custom codecvt; you can use codecvt_utf16 from C++0x
|
|
}
|
|
|
|
{
|
|
// Since encoding names are non-standard, you can't load the Shift-JIS (or any other non-ASCII) file
|
|
// from a wide stream portably
|
|
std::wifstream stream("weekly-shift_jis.xml");
|
|
|
|
if (try_imbue(stream, ".932") || // try Microsoft encoding
|
|
try_imbue(stream, "ja_JP.SJIS")) // try Linux encoding; run "localedef -i ja_JP -c -f SHIFT_JIS /usr/lib/locale/ja_JP.SJIS" to get it
|
|
{
|
|
pugi::xml_parse_result result = doc.load(stream);
|
|
|
|
// first character of root name: U+9031, year: 1997
|
|
print_doc("Shift-JIS file from wide stream", doc, result);
|
|
}
|
|
else
|
|
{
|
|
std::cout << "Shift-JIS locale is not available\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
// vim:et
|