// return the list of items from a string of characters of the form "item1|item2|...|itemN" VString *ParameterManager::getItemList(const char *strItems) { VString *vString = new VString; // parse the string of allowed values unsigned int iLength = (unsigned int)strlen(strItems); char strValue[1000]; int iCharacters = 0; for(unsigned int i=0 ; i<iLength ; ++i) { if (isspace(strItems[i]) != 0) { return NULL; } if (strItems[i] == '|') { if (iCharacters <= 0) { return NULL; } strValue[iCharacters] = 0; vString->push_back(strValue); iCharacters = 0; } else { strValue[iCharacters++] = strItems[i]; } } if (iCharacters > 0) { strValue[iCharacters] = 0; vString->push_back(strValue); } return vString; }
/// @brief Generate a list of valid action for the specified key. /// /// @param _sKey Input key. /// @param _eActionMode Activation mode. /// @param _aActions Array of valid action. void CActionMap::GetAction(EKey _eKey, EActionMode _eActionMode, VString &_aActions) const { ActionMap::const_iterator it = m_aActionMap.find(_eKey); if(it != m_aActionMap.end()) _aActions.push_back(it->second->name); }