void ColumnClassifier::scan( const char *p, int stt, int end){ const char *s; std::string ss; DigitConverter converter("0"); // // Handle non-ASCII (that is, UTF-8): // if(!_isASCII(p,stt,end)){ // // Conversion to ASCII normalization required: // converter.set(p,stt,end); ss=converter.get(); s=ss.c_str(); stt=0; end=strlen(s); }else{ // No conversion necessary: s=p; } if (_isEmptyOrDot(s,stt,end)){ _missingOrDotCounter++; } else if(_isDate (s,stt,end)){ _dateCounter++; } else if(_isGenotype (s,stt,end)){ _genotypeCounter++; } else if(_isNumeric (s,stt,end)){ _numericCounter++; } else if(_isGender (s,stt,end)){ _genderCounter++; } //else { } // Add to totalCounter as well: _totalCounter++; }
void HugeInteger::input() { std::string intInput; std::cout << "Enter integer: "; std::getline( std::cin, intInput ); // verify numeric input if (!_isNumeric(intInput)) throw std::invalid_argument("Input is not an integer"); // allocate memory for data member try { m_integers.resize(intInput.size()); } catch (const std::length_error &le) { std::cerr << "Length error: " << le.what() << std::endl; return; } catch (const std::bad_alloc &ba) { std::cerr << "Bad allocation: " << ba.what() << std::endl; return; } // fill with digits _fillDigits(intInput); }
//Built in functions //replace with safe-shutdown method void _int_exit(token*retCode) { if (retCode==NULL) { printf("Exiting with return code 0\n"); exit(0); if (_isNumeric(retCode->type)) { if (_isIntegral(retCode->type)) { printf("Exiting with return code %d\n", *(int*)retCode->data); exit(*(int*)retCode->data); } } } }
static inline bool _isAlphaNumeric (char c) {return _isAlpha(c) || _isNumeric(c);}