- Timestamp:
- Sep 11, 2010, 12:34:00 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/doc (added) merged: 7290-7292,7296-7300,7302-7304,7306-7312,7315-7318,7323,7325,7327,7331-7332,7334-7335,7345-7347,7352-7353,7356-7357,7361,7363-7367,7371-7375,7388
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc
r7284 r7401 26 26 * 27 27 */ 28 29 /** 30 @file 31 @brief Implementation of all argument completion functions 32 */ 28 33 29 34 #include "ArgumentCompletionFunctions.h" … … 53 58 namespace autocompletion 54 59 { 60 /** 61 @brief Fallback implementation, returns an empty list. 62 */ 55 63 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(fallback)() 56 64 { … … 60 68 namespace detail 61 69 { 70 /** 71 @brief Returns true if a group of console commands is visible (i.e. if at least one command in this group is visible). 72 */ 62 73 bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden) 63 74 { … … 69 80 } 70 81 82 /** 83 @brief Returns a list of all console command groups AND all console command shortcuts. 84 @param fragment The last argument 85 @param bOnlyShowHidden If true, only hidden groups and commands are returned 86 */ 71 87 ArgumentCompletionList _groupsandcommands(const std::string& fragment, bool bOnlyShowHidden) 72 88 { 89 // note: this function returns only arguments that begin with "fragment", which would't be necessary for the 90 // auto-completion, but it's necessary to place the line-break "\n" between groups and commands 91 // only if both groups AND commands are in the list. 92 73 93 ArgumentCompletionList groupList; 74 94 std::string fragmentLC = getLowercase(fragment); 75 95 96 // get all the groups that are visible (except the shortcut group "") 76 97 const std::map<std::string, std::map<std::string, ConsoleCommand*> >& commands = ConsoleCommand::getCommands(); 77 98 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group) … … 79 100 groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first))); 80 101 102 // now add all shortcuts (in group "") 81 103 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.find(""); 82 104 if (it_group != commands.end()) 83 105 { 106 // add a line-break if the list isn't empty 84 107 if (!groupList.empty()) 85 108 groupList.push_back(ArgumentCompletionListElement("", "", "\n")); 86 109 110 // add the shortcuts 87 111 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command) 88 112 if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find_first_of(fragmentLC) == 0)) … … 90 114 } 91 115 116 // if no shortcut was added, remove the line-break again 92 117 if (!groupList.empty() && groupList.back().getDisplay() == "\n") 93 118 groupList.pop_back(); … … 96 121 } 97 122 123 /** 124 @brief Returns a list of all console commands in a given group. 125 @param fragment The last argument 126 @param group The group's name 127 @param bOnlyShowHidden If true, only hidden console commands are returned 128 */ 98 129 ArgumentCompletionList _subcommands(const std::string& fragment, const std::string& group, bool bOnlyShowHidden) 99 130 { … … 102 133 std::string groupLC = getLowercase(group); 103 134 135 // find the iterator of the given group 104 136 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().begin(); 105 137 for ( ; it_group != ConsoleCommand::getCommands().end(); ++it_group) … … 107 139 break; 108 140 141 // add all commands in the group to the list 109 142 if (it_group != ConsoleCommand::getCommands().end()) 110 143 { … … 118 151 } 119 152 153 /** 154 @brief Returns a list of all console command groups AND all console command shortcuts. 155 */ 120 156 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(groupsandcommands)(const std::string& fragment) 121 157 { … … 123 159 } 124 160 161 /** 162 @brief Returns a list of all console commands in a given group. 163 */ 125 164 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(subcommands)(const std::string& fragment, const std::string& group) 126 165 { … … 128 167 } 129 168 169 /** 170 @brief Returns a list of commands and groups and also supports auto-completion of the arguments of these commands. 171 172 This is a multi-word function, because commands are composed of 1-2 words and additional arguments. 173 */ 130 174 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI(command)(const std::string& fragment) 131 175 { … … 145 189 } 146 190 191 /** 192 @brief Returns a list of hidden commands and groups and also supports auto-completion of the arguments of these commands. 193 194 This is a multi-word function, because commands are composed of 1-2 words and additional arguments. 195 196 This function makes commands visible that would usually be hidden. 197 */ 147 198 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI(hiddencommand)(const std::string& fragment) 148 199 { … … 170 221 } 171 222 223 /** 224 @brief Returns possible files and directories and also supports files in arbitrary deeply nested subdirectories. 225 226 This function returns files and directories in the given path. This allows to 227 navigate iteratively through the file system. The first argument @a fragment 228 is used to get the current path. 229 */ 172 230 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(files)(const std::string& fragment) 173 231 { … … 211 269 } 212 270 271 /** 272 @brief Returns the sections of the config file. 273 */ 213 274 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(settingssections)() 214 275 { … … 222 283 } 223 284 285 /** 286 @brief Returns the entries in a given section of the config file. 287 */ 224 288 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(settingsentries)(const std::string& fragment, const std::string& section) 225 289 { … … 235 299 } 236 300 301 /** 302 @brief Returns the current value of a given value in a given section of the config file. 303 */ 237 304 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(settingsvalue)(const std::string& fragment, const std::string& entry, const std::string& section) 238 305 { … … 255 322 } 256 323 324 /** 325 @brief Returns a list of indexes of the available Tcl threads (see TclThreadManager). 326 */ 257 327 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(tclthreads)() 258 328 {
Note: See TracChangeset
for help on using the changeset viewer.