nsComposeTxtSrvFilter.h (1235B)
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 nsComposeTxtSrvFilter_h__ 7 #define nsComposeTxtSrvFilter_h__ 8 9 #include "mozilla/UniquePtr.h" 10 11 class nsINode; 12 13 /** 14 * This class enables those using it to skip over certain nodes when 15 * traversing content. 16 * 17 * This filter is used to skip over various form control nodes and 18 * mail's cite nodes 19 */ 20 class nsComposeTxtSrvFilter final { 21 public: 22 static mozilla::UniquePtr<nsComposeTxtSrvFilter> CreateNormalFilter() { 23 return CreateHelper(false); 24 } 25 static mozilla::UniquePtr<nsComposeTxtSrvFilter> CreateMailFilter() { 26 return CreateHelper(true); 27 } 28 29 /** 30 * Indicates whether the content node should be skipped by the iterator 31 * @param aNode - node to skip 32 */ 33 bool Skip(nsINode* aNode) const; 34 35 private: 36 // Helper - Intializer 37 void Init(bool aIsForMail) { mIsForMail = aIsForMail; } 38 39 static mozilla::UniquePtr<nsComposeTxtSrvFilter> CreateHelper( 40 bool aIsForMail); 41 42 bool mIsForMail = false; 43 }; 44 45 #endif