Descriptors for function interfaces
来源:互联网 发布:003uu改成什么域名了 编辑:程序博客网 时间:2024/05/23 13:10
下面的内容摘自Symbian S60 3rd Edition SDK,先把英文原版贴在这里,等时间充足的时候我再把它翻译出来。How to Use Descriptors之Descriptors for function interfaces《函数接口中描述符的使用》
Descriptors for function interfaces
Many interfaces which use or manipulate text strings or general binary data use descriptors to specify the interface. In conventional ‘C’ programming, interfaces are specified using a combination of char*
, void*
and length values. In Symbian OS, descriptors are always used.
There are four main cases:
-
Passing a constant string
In ‘C’:
StringRead(const char* aString);
The length of the string is implied by the zero terminator; therefore, the function does not require the length to be explicitly specified.
In Symbian OS:
StringRead(const TDesC& aString)
;The descriptor can access the string and contains its length.
-
Passing a string which can be changed.
In ‘C’:
StringWrite(char* aString, int aMaxLength);
The length of the passed string is implied by the zero terminator.
aMaxLength
indicates the maximum length to which the string may be extended.In Symbian OS:
StringWrite(TDes& aString);
The descriptor can access the string and contains its length and the maximum length to which the string may be extended.
-
Passing a buffer containing general binary data
In ‘C’:
BufferRead(const void* aBuffer, int aLength);
Both the address and length of the buffer must be specified.
In Symbian OS:
BufferRead(const TDes8& aBuffer);
The descriptor has access to the address of the buffer and contains the length of the data. The 8 bit variant is explicitly specified; the buffer is treated as byte data, regardless of the build variant.
-
Passing a buffer containing general binary data which can be changed.
In ‘C’:
BufferWrite(void* aBuffer, int& aLength, int aMaxLength);
The address of the buffer, the current length of the data and the maximum length of the buffer are specified. The
aLength
parameter is specified as a reference to allow the function to indicate the length of the data on return.In Symbian OS:
BufferRead(TDes8& aBuffer);
The descriptor has access to the adddress of the buffer and contains the length of the data and the maximum length. The 8 bit variant is explicitly specified; the buffer is treated as byte data, regardless of the build variant.
Defining interfaces using the base descriptor classes allows callers to pass all appropriate derived descriptor types.
- Descriptors for function interfaces
- Resource Descriptors for ACPI
- How-To Guide for Descriptors
- Interfaces in C# (For Beginners)
- Best Practices for User Interfaces
- ubuntu修改interfaces for network
- Hard limits for "maximum open file descriptors"
- Hard limits for "maximum open file descriptors"
- Indirect descriptors for Xen PV disks
- How Function Interfaces Work in Java 8?
- Interfaces
- Interfaces
- interfaces
- Design Principles for Collection and Enumerator Interfaces
- Find Missing Component Interfaces for user
- C# - Recommendations for Abstract Classes vs. Interfaces
- 编译SQUID FOR WINDOWS版修改file descriptors限制
- Combing multiple manifold-valued descriptors for improved object recognition
- test
- OpenGL开发包介绍(转)
- 利用GPRS MODEM拨号上网的说明
- 每个开发人员现在应该下载的十种必备工具
- Microsoft .NET Pet Shop 4 架构与技术分析
- Descriptors for function interfaces
- 存储过程编写经验和优化措施
- Symbian应用程序常用架构——1
- BinaryImage:直接显示以二进制形式存储在数据库中的图片
- C#精髓 第四讲 GridView 72般绝技
- VS 2005 中使用 VC6.0中编写的Project 若干问题
- Symbian应用程序常用架构——2
- 在窗口上显示图片,渐变色背景贴图
- ruby中yaml yaml4r