BashSpark
Loading...
Searching...
No Matches
utf.h File Reference

Provides simple tools for utf string manipulation. More...

#include <iomanip>
#include <regex>
#include <cstdint>
#include <iostream>
#include "BashSpark/tools/fakestream.h"
Include dependency graph for utf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  bs
 BashSpark main namespace.
 

Functions

constexpr char32_t bs::combine_surrogates (const char16_t high, const char16_t low)
 Combines high and low UTF-16 surrogates into a UTF-32 code point.
 
std::string bs::to_hex_string (const char32_t cChar, const std::size_t nLength)
 Converts a UTF-32 character to a hexadecimal string representation.
 
void bs::write_char32_t (ofakestream &oStream, const char32_t cChar)
 Writes a UTF-32 character to an output stream in UTF-8 encoding.
 
std::string bs::write_char32_t (const char32_t cChar)
 Converts a UTF-32 character to a UTF-8 encoded string.
 
bool bs::parse_utf (ifakestream &oIstream, const std::size_t nCount, char32_t &cResult)
 Parses a UTF-n encoded character from an input stream.
 

Detailed Description

Provides simple tools for utf string manipulation.

Author
Dante Doménech Martínez
Date
21/11/25

This file is part of BashSpark. Copyright (c) 2025 Dante Doménech Martínez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.