Program Listing for File text.hpp

Return to documentation for file (zeem/text.hpp)

// Copyright (c) 2024-2026 Maarten L. Hekkelman
// SPDX-License-Identifier: BSD-2-Clause

#pragma once

#ifndef ZEEM_CXX_MODULE
# include <string>
# include <string_view>
#endif

namespace zeem
{


ZEEM_EXPORT bool is_name_start_char(char32_t uc);
ZEEM_EXPORT bool is_name_char(char32_t uc);
ZEEM_EXPORT bool is_space(char32_t uc);
ZEEM_EXPORT bool is_valid_xml_1_0_char(char32_t uc);
ZEEM_EXPORT bool is_valid_xml_1_1_char(char32_t uc);
ZEEM_EXPORT bool is_valid_system_literal_char(char32_t uc);
ZEEM_EXPORT bool is_valid_system_literal(std::string_view s);
ZEEM_EXPORT bool is_valid_public_id_char(char32_t uc);
ZEEM_EXPORT bool is_valid_public_id(std::string_view s);

ZEEM_EXPORT enum class encoding_type {
    ASCII,
    UTF8,
    UTF16BE,
    UTF16LE,
    ISO88591
};

ZEEM_EXPORT void append(std::string &s, char32_t uc);

ZEEM_EXPORT char32_t pop_back_char(std::string &s);

ZEEM_EXPORT char32_t pop_front_char(std::string::const_iterator &ptr, std::string::const_iterator end);

ZEEM_EXPORT char32_t pop_front_char(std::string_view::const_iterator &ptr, std::string_view::const_iterator end);

ZEEM_EXPORT void trim(std::string &s);

} // namespace zeem