Back: CSmalltalk-accessing Up: Base classes Forward: CString class-accessing   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.48 CString

Defined in namespace Smalltalk
Superclass: CPtr
Category: Language-C interface
Technically, CString is really a pointer to CChar. However, it can be very useful as a distinct datatype because it is a separate datatype in Smalltalk, so we allow developers to express their semantics more precisely by using a more descriptive type.

Note that like CChar is a pointer to char, CString is actually a *pointer* to string: a char ** in C terms. If you need to take a String out of a char *, use CChar>>#asString.

In general, I behave like a cross between an array of characters and a pointer to a character. I provide the protocol for both data types. My #value method returns a Smalltalk String, as you would expect for a scalar datatype.

1.48.1 CString class: accessing  (class)
1.48.2 CString class: instance creation  (class)
1.48.3 CString: accessing  (instance)


1.48.1 CString class: accessing

cObjStoredType
Private - Provide a conversion from a CObject to a Smalltalk object to be stored by #at:put:


1.48.2 CString class: instance creation

type
Answer a CType for the receiver--for example, CByteType if the receiver is CByte.

value: anObject
Answer a newly allocated CObject containing the passed value, anObject. Remember to call #addToBeFinalized if you want the CObject to be automatically freed


1.48.3 CString: accessing

cObjStoredType
Private - Provide a conversion from a CObject to a Smalltalk object to be stored by #at:put:

value
Answer the value the receiver is pointing to. The exact returned value depends on the receiver's class

value: aValue
Set the receiver to point to the value, aValue. The exact meaning of aValue depends on the receiver's class



Back: CString class-instance creation Up: CString Forward: CStringCType   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html