company logo

TypeDefinition :: keyExist - Check key name

The function checks, whether the key name passed in sKeyName exists or not. In order to avoid exceptions, the function might be called before trying to access a key definition.

// function returns an invalid type definition, when requested key

// could not be found

TypeDefinition getKeyDefinition( Property &property, String keyName ) {

  TypeDefinition  td(property.typeDefinition());

  TypeDefinition  key;

  

  if ( td.keyExist(keyName) )

    key = keyDefinition(keyName);

  return key;

}

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false.

Implementation details

bool TypeDefinition  :: keyExist ( odaba::String &sKeyName )
  • sKeyName - Key name

    The key name must be the name of a key defined for the given structure. Thekey name is passed as string with maximum 40 characters.

    In order to pass no key name, an empty string ( String() ) has to be passed.