From 2c4c08320532d2edfbd53d1bb0c45e7448caf004 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Thu, 13 Jul 2017 21:34:41 -0400 Subject: comphelper: move base64 encode/decode helpers from sax Change-Id: I02e33793736003f36976bc8b518c389a31082dbe Reviewed-on: https://gerrit.libreoffice.org/39991 Tested-by: Jenkins Reviewed-by: Ashod Nakashian --- include/comphelper/base64.hxx | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 include/comphelper/base64.hxx (limited to 'include/comphelper') diff --git a/include/comphelper/base64.hxx b/include/comphelper/base64.hxx new file mode 100644 index 000000000000..302b0ab51d09 --- /dev/null +++ b/include/comphelper/base64.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_COMPHELPER_BASE64_HXX +#define INCLUDED_COMPHELPER_BASE64_HXX + +#include + +#include +#include +#include +#include + +namespace comphelper { + +class COMPHELPER_DLLPUBLIC Base64 +{ +public: + /** encodes the given byte sequence into Base64 */ + static void encode(OUStringBuffer& aStrBuffer, const css::uno::Sequence& aPass); + + // Decode a base 64 encoded string into a sequence of bytes. The first + // version can be used for attribute values only, because it does not + // return any chars left from conversion. + // For text submitted throgh the SAX characters call, the later method + // must be used! + static void decode(css::uno::Sequence& aPass, const OUString& sBuffer); + + static sal_Int32 decodeSomeChars(css::uno::Sequence& aPass, const OUString& sBuffer); +}; + +} + +#endif // INCLUDED_COMPHELPER_BASE64_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit