Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
CharacterEncodingException.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Characters_CharacterEncodingException_h_
5#define _Stroika_Foundation_Characters_CharacterEncodingExceptionm_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <optional>
10
11#include "Stroika/Foundation/Execution/Exceptions.h"
12
13/**
14 * \file
15 *
16 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
17 */
18
20
21 /**
22 * \brief - An error occurred encoding or decoding a character
23 *
24 * TODO:
25 * @todo Do more to construct these with valid 'encoding' - so calls / failures can see what not only the character offset, but the
26 * encoding converting to/from where there is a problem (like turkish, or UTF-8, etc).
27 */
29 private:
31
32 public:
34 /**
35 * CharactersToBytes
36 */
38 /**
39 * BytesToCharacters
40 */
42 };
43
44 public:
45 CharacterEncodingException (EncodingOrDecoding encodingOrDecoding, optional<size_t> atSourceOffset = nullopt,
46 const optional<String>& encoding = nullopt);
47
48 public:
49 nonvirtual EncodingOrDecoding GetEncodingOrDecoding () const;
50
51 public:
52 nonvirtual optional<size_t> GetAtSourceOffset () const;
53
54 public:
55 /**
56 * Returns the (print name - not enumeration) of the encoding (if known) the character was being encoded into or from
57 */
58 nonvirtual optional<String> GetEncodiing () const;
59
60 public:
61 /**
62 */
63 static const CharacterEncodingException kTheEncoding;
64 static const CharacterEncodingException kTheDecoding;
65
66 private:
67 EncodingOrDecoding fEncodingOrDecoding_{};
68 optional<size_t> fAtSourceOffset_{};
69 optional<String> fEncoding_;
70 };
71 inline const CharacterEncodingException CharacterEncodingException::kTheEncoding{CharacterEncodingException::eEncoding};
72 inline const CharacterEncodingException CharacterEncodingException::kTheDecoding{CharacterEncodingException::eDecoding};
73
74}
75
76/*
77 ********************************************************************************
78 ***************************** Implementation Details ***************************
79 ********************************************************************************
80 */
81#include "CharacterEncodingException.inl"
82
83#endif /*_Stroika_Foundation_Characters_CharacterEncodingException_h_*/
An error occurred encoding or decoding a character