Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Source/StringListResource.cp
/* |
* StringListResource.cp |
*/ |
#include "StringListResource.h" |
StringListResource::StringListResource(short id) : fStrings(NULL), fCount(0) |
{ |
fStrings = ::GetResource('STR#', id); |
if (fStrings != NULL) { |
HLockHi(fStrings); |
StringList* strings = *(StringList**)fStrings; |
fCount = strings->count; |
pText = strings->strings; |
} |
} |
StringListResource::~StringListResource() |
{ |
if (fStrings != NULL) ::ReleaseResource(fStrings); |
} |
StringPtr StringListResource::First() |
{ |
if (fStrings != NULL) { |
StringList* strings = *(StringList**)fStrings; |
fCount = strings->count; |
pText = strings->strings; |
} |
return Next(); |
} |
StringPtr StringListResource::Next() |
{ |
StringPtr result = NULL; |
if (fCount > 0) { |
result = pText; |
pText += (1 + *pText); |
--fCount; |
} |
return result; |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14