ADTF Qt5
Loading...
Searching...
No Matches
qt_string_intf.h
Go to the documentation of this file.
1
7
8namespace adtf
9{
10namespace base
11{
12namespace ant
13{
14
18template<>
19struct adtf_string_forward<QString>
20{
22 mutable ::std::optional<QByteArray> m_oValueToReturnConstChar;
23
25 static constexpr bool is_mutable = true;
26
32 const char* GetConstChar(const QString* const pValue) const
33 {
34 if (pValue != nullptr)
35 {
37 {
38 m_oValueToReturnConstChar = pValue->toLocal8Bit();
39 }
40 return m_oValueToReturnConstChar->constData();
41 }
42 return nullptr;
43 }
44
49 size_t GetCurrentLength(const QString* const pValue) const
50 {
51 if (pValue != nullptr)
52 {
54 {
55 m_oValueToReturnConstChar = pValue->toLocal8Bit();
56 }
57 return m_oValueToReturnConstChar->length();
58 }
59 return IString::InvalidPos;
60 }
61
67 tResult SetValue(QString* const pValue, const char* strValue)
68 {
70 *pValue = QString::fromLocal8Bit(*m_oValueToReturnConstChar);
71 RETURN_NOERROR;
72 }
73};
74
78template<>
79struct adtf_string_forward<const QString> : adtf_string_forward<QString>
80{
82 static constexpr bool is_mutable = false;
83
87 static tResult SetValue(const QString* const /* pValue */, const char* /* strValue */)
88 {
89 RETURN_ERROR(ERR_ACCESS_DENIED);
90 }
91};
92
93} // namespace ant
94} // namespace base
95} // namespace adtf
96
102#define adtf_qstring_intf(q_string_val) adtf_string_intf(q_string_val)
Helper version namespace for extension of adtf_string_forward interfaces.
Definition qt_string_intf.h:13
Helper namespace for extension of adtf_string_forward interfaces.
Definition qt_string_intf.h:11
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtfui_pkg.h:13
mutable ::std::optional< QByteArray > m_oValueToReturnConstChar
Cached value to return const char pointer.
Definition qt_string_intf.h:22
static constexpr bool is_mutable
Indicates that the string is mutable.
Definition qt_string_intf.h:25
size_t GetCurrentLength(const QString *const pValue) const
Definition qt_string_intf.h:49
const char * GetConstChar(const QString *const pValue) const
Definition qt_string_intf.h:32
tResult SetValue(QString *const pValue, const char *strValue)
Definition qt_string_intf.h:67
static constexpr bool is_mutable
Indicates that the string is not mutable.
Definition qt_string_intf.h:82
static tResult SetValue(const QString *const, const char *)
Definition qt_string_intf.h:87