Changeset b26dc16dcf in tspsg for src/globals.h


Ignore:
Timestamp:
Sep 10, 2012, 10:40:06 AM (12 years ago)
Author:
Oleksii Serdiuk
Branches:
appveyor, imgbot, master, readme
Children:
f48433245d
Parents:
bf92f16303
git-author:
Oleksii Serdiuk <contacts@…> (09/10/12 10:40:06)
git-committer:
Oleksii Serdiuk <contacts@…> (09/10/12 13:33:32)
Message:

Some refactoring for the things to come...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/globals.h

    rbf92f16303 rb26dc16dcf  
    138138}
    139139
     140/*!
     141 * \brief Converts \a in into Base64 format with lines wrapped at 64 characters.
     142 * \param in A byte array to be converted.
     143 * \return Converted byte array.
     144 */
     145inline QByteArray toWrappedBase64(const QByteArray &in)
     146{
     147    QByteArray out, base64(in.toBase64());
     148    for (int i = 0; i <= base64.size() - 64; i += 64) {
     149        out.append(QByteArray::fromRawData(base64.data() + i, 64)).append('\n');
     150    }
     151    if (int rest = base64.size() % 64)
     152        out.append(QByteArray::fromRawData(base64.data() + base64.size() - rest, rest));
     153    return out;
     154}
     155
    140156#ifndef HANDHELD
    141157/*!
Note: See TracChangeset for help on using the changeset viewer.