LCOV - code coverage report
Current view: top level - editor/libeditor - DeleteTextTransaction.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; 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 DeleteTextTransaction_h
       7             : #define DeleteTextTransaction_h
       8             : 
       9             : #include "mozilla/EditTransactionBase.h"
      10             : #include "nsCOMPtr.h"
      11             : #include "nsCycleCollectionParticipant.h"
      12             : #include "nsGenericDOMDataNode.h"
      13             : #include "nsID.h"
      14             : #include "nsString.h"
      15             : #include "nscore.h"
      16             : 
      17             : namespace mozilla {
      18             : 
      19             : class EditorBase;
      20             : class RangeUpdater;
      21             : 
      22             : /**
      23             :  * A transaction that removes text from a content node.
      24             :  */
      25           0 : class DeleteTextTransaction final : public EditTransactionBase
      26             : {
      27             : public:
      28             :   /**
      29             :    * Initialize the transaction.
      30             :    * @param aEditorBase         The provider of basic editing operations.
      31             :    * @param aElement            The content node to remove text from.
      32             :    * @param aOffset             The location in aElement to begin the deletion.
      33             :    * @param aNumCharsToDelete   The number of characters to delete.  Not the
      34             :    *                            number of bytes!
      35             :    */
      36             :   DeleteTextTransaction(EditorBase& aEditorBase,
      37             :                         nsGenericDOMDataNode& aCharData,
      38             :                         uint32_t aOffset,
      39             :                         uint32_t aNumCharsToDelete,
      40             :                         RangeUpdater* aRangeUpdater);
      41             : 
      42             :   /**
      43             :    * CanDoIt() returns true if there are enough members and can modify the
      44             :    * text.  Otherwise, false.
      45             :    */
      46             :   bool CanDoIt() const;
      47             : 
      48           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTransaction,
      49             :                                            EditTransactionBase)
      50             :   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
      51             : 
      52             :   NS_DECL_EDITTRANSACTIONBASE
      53             : 
      54           0 :   uint32_t GetOffset() { return mOffset; }
      55             : 
      56           0 :   uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; }
      57             : 
      58             : protected:
      59             :   // The provider of basic editing operations.
      60             :   RefPtr<EditorBase> mEditorBase;
      61             : 
      62             :   // The CharacterData node to operate upon.
      63             :   RefPtr<nsGenericDOMDataNode> mCharData;
      64             : 
      65             :   // The offset into mCharData where the deletion is to take place.
      66             :   uint32_t mOffset;
      67             : 
      68             :   // The number of characters to delete.
      69             :   uint32_t mNumCharsToDelete;
      70             : 
      71             :   // The text that was deleted.
      72             :   nsString mDeletedText;
      73             : 
      74             :   // Range updater object.
      75             :   RangeUpdater* mRangeUpdater;
      76             : };
      77             : 
      78             : } // namespace mozilla
      79             : 
      80             : #endif // #ifndef DeleteTextTransaction_h

Generated by: LCOV version 1.13