summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-07-13 21:34:41 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-07-16 18:25:25 +0200
commit2c4c08320532d2edfbd53d1bb0c45e7448caf004 (patch)
tree3b6d4be4f7842504067c71280d349bdc4620ba38 /include/comphelper
parent392c3b9093fdc8d64a2db2c98d070c2b0fd833aa (diff)
comphelper: move base64 encode/decode helpers from sax
Change-Id: I02e33793736003f36976bc8b518c389a31082dbe Reviewed-on: https://gerrit.libreoffice.org/39991 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/base64.hxx52
1 files changed, 52 insertions, 0 deletions
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 <comphelper/comphelperdllapi.h>
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+namespace comphelper {
+
+class COMPHELPER_DLLPUBLIC Base64
+{
+public:
+ /** encodes the given byte sequence into Base64 */
+ static void encode(OUStringBuffer& aStrBuffer, const css::uno::Sequence<sal_Int8>& 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<sal_Int8>& aPass, const OUString& sBuffer);
+
+ static sal_Int32 decodeSomeChars(css::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
+};
+
+}
+
+#endif // INCLUDED_COMPHELPER_BASE64_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */