1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef txBufferingHandler_h__ 7 #define txBufferingHandler_h__ 8 9 #include "mozilla/UniquePtr.h" 10 #include "txXMLEventHandler.h" 11 #include "nsString.h" 12 #include "nsTArray.h" 13 14 class txOutputTransaction; 15 16 class txResultBuffer { 17 public: 18 txResultBuffer(); 19 ~txResultBuffer(); 20 21 nsresult addTransaction(txOutputTransaction* aTransaction); 22 23 nsresult flushToHandler(txAXMLEventHandler* aHandler); 24 25 txOutputTransaction* getLastTransaction(); 26 27 nsString mStringValue; 28 29 private: 30 nsTArray<txOutputTransaction*> mTransactions; 31 }; 32 33 class txBufferingHandler : public txAXMLEventHandler { 34 public: 35 txBufferingHandler(); 36 virtual ~txBufferingHandler(); 37 38 TX_DECL_TXAXMLEVENTHANDLER 39 40 protected: 41 mozilla::UniquePtr<txResultBuffer> mBuffer; 42 bool mCanAddAttribute; 43 }; 44 45 #endif /* txBufferingHandler_h__ */ 46