libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
Utf16String.hh
Go to the documentation of this file.
1/*
2 * Copyright 2021 Assured Information Security, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <introvirt/util/json/json.hh>
19
20#include <cstdint>
21#include <memory>
22#include <ostream>
23#include <string>
24#include <string_view>
25
26namespace introvirt {
27namespace windows {
28
35 public:
39 virtual uint16_t Length() const = 0;
40
44 virtual const uint8_t* Buffer() const = 0;
45
49 const std::string& utf8() const;
50
54 const std::u16string& utf16() const;
55
63 void set(const std::string& value);
64
68 virtual void set(const std::u16string& value) = 0;
69
73 operator const std::u16string&() const;
74
75 public:
79 bool operator==(const std::string&) const;
80 bool operator==(const std::u16string&) const;
81
85 bool operator<(const std::string&) const;
86 bool operator<(const std::u16string&) const;
87
91 bool equals(const std::string&) const;
92 bool equals(const std::u16string&) const;
93
97 bool iequals(const std::string&) const;
98 bool iequals(const std::u16string&) const;
99
103 bool starts_with(const std::string&) const;
104 bool starts_with(const std::u16string&) const;
105
109 bool istarts_with(const std::string&) const;
110 bool istarts_with(const std::u16string&) const;
111
115 bool ends_with(const std::string&) const;
116 bool ends_with(const std::u16string&) const;
117
121 bool iends_with(const std::string&) const;
122 bool iends_with(const std::u16string&) const;
123
124 public:
126 virtual ~Utf16String();
127
128 void write(std::ostream& os, const std::string& linePrefix = "") const;
129 virtual Json::Value json() const;
130
131 // Move semantics
133 Utf16String& operator=(Utf16String&&) noexcept;
134
135 static const size_t npos;
136
137 protected:
142
143 public:
148 static std::string convert(std::u16string_view src);
149
154 static std::u16string convert(std::string_view src);
155
156 private:
157 class IMPL;
158 std::unique_ptr<IMPL> pImpl;
159};
160
161const std::string& to_string(const Utf16String&);
162std::ostream& operator<<(std::ostream& os, const Utf16String& str);
163
164} /* namespace windows */
165} /* namespace introvirt */
Base UTF-16 class.
Definition Utf16String.hh:34
bool operator<(const std::string &) const
bool operator==(const std::string &) const
virtual const uint8_t * Buffer() const =0
bool iequals(const std::string &) const
const std::u16string & utf16() const
Utf16String(Utf16String &&) noexcept
virtual Json::Value json() const
bool istarts_with(const std::u16string &) const
bool operator==(const std::u16string &) const
bool ends_with(const std::u16string &) const
bool iends_with(const std::u16string &) const
bool iequals(const std::u16string &) const
const std::string & utf8() const
void set(const std::string &value)
Sets the value of the string.
virtual void set(const std::u16string &value)=0
Sets the value of the string.
bool starts_with(const std::string &) const
bool equals(const std::string &) const
bool starts_with(const std::u16string &) const
bool equals(const std::u16string &) const
static const size_t npos
Definition Utf16String.hh:135
bool istarts_with(const std::string &) const
static std::string convert(std::u16string_view src)
Convert a UTF16 string to UTF8.
bool ends_with(const std::string &) const
bool iends_with(const std::string &) const
void write(std::ostream &os, const std::string &linePrefix="") const
bool operator<(const std::u16string &) const
virtual uint16_t Length() const =0
const std::string & to_string(const Utf16String &)
Core IntroVirt classes.
Definition Cr0.hh:20