Ejemplo n.º 1
0
void
SimpleProperties::Reader::printAll(NdbOut& ndbout){
  char tmp[1024];
  for(first(); valid(); next()){
    switch(getValueType()){
    case SimpleProperties::Uint32Value:
      ndbout << "Key: " << getKey()
             << " value(" << getValueLen() << ") : " 
             << getUint32() << endl;
      break;
    case SimpleProperties::BinaryValue:
    case SimpleProperties::StringValue:
      if(getValueLen() < 1024){
	getString(tmp);
	ndbout << "Key: " << getKey()
	       << " value(" << getValueLen() << ") : " 
	       << "\"" << tmp << "\"" << endl;
      } else {
	ndbout << "Key: " << getKey()
	       << " value(" << getValueLen() << ") : " 
	       << "\"" << "<TOO LONG>" << "\"" << endl;
	
      }
      break;
    default:
      ndbout << "Unknown type for key: " << getKey() 
             << " type: " << (Uint32)getValueType() << endl;
    }
  }
}
Ejemplo n.º 2
0
// convert nubers and bools to strings for this one
char *JsonItem::getValueAsString ( int32_t *valueLen ) {

	// strings are the same
	if ( m_type == JT_STRING ) {
		*valueLen = getValueLen();
		return getValue();
	}

	// numbers...
	static char s_numBuf[64];
	if ( (float)m_valueLong == m_valueDouble ) {
		*valueLen = sprintf ( s_numBuf,"%"INT32"", m_valueLong );
		return s_numBuf;
	}

	*valueLen = sprintf ( s_numBuf,"%f", m_valueDouble );
	return s_numBuf;
}