inline String *get(unsigned index) const { if (index > len()) throw RangeError(); return (String*)&array()[index]; }
Vector<T> Matrix<T>::getRow(int rowIndex) const { if(rowIndex < 0 || rowIndex >= getNumCols()) { throw RangeError(rowIndex,"getRow"); } Vector<T> retVal( getNumCols() ); for(int i=0; i < getNumCols(); i++) { retVal[i] = operator()(rowIndex,i); } return retVal; }
Vector<T> Matrix<T>::getColumn(int colIndex) const { if(colIndex < 0 || colIndex >= getNumCols()) { throw RangeError(colIndex,"getColumn"); } Vector<T> retVal( getNumRows() ); for(int i=0; i < getNumRows(); i++) { retVal[i] = operator()(i,colIndex); } return retVal; }
void Length::setLengthFromFloat(qreal nanometers) throw (RangeError) { LengthBase_t min = std::numeric_limits<LengthBase_t>::min(); LengthBase_t max = std::numeric_limits<LengthBase_t>::max(); qreal value = qRound(nanometers); if ((value > max) || (value < min)) { throw RangeError(__FILE__, __LINE__, QString("value=%1; min=%2; max=%3") .arg(value).arg(min).arg(max), tr("Range error!")); } mNanometers = value; }
void throw_RangeError(const char*) { throw RangeError(); }
const T& Matrix<T>::operator()(int row, int col) const { if(row < 0 || row >= getNumRows()) throw RangeError(row,"operator(): const row"); if(col < 0 || col >= getNumCols()) throw RangeError(col,"operator(): const col"); return head[row][col]; }
inline void popIndex(lx_s *destp, int index) { if (lx_sa_pop_index(&sa, destp, index)) throw RangeError(); }
inline void popFront(lx_s *destp) { if (lx_sa_pop_front(&sa, destp)) throw RangeError(); }
inline void popBack(lx_s *destp) { if (lx_sa_pop_back(&sa, destp)) throw RangeError(); }
void Vector::check(const int idx) const { if(idx < 0 || idx >= sz) throw RangeError(); }
void Matrix::check(int idx) const { if(idx < 0 || idx >= rows) throw RangeError(); }
void Vec4::check(const int idx) const { if(idx < 0 || idx >= VEC_SIZE) throw RangeError(); }
void Mat4::check(int idx) const { if(idx < 0 || idx >= MAT_SIZE) throw RangeError(); }