michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef NSBASE64ENCODER_H_ michael@0: #define NSBASE64ENCODER_H_ michael@0: michael@0: #include "nsIOutputStream.h" michael@0: #include "nsString.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: /** michael@0: * A base64 encoder. Usage: Instantiate class, write to it using michael@0: * Write(), then call Finish() to get the base64-encoded data. michael@0: */ michael@0: class nsBase64Encoder MOZ_FINAL : public nsIOutputStream { michael@0: public: michael@0: nsBase64Encoder() {} michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIOUTPUTSTREAM michael@0: michael@0: nsresult Finish(nsCSubstring& _result); michael@0: private: michael@0: ~nsBase64Encoder() {} michael@0: michael@0: /// The data written to this stream. nsCString can deal fine with michael@0: /// binary data. michael@0: nsCString mData; michael@0: }; michael@0: michael@0: #endif