Example #1
0
uberzahl::uberzahl ( const char* number ,int base){
  if(base == 10) {
    if(number[0] == '-') {
      positive = false;
      string_value = number+1;
    } else {
      positive = true;
      string_value = number;
    }
    convert_to_numeric();
  } else if(base==16) {
    const char* start;
    if(number[0] == '-') {
      positive = false;
      start = number+1;
    } else {
      positive = true;
      start = number;
    }
    std::vector<char> t;
    for(const char* c=start;*c;c++) {
      if('0'<=*c && *c<='9')
        t.push_back(*c-'0');
      else if('a'<=*c && *c<='f')
        t.push_back(*c-'a'+10);
      else if('A'<=*c && *c<='F')
        t.push_back(*c-'A'+10);
    }
    while(t.size()>=8) {
      smallType digit = 0;
      for(int i=0;i<8;i++) {
        digit = digit * 16;
        digit = digit + t[t.size()-8+i];
      }
      for(int i=0;i<8;i++)
        t.pop_back();
      value_vector.push_back(digit);
    }
    if(t.size()>0) {
      smallType digit = 0;
      for(int i=0;i<t.size();i++) {
        digit = digit * 16;
        digit = digit + t[i];
      }
      value_vector.push_back(digit);
    }
    
  } else {
    std::cout << "unknown base" << std::endl;
    assert(0);
  }
}
Example #2
0
uberzahl::uberzahl ( const char* number ){
  string_value = number;
  convert_to_numeric();
}
Example #3
0
uberzahl::uberzahl ( void )
  : string_value("0")
{
  convert_to_numeric();
}
Example #4
0
uberzahl::uberzahl ( const char* number ){
  convert_to_numeric( number );
}
Example #5
0
uberzahl::uberzahl ( void ){
  convert_to_numeric("0");
}
Example #6
0
uberzahl::uberzahl ( void )
  : string_value("0")
{
  positive = true;
  convert_to_numeric();
}