Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
jaulib
include
jau
dfa_utf8_decode.hpp
Go to the documentation of this file.
1
/*
2
* Author: Sven Gothel <sgothel@jausoft.com>
3
* Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de> (see details below)
4
* Copyright (c) 2020 Gothel Software e.K.
5
* Copyright (c) 2020 ZAFENA AB
6
*
7
* Permission is hereby granted, free of charge, to any person obtaining
8
* a copy of this software and associated documentation files (the
9
* "Software"), to deal in the Software without restriction, including
10
* without limitation the rights to use, copy, modify, merge, publish,
11
* distribute, sublicense, and/or sell copies of the Software, and to
12
* permit persons to whom the Software is furnished to do so, subject to
13
* the following conditions:
14
*
15
* The above copyright notice and this permission notice shall be
16
* included in all copies or substantial portions of the Software.
17
*
18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
*/
26
27
#ifndef JAU_DFA_UTF8_DECODE_HPP_
28
#define JAU_DFA_UTF8_DECODE_HPP_
29
30
#define DFA_UTF8_ACCEPT 0
31
#define DFA_UTF8_REJECT 12
32
33
#include <string>
34
#include <cstdint>
35
#include <cinttypes>
36
37
namespace
jau
{
38
uint32_t
dfa_utf8_decode
(uint32_t & state, uint32_t & codep,
const
uint32_t byte_value);
39
40
/**
41
* Returns all valid consecutive UTF-8 characters within buffer
42
* in the range up to buffer_size or until EOS.
43
* <p>
44
* In case a non UTF-8 character has been detected,
45
* the content will be cut off and the decoding loop ends.
46
* </p>
47
* <p>
48
* Method utilizes a finite state machine detecting variable length UTF-8 codes.
49
* See Bjoern Hoehrmann's site <http://bjoern.hoehrmann.de/utf-8/decoder/dfa/> for details.
50
* </p>
51
*/
52
std::string
dfa_utf8_decode
(
const
uint8_t *buffer,
const
size_t
buffer_size);
53
}
/* namespace jau */
54
55
#endif
/* JAU_DFA_UTF8_DECODE_HPP_ */
jau
Definition:
basic_algos.hpp:34
jau::dfa_utf8_decode
uint32_t dfa_utf8_decode(uint32_t &state, uint32_t &codep, const uint32_t byte_value)
Definition:
dfa_utf8_decode.cpp:90
Generated on Wed Sep 1 2021 22:27:56 for Direct-BT by
1.8.18