bool FunctionListPanel::openSelection(const TreeView & treeView) { TVITEM tvItem; tvItem.mask = TVIF_IMAGE | TVIF_PARAM; tvItem.hItem = treeView.getSelection(); ::SendMessage(treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem); if (tvItem.iImage == INDEX_ROOT || tvItem.iImage == INDEX_NODE) { return false; } generic_string *posStr = (generic_string *)tvItem.lParam; if (!posStr) return false; int pos = generic_atoi(posStr->c_str()); if (pos == -1) return false; int sci_line = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, pos); (*_ppEditView)->execute(SCI_ENSUREVISIBLE, sci_line); (*_ppEditView)->scrollPosToCenter(pos); return true; }
int getNumberFromParam(char paramName, ParamVector & params, bool & isParamePresent) { generic_string numStr; if (!getParamVal(paramName, params, numStr)) { isParamePresent = false; return -1; } isParamePresent = true; return generic_atoi(numStr.c_str()); };
const TCHAR * TiXmlElement::Attribute( const TCHAR * name, int* i ) const { const TCHAR * s = Attribute( name ); if ( i ) { if ( s ) *i = generic_atoi( s ); else *i = 0; } return s; }
size_t FileManager::nextUntitledNewNumber() const { std::vector<size_t> usedNumbers; for(size_t i = 0; i < _buffers.size(); i++) { Buffer *buf = _buffers.at(i); if (buf->isUntitled()) { // if untitled document is invisible, then don't put its number into array (so its number is available to be used) if ((buf->_referees[0])->isVisible()) { TCHAR *numberStr = buf->_fileName + lstrlen(UNTITLED_STR); int usedNumber = generic_atoi(numberStr); usedNumbers.push_back(usedNumber); } } } size_t newNumber = 1; bool numberAvailable = true; bool found = false; do { for(size_t j = 0; j < usedNumbers.size(); j++) { numberAvailable = true; found = false; if (usedNumbers[j] == newNumber) { numberAvailable = false; found = true; break; } } if (!numberAvailable) newNumber++; if (!found) break; } while (!numberAvailable); return newNumber; }
const int TiXmlAttribute::IntValue() const { return generic_atoi (value.c_str ()); }