X-Git-Url: https://vaikene.ee/gitweb/highlight.css?a=blobdiff_plain;f=src%2Flibs%2FCommon%2Futil.h;h=8237e7c76c0cc526abb5ecb488802f098dc570c2;hb=bb631d7ca67c86dd758428fb0e18b905514a16e3;hp=de094b3e791d85ef6caec890a532f521709e1617;hpb=926606ce83f3a702d67c5c2c42478b091f78fdc4;p=evaf diff --git a/src/libs/Common/util.h b/src/libs/Common/util.h index de094b3..8237e7c 100644 --- a/src/libs/Common/util.h +++ b/src/libs/Common/util.h @@ -83,20 +83,42 @@ COMMON_EXPORT QVariant toVariant(QString const & value, QVariant const & default * * This function converts a unicode (or any) string to the escaped 7-bit character array. Characters that cannot * be output directly as a printable 7-bit character are output as numeric character references. The result can be - * directly inserted into XML or HTML documents and later converted back with the eVaf::Common::fromEscapedString() + * directly inserted into XML or HTML documents and later converted back with the eVaf::Common::strFromEscapedCharArray() * function. */ -COMMON_EXPORT QByteArray toEscapedString(QString const & str); +COMMON_EXPORT QByteArray strToEscapedCharArray(QString const & str); /** * Converts escaped 7-bit character arrays to unicode string. * @param str Escaped 7-bit character array * @return Unicode string * - * This function converts an escaped 7-bit character array to a unicode string. Numeric character references and + * This function converts an escaped 7-bit character array to the unicode string. Numeric character references and * character entity references are expanded to actual unicode characters. */ -COMMON_EXPORT QString fromEscapedString(QByteArray const & str); +COMMON_EXPORT QString strFromEscapedCharArray(QByteArray const & str); + +/** + * Converts binary arrays to escaped 7-bit character arrays + * @param src Binary array + * @return Escaped 7-bit character array + * + * This function converts a binary array to the escaped 7-bit character array. Bytes that cannot be output + * directly as printable 7-bit characters are output as numeric character references. The result can be directly + * inserted into XML or HTML documents and later converted back with the eVaf::Common::binFromEscapedCharArray() + * function. + */ +COMMON_EXPORT QByteArray binToEscapedCharArray(QByteArray const & src); + +/** + * Converts escaped 7-bit character arrays to binary arrays + * @param str Escaped 7-bit character array + * @return Binary array + * + * This function converts an escaped 7-bit character array to the binary array. Numeric character references and + * character entoty references are expanded to characters and binary bytes. + */ +COMMON_EXPORT QByteArray binFromEscapedCharArray(QByteArray const & str); } // namespace eVaf::Common } // namespace eVaf