eVaf
util.h
Go to the documentation of this file.
1 
20 #ifndef __COMMON_UTIL_H
21 # define __COMMON_UTIL_H
22 
23 #include "libcommon.h"
24 
25 #include <QString>
26 #include <QVariant>
27 
28 namespace eVaf {
29 namespace Common {
30 
39 inline bool isTrue(QString const & str)
40 {
41  return str == "1" || str.toLower() == "yes" || str.toLower() == "true" || str.toLower() == "on";
42 }
43 
52 inline bool isFalse(QString const & str)
53 {
54  return str == "0" || str.toLower() == "no" || str.toLower() == "false" || str.toLower() == "off";
55 }
56 
79 COMMON_EXPORT QVariant toVariant(QString const & value, QVariant const & defaultValue);
80 
93 COMMON_EXPORT QByteArray strToEscapedCharArray(QString const & str);
94 
103 COMMON_EXPORT QString strFromEscapedCharArray(QByteArray const & str);
104 
117 COMMON_EXPORT QByteArray binToEscapedCharArray(QByteArray const & src);
118 
127 COMMON_EXPORT QByteArray binFromEscapedCharArray(QByteArray const & str);
128 
129 } // namespace eVaf::Common
130 } // namespace eVaf
131 
132 #endif // util.h
#define COMMON_EXPORT
Definition: libcommon.h:27
bool isTrue(QString const &str)
Tests if the string means &#39;true&#39;.
Definition: util.h:39
bool isFalse(QString const &str)
Tests if the string means &#39;false&#39;.
Definition: util.h:52
COMMON_EXPORT QString strFromEscapedCharArray(QByteArray const &str)
Converts escaped 7-bit character arrays to unicode string.
COMMON_EXPORT QByteArray binFromEscapedCharArray(QByteArray const &str)
Converts escaped 7-bit character arrays to binary arrays.
Global eVaf namespace.
Definition: engine.h:37
COMMON_EXPORT QByteArray strToEscapedCharArray(QString const &str)
Converts unicode strings to escaped 7-bit character arrays.
COMMON_EXPORT QByteArray binToEscapedCharArray(QByteArray const &src)
Converts binary arrays to escaped 7-bit character arrays.
COMMON_EXPORT QVariant toVariant(QString const &value, QVariant const &defaultValue)
Converts strings to variant values.