forked from aws/aws-iot-device-sdk-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utf8String.hpp
59 lines (46 loc) · 1.88 KB
/
Utf8String.hpp
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
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/**
* @file Utf8String.hpp
* @brief
*
*/
#pragma once
#include <memory>
#include "util/memory/stl/String.hpp"
namespace awsiotsdk {
class Utf8String {
protected:
util::String data;
std::size_t length;
Utf8String(util::String str);
Utf8String(const char *str, std::size_t length);
static bool IsValidInput(util::String str);
static bool IsValidInput(const char *str, std::size_t length);
public:
// Rule of 5 stuff
// Disabling default constructor while keeping defaults for the rest
Utf8String() = delete; // Delete Default constructor
Utf8String(const Utf8String &) = default; // Copy constructor
Utf8String(Utf8String &&) = default; // Move constructor
Utf8String &operator=(const Utf8String &) & = default; // Copy assignment operator
Utf8String &operator=(Utf8String &&) & = default; // Move assignment operator
~Utf8String() = default; // Default destructor
static std::unique_ptr<Utf8String> Create(util::String str);
static std::unique_ptr<Utf8String> Create(const char *str, std::size_t length);
std::size_t Length();
util::String ToStdString();
};
}