interface .DATA

Speech link Data exchange interface.

Public Methods

[more]SLDATA_API SLresult SLDataInit()
Performs platform specific initialization.
[more]SLDATA_API SLresult SLDataShutdown()
Performs platform specific shutdown.
[more]SLDATA_API SLresult SLDataCreate(SLData** data)
Creates a new SLData object.
[more]SLDATA_API SLresult SLDataClone(SLData *original, SLData **clone)
Clones a SLData.
[more]SLDATA_API SLresult SLDataParseString(const void *body, SLuint bodyLength, SLData** data)
Parses a string and creates a SLData object.
[more]SLDATA_API SLresult SLDataDelete(SLData **data)
Deletes the SLData object.
[more]SLDATA_API SLresult SLDataToString(SLData *data, SLchar *buffer, SLuint *bufferSize)
Outputs the SLData object to a character string.
[more]SLDATA_API SLresult SLDataGetBody(SLData *data, const SLchar **mimetype, const void **body, SLuint *bodySize)
Gets the body of the SLData.
[more]SLDATA_API SLresult SLDataSetBody(SLData *data, const SLchar *mimetype, const void *body, SLuint bodySize)
Sets the body of the SLData.
[more]SLDATA_API SLresult SLDataSetAttribute(SLData *data, const SLchar *attribute, const SLchar *value)
Assigns a value to the specified attribute.
[more]SLDATA_API SLresult SLDataGetAttribute(SLData *data, const SLchar *attribute, const SLchar **value)
Gets the value of the specified attribute.
[more]SLDATA_API SLresult SLDataGetAttributeList(SLData *data, SLAttributeList** attributes)
Retrieves the list of set attributes.
[more]SLDATA_API SLresult SLDataDeleteAttributeList(SLAttributeList **attributes)
Releases the SLAttributeList object.
[more]SLDATA_API SLresult SLDataGetNbAttributes(SLAttributeList *attributes, SLuint* nbAttributes)
Returns the number of attributes in the attribute list.
[more]SLDATA_API SLresult SLDataGetAttributeName(SLAttributeList *attributes, SLuint idx, const SLchar** name)
Returns the name of the i-th attribute in the attribute list.
[more]SLDATA_API SLresult SLDataGetAttributeValue(SLAttributeList *attributes, SLuint idx, const SLchar** value)
Returns the value of the i-th attribute in the attribute list.


Documentation

Speech link Data exchange interface. This interface provides the data exchange mechanism for speech link. Attributes may be assigned a value and the value of an attribute can be retrieved.
oSLDATA_API SLresult SLDataInit()
Performs platform specific initialization. This must be called when the system is being initalized.

Returns:
SL_SUCCESS if success, less than SL_SUCCESS if failure.

oSLDATA_API SLresult SLDataShutdown()
Performs platform specific shutdown. Should be called on system shutdown.

Returns:
SL_SUCCESS if success, less than SL_SUCCESS if failure.

oSLDATA_API SLresult SLDataCreate(SLData** data)
Creates a new SLData object. The object should be deleted with SLDataDelete when it is no longer needed.

Parameters:
data - [out] A pointer to the newly created SLData object.
Returns:
SL_SUCCESS if the new object could be created, a value smaller than SL_SUCCESS if the object could not be created.

oSLDATA_API SLresult SLDataClone(SLData *original, SLData **clone)
Clones a SLData. The created object should be deleted with SLDataDelete when no longer needed.

Parameters:
original - [in] The SLData to be cloned.
clone - [out] The clone of the original.
Returns:
SL_SUCCESS if the object could be cloned, SL_OUT_OF_MEMORY otherwise.

oSLDATA_API SLresult SLDataParseString(const void *body, SLuint bodyLength, SLData** data)
Parses a string and creates a SLData object. The created object should be deleted with SLDataDelete when it is no longer needed.

Parameters:
body - [in] The string to be parsed. The string does not need to be 0-terminated.
bodyLength - The number of bytes in body. If the string is 0-terminated, the corresponding * bytes should not be counted.
data - [out] A pointer to the newly created SLData object.
Returns:
SL_SUCCESS if the string was successfully parsed and the new object could be created, a value smaller than SL_SUCCESS if the object could not be created.

oSLDATA_API SLresult SLDataDelete(SLData **data)
Deletes the SLData object. The object should have been obtained through SLDataCreate of SLDataParseString. If the object to be deleted is a NULL object, the operation just returns SL_SUCCESS.

Parameters:
data - [inout] The data to be deleted. The pointer is set to NULL.
Returns:
SL_SUCCESS if the data was successfully deleted, a value smaller than SL_SUCCESS if an error occurred.

oSLDATA_API SLresult SLDataToString(SLData *data, SLchar *buffer, SLuint *bufferSize)
Outputs the SLData object to a character string.

Parameters:
data - [in] The SLData to be output to a string.
buffer - [out] The buffer to which the SLdata is to be output. This buffer must be allocated by the caller.
bufferSize - [in] The size of the buffer (the number of SLchar the buffer can contain including the NULL-character).
Returns:
SL_SUCCESS if the data was successfully output into the buffer, less than SL_SUCCESS if an error occurred. If the buffer is not large enough, SL_SUCCESS + the size required is returned.

oSLDATA_API SLresult SLDataGetBody(SLData *data, const SLchar **mimetype, const void **body, SLuint *bodySize)
Gets the body of the SLData.

The body is a pointer to internal memory and should not be deleted by the caller.

Parameters:
data - [in] The SLdata for which the body is to be retrieved.
mimetype - [out] A pointer to a mimetype string that will be written containing the mimetype of the data contained in the body. The SLchar is null terminated. String will be NULL if there is no body.
body - [out] A pointer to the body of the SLdata. Set to NULL if the data has no body.
bodySize - [out] The length in bytes of the body. Set to 0 if the data had no body.
Returns:
SL_SUCCESS if successful, less than SL_SUCCESS otherwise or if the body is empty.

oSLDATA_API SLresult SLDataSetBody(SLData *data, const SLchar *mimetype, const void *body, SLuint bodySize)
Sets the body of the SLData. The body is copied into local memory.

Parameters:
data - [in] The SLdata for which the body is to be set.
mimetype - [in] A NULL terminated string that contains the mimetype of the body
body - [in] The new body of the SLdata. If NULL, clears the body of the data
bodySize - [in] The number of bytes in body.
Returns:
SL_SUCCESS if successful, less than SL_SUCCESS otherwise.

oSLDATA_API SLresult SLDataSetAttribute(SLData *data, const SLchar *attribute, const SLchar *value)
Assigns a value to the specified attribute. Assigning a value of NULL to an attribute clears that attribute. The attribute and the value character strings are copied into local memory of the data object.

Parameters:
data - The SLData object for which the attribute is to be set.
attribute - The attribute that is to be set.
value - The value to which the attribute is set.
Returns:
SL_SUCCESS if success, less than SL_SUCCESS if failure.

oSLDATA_API SLresult SLDataGetAttribute(SLData *data, const SLchar *attribute, const SLchar **value)
Gets the value of the specified attribute.

Parameters:
data - [in] The SLData object for which the attribute is to be retrieved.
attribute - [in] The attribute for which the value is to be retrieved.
value - [out] The value of the attribute. If the attribute is not set for the object, this value is set to NULL and SL_SUCCESS is returned.
Returns:
SL_SUCCESS if success, less than SL_SUCCESS if failure.

oSLDATA_API SLresult SLDataGetAttributeList(SLData *data, SLAttributeList** attributes)
Retrieves the list of set attributes. The returned object should be deleted with SLDataDeleteAttributes when done.

Parameters:
data - [in] The SLData object for which the list of attributes is to be retrieved.
attributes - [out] An AttributeList object containing the list of attributes names.
Returns:
SL_SUCCESS if success, less than SL_SUCCESS if failure.

oSLDATA_API SLresult SLDataDeleteAttributeList(SLAttributeList **attributes)
Releases the SLAttributeList object. The object should have been obtained through SLDataGetAttributeList. If the object to be deleted is a NULL object, the operation just returns SL_SUCCESS.

Parameters:
attributes - [inout] The attribute list to be deleted. The pointer is set to NULL.
Returns:
SL_SUCCESS if the data was successfully deleted, a value smaller than SL_SUCCESS if an error occurred.

oSLDATA_API SLresult SLDataGetNbAttributes(SLAttributeList *attributes, SLuint* nbAttributes)
Returns the number of attributes in the attribute list.

Parameters:
attributes - [in] The attribute list for which the number of attributes is to be extracted.
nbAttributes - [out] The number of attributes for this attribute list.
Returns:
SL_SUCCESS if the data was successfully deleted, a value smaller than SL_SUCCESS if an error occurred.

oSLDATA_API SLresult SLDataGetAttributeName(SLAttributeList *attributes, SLuint idx, const SLchar** name)
Returns the name of the i-th attribute in the attribute list.

Parameters:
attributes - [in] The attribute list for which the number of attributes is to be extracted.
idx - [in] The index of the attribute to return. Attributes are numbered from 0 to N-1.
name - [out] The name of the attribute at index.
Returns:
SL_SUCCESS if the data was successfully deleted, a value smaller than SL_SUCCESS if an error occurred.

oSLDATA_API SLresult SLDataGetAttributeValue(SLAttributeList *attributes, SLuint idx, const SLchar** value)
Returns the value of the i-th attribute in the attribute list.

Parameters:
attributes - [in] The attribute list for which the number of attributes is to be extracted.
idx - [in] The index of the attribute to return. Attributes are numbered from 0 to N-1.
value - [out] The value of the attribute at index.
Returns:
SL_SUCCESS if the data was successfully deleted, a value smaller than SL_SUCCESS if an error occurred.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


Copyright © 2000-2001 SpeechWorks International, Inc. 
This work may only be distributed under the terms of the SpeechWorks Open Document License v1.0