1 ///###//////////////////////////////////////////////////////////////////////// 2 // 3 // Burton Computer Corporation 4 // http://www.burton-computer.com 5 // http://www.cooldevtools.com 6 // $Id: CommandConfig.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 _CommandConfig_h 32 #define _CommandConfig_h 33 34 #include <vector> 35 #include "AbstractCommand.h" 36 37 class CommandConfig 38 { 39 public: 40 CommandConfig(); 41 messagesPerPurge()42 int messagesPerPurge() const 43 { 44 return m_messagesPerPurge; 45 } 46 setMessagesPerPurge(int value)47 void setMessagesPerPurge(int value) 48 { 49 m_messagesPerPurge = value; 50 } 51 shouldShowTerms()52 bool shouldShowTerms() const 53 { 54 return m_shouldShowTerms; 55 } 56 setShouldShowTerms(bool value)57 void setShouldShowTerms(bool value) 58 { 59 m_shouldShowTerms = value; 60 } 61 streamIsPretokenized()62 bool streamIsPretokenized() const 63 { 64 return m_streamIsPretokenized; 65 } 66 setStreamIsPretokenized(bool value)67 void setStreamIsPretokenized(bool value) 68 { 69 m_streamIsPretokenized = value; 70 } 71 ignoreFrom()72 bool ignoreFrom() const 73 { 74 return m_ignoreFrom; 75 } 76 setIgnoreFrom(bool value)77 void setIgnoreFrom(bool value) 78 { 79 m_ignoreFrom = value; 80 } 81 ignoreContentLength()82 bool ignoreContentLength() const 83 { 84 return m_ignoreContentLength; 85 } 86 setIgnoreContentLength(bool value)87 void setIgnoreContentLength(bool value) 88 { 89 m_ignoreContentLength = value; 90 } 91 shouldCreateDbDir()92 bool shouldCreateDbDir() const 93 { 94 return m_shouldCreateDbDir; 95 } 96 setShouldCreateDbDir(bool value)97 void setShouldCreateDbDir(bool value) 98 { 99 m_shouldCreateDbDir = value; 100 } 101 statusFieldName()102 const string &statusFieldName() const 103 { 104 return m_statusFieldName; 105 } 106 setStatusFieldName(const string & value)107 void setStatusFieldName(const string &value) 108 { 109 m_statusFieldName = value; 110 } 111 numCommands()112 int numCommands() const 113 { 114 return (int)m_commands.size(); 115 } 116 command(int index)117 const Ref<AbstractCommand> command(int index) const 118 { 119 assert(index >= 0); 120 assert(index < numCommands()); 121 return m_commands[index]; 122 } 123 124 const Ref<AbstractCommand> findCommand(const string &name) const; 125 addCommand(const Ref<AbstractCommand> & command)126 void addCommand(const Ref<AbstractCommand> &command) 127 { 128 m_commands.push_back(command); 129 } 130 addArg(const string & arg)131 void addArg(const string &arg) 132 { 133 m_args.push_back(arg); 134 } 135 addArgs(char ** args)136 void addArgs(char **args) 137 { 138 while (*args) { 139 addArg(*args++); 140 } 141 } 142 numArgs()143 int numArgs() const 144 { 145 return (int)m_args.size(); 146 } 147 arg(int index)148 const string &arg(int index) const 149 { 150 assert(index >= 0); 151 assert(index < numArgs()); 152 return m_args[index]; 153 } 154 155 private: 156 int m_messagesPerPurge; 157 bool m_shouldShowTerms; 158 bool m_streamIsPretokenized; 159 bool m_ignoreFrom; 160 bool m_ignoreContentLength; 161 bool m_shouldCreateDbDir; 162 string m_statusFieldName; 163 vector<string> m_args; 164 typedef vector<Ref<AbstractCommand> > CommandVector; 165 CommandVector m_commands; 166 }; 167 168 #endif // _CommandConfig_h 169