1 ///###//////////////////////////////////////////////////////////////////////// 2 // 3 // Burton Computer Corporation 4 // http://www.burton-computer.com 5 // http://www.cooldevtools.com 6 // $Id: ParserConfig.h 272 2007-01-06 19:37:27Z brian $ 7 // 8 // Copyright (C) 2007 Burton Computer Corporation 9 // ALL RIGHTS RESERVED 10 // 11 // This program is open source software; you can redistribute it 12 // and/or modify it under the terms of the Q Public License (QPL) 13 // version 1.0. Use of this software in whole or in part, including 14 // linking it (modified or unmodified) into other programs is 15 // subject to the terms of the QPL. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // Q Public License for more details. 21 // 22 // You should have received a copy of the Q Public License 23 // along with this program; see the file LICENSE.txt. If not, visit 24 // the Burton Computer Corporation or CoolDevTools web site 25 // QPL pages at: 26 // 27 // http://www.burton-computer.com/qpl.html 28 // http://www.cooldevtools.com/qpl.html 29 // 30 31 #ifndef _ParserConfig_h 32 #define _ParserConfig_h 33 34 #include "HeaderPrefixList.h" 35 36 class ParserConfig 37 { 38 public: 39 ParserConfig(); 40 ~ParserConfig(); 41 setReplaceNonAsciiChars(int value)42 void setReplaceNonAsciiChars(int value) 43 { 44 if (value > 0) { 45 m_replaceNonAsciiChars = true; 46 m_nonAsciiChar = tolower((char)value); 47 } else { 48 m_replaceNonAsciiChars = false; 49 m_nonAsciiChar = 0; 50 } 51 } 52 getReplaceNonAsciiChars()53 bool getReplaceNonAsciiChars() const 54 { 55 return m_replaceNonAsciiChars; 56 } 57 getNonAsciiCharReplacement()58 char getNonAsciiCharReplacement() const 59 { 60 return m_nonAsciiChar; 61 } 62 getMinTermLength()63 string::size_type getMinTermLength() const 64 { 65 return m_minTermLength; 66 } 67 getMaxTermLength()68 string::size_type getMaxTermLength() const 69 { 70 return m_maxTermLength; 71 } 72 getRemoveHTML()73 bool getRemoveHTML() const 74 { 75 return m_removeHTML; 76 } 77 setMinTermLength(string::size_type value)78 void setMinTermLength(string::size_type value) 79 { 80 m_minTermLength = value; 81 } 82 setMaxTermLength(string::size_type value)83 void setMaxTermLength(string::size_type value) 84 { 85 m_maxTermLength = value; 86 } 87 setRemoveHTML(bool value)88 void setRemoveHTML(bool value) 89 { 90 m_removeHTML = value; 91 } 92 setMinPhraseTerms(int length)93 void setMinPhraseTerms(int length) 94 { 95 m_minPhraseTerms = length; 96 } 97 setMaxPhraseTerms(int length)98 void setMaxPhraseTerms(int length) 99 { 100 m_maxPhraseTerms = length; 101 } 102 setMinPhraseChars(int length)103 void setMinPhraseChars(int length) 104 { 105 m_minPhraseChars = length; 106 } 107 setMaxPhraseChars(int length)108 void setMaxPhraseChars(int length) 109 { 110 m_maxPhraseChars = length; 111 } 112 getMinPhraseTerms()113 int getMinPhraseTerms() const 114 { 115 return m_minPhraseTerms; 116 } 117 getMaxPhraseTerms()118 int getMaxPhraseTerms() const 119 { 120 return m_maxPhraseTerms; 121 } 122 getMinPhraseChars()123 int getMinPhraseChars() const 124 { 125 return m_minPhraseChars; 126 } 127 getMaxPhraseChars()128 int getMaxPhraseChars() const 129 { 130 return m_maxPhraseChars; 131 } 132 setSpamProbeFieldName(const string & value)133 void setSpamProbeFieldName(const string &value) 134 { 135 m_spamprobeFieldName = value; 136 } 137 spamprobeFieldName()138 const string &spamprobeFieldName() const 139 { 140 return m_spamprobeFieldName; 141 } 142 headers()143 HeaderPrefixList *headers() 144 { 145 return &m_prefixedHeaders; 146 } 147 setKeepSuspiciousTags(bool value)148 void setKeepSuspiciousTags(bool value) 149 { 150 m_keepSuspiciousTags = value; 151 } 152 getKeepSuspiciousTags()153 bool getKeepSuspiciousTags() const 154 { 155 return m_keepSuspiciousTags; 156 } 157 setIgnoreBody(bool value)158 void setIgnoreBody(bool value) 159 { 160 m_ignoreBody = value; 161 } 162 getIgnoreBody()163 bool getIgnoreBody() const 164 { 165 return m_ignoreBody; 166 } 167 setMaxTermsPerMessage(int value)168 void setMaxTermsPerMessage(int value) 169 { 170 m_maxTermsPerMessage = value; 171 } 172 getMaxTermsPerMessage()173 int getMaxTermsPerMessage() const 174 { 175 return m_maxTermsPerMessage; 176 } 177 178 private: 179 string::size_type m_minTermLength; 180 string::size_type m_maxTermLength; 181 182 bool m_replaceNonAsciiChars; 183 char m_nonAsciiChar; 184 185 bool m_removeHTML; 186 bool m_keepSuspiciousTags; 187 bool m_ignoreBody; 188 string m_spamprobeFieldName; 189 HeaderPrefixList m_prefixedHeaders; 190 191 int m_minPhraseTerms; 192 int m_maxPhraseTerms; 193 194 int m_minPhraseChars; 195 int m_maxPhraseChars; 196 197 int m_maxTermsPerMessage; 198 }; 199 200 #endif // _ParserConfig_h 201