blob: e4fddcb907ea95e97b1a414d65ce372d64de8fe4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#ifndef URI_PERCENT_ENCODED_CHARACTER_DECODER_HPP
#define URI_PERCENT_ENCODED_CHARACTER_DECODER_HPP
/**
* @file PercentEncodedCharacterDecoder.hpp
*
* This module declares the Uri::PercentEncodedCharacterDecoder class.
*
* © 2018 by Richard Walters
*/
#include <memory>
#include <stddef.h>
namespace Uri {
/**
* This class can take in a percent-encoded character,
* decode it, and also detect if there are any problems in the encoding.
*/
class PercentEncodedCharacterDecoder {
// Lifecycle management
public:
~PercentEncodedCharacterDecoder() noexcept;
PercentEncodedCharacterDecoder(const PercentEncodedCharacterDecoder&) = delete;
PercentEncodedCharacterDecoder(PercentEncodedCharacterDecoder&&) noexcept;
PercentEncodedCharacterDecoder& operator=(const PercentEncodedCharacterDecoder&) = delete;
PercentEncodedCharacterDecoder& operator=(PercentEncodedCharacterDecoder&&) noexcept;
// Methods
public:
/**
* This is the default constructor.
*/
PercentEncodedCharacterDecoder();
/**
* This method inputs the next encoded character.
*
* @param[in] c
* This is the next encoded character to give to the decoder.
*
* @return
* An indication of whether or not the encoded character
* was accepted is returned.
*/
bool NextEncodedCharacter(char c);
/**
* This method checks to see if the decoder is done
* and has decoded the encoded character.
*
* @return
* An indication of whether or not the decoder is done
* and has decoded the encoded character is returned.
*/
bool Done() const;
/**
* This method returns the decoded character, once
* the decoder is done.
*
* @return
* The decoded character is returned.
*/
char GetDecodedCharacter() const;
// Properties
private:
/**
* This is the type of structure that contains the private
* properties of the instance. It is defined in the implementation
* and declared here to ensure that it is scoped inside the class.
*/
struct Impl;
/**
* This contains the private properties of the instance.
*/
std::unique_ptr< struct Impl > impl_;
};
}
#endif /* URI_PERCENT_ENCODED_CHARACTER_DECODER_HPP */
|