Index: sources/utility/format.cpp =================================================================== diff -u -r44a85c96ab55e424866ec4cca0270aa218355f82 -r618891879f5cdc68e37ee68eea005afb76dd4e5b --- sources/utility/format.cpp (.../format.cpp) (revision 44a85c96ab55e424866ec4cca0270aa218355f82) +++ sources/utility/format.cpp (.../format.cpp) (revision 618891879f5cdc68e37ee68eea005afb76dd4e5b) @@ -1,16 +1,16 @@ /*! - * + * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * + * * \file format.cpp * \author (last) Behrouz NematiPour * \date (last) 07-May-2020 * \author (original) Behrouz NematiPour * \date (original) 16-Dec-2019 - * + * */ #include "format.h" @@ -46,7 +46,7 @@ * \param vData - The value * \return The QByteAttay of the value vData if can't be converted 0x00 will be returned * \note Regarding the QVariant type conversion, if cannot be converted 0 will be returned - * This rule has been used and also to be consistent followed the sae rule. + * This rule has been used and also to be consistent followed the same rule. * \note This method converts both float and double to F32 and returns its QByteArray representation. */ QByteArray Format::fromVariant(const QVariant &vData) @@ -100,3 +100,19 @@ mData += '\0'; return mData; } + +QStringList Format::toStringList(const QList vList, bool vRemoveDuplicate, QString vPrefix) +{ + QStringList list; + for (const auto &listItem : vList) { + auto item = vPrefix + listItem; + if ( vRemoveDuplicate ) { + if ( ! list.contains(item) ) { + list += item; + } + } + else + list += item; + } + return list; +}