Moved part of keyword matching into a separate function; it was way too long

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1077 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-07 00:24:02 +00:00
parent ee4aa6f50e
commit 1d38312d05
3 changed files with 199 additions and 164 deletions
+12 -1
View File
@@ -152,12 +152,23 @@ class KeywordDatabase {
/// Expand/update all keywords in the given string.
/** @param expand_default script function indicating whether reminder text should be shown by default
* @param combine_script script function to combine keyword and reminder text in some way
* @param case_sensitive case sensitive matching of keywords?
* @param ctx context for evaluation of scripts
*/
String expand(const String& text, const ScriptValueP& expand_default, const ScriptValueP& combine_script, Context& ctx) const;
String expand(const String& text, const ScriptValueP& expand_default, const ScriptValueP& combine_script, bool case_sensitive, Context& ctx) const;
private:
KeywordTrie* root; ///< Data structure for finding keywords
/// (try to) expand a single keyword
/** If the keyword matches:
* - add the result to out
* - advance the tagged and untagged string by dropping a part from the front
* - return true
*/
bool tryExpand(const Keyword& kw, size_t pos, String& tagged, String& untagged, String& out, char expand_type,
const ScriptValueP& expand_default, const ScriptValueP& combine_script, bool case_sensitive, Context& ctx,
KeywordUsageStatistics* stat, Value* stat_key) const;
};
// ----------------------------------------------------------------------------- : Processing parameters