Exemplo n.º 1
0
/*
 * Read the only string from one string resource.
 * Note: The parameter pos is used both for input and output
 * of the position in the resource data.
 * @param resID A valid resource id.
 * @param pos In: The start position. Out: The position
 * after the string in the resource.
 * @param output The resulting string.
 */
bool ScreenImageSwiper::readStringFromResource(
	MAHandle resID,
	int& pos,
	MAUtil::String& output) const
{
	// Get all the characters on one read.

	// Get the length of the string stored as a .pstring
	// (Pascal string). The first byte contains the length.
	byte stringLen = 0;
	maReadData(resID, (void*) &stringLen, pos, sizeof(byte));
	if (stringLen > maGetDataSize(resID) || stringLen <= 0)
	{
		return false;
	}

	// Read the string.
	pos += sizeof(byte);
	output.resize(stringLen);
	maReadData(resID, (void*) output.c_str(), pos, stringLen);

	// Update position to the byte after the string.
	pos += stringLen;

	return true;
}
int SettingsScreen::getSystemProperty(const char* key, MAUtil::String& dst) {
    int size = maGetSystemProperty(key, NULL, 0);
    printf("received size: %i", size);
    if (size < 0)
        return size;
    dst.resize(size-1);
    maGetSystemProperty(key, dst.pointer(), size);
    return size;
}
Exemplo n.º 3
0
int FileLister::next(MAUtil::String& dst) {
	int len = maFileListNext(mList, NULL, 0);
	if(len <= 0)
		return len;
	dst.resize(len);
	len = maFileListNext(mList, dst.pointer(), len+1);
	MAASSERT(len > 0);
	return len;
}
Exemplo n.º 4
0
int XML::getSystemProperty(const char* key, MAUtil::String& dst)
{
	    int size = maGetSystemProperty(key, NULL, 0);

	    if(size < 0)
	        return size;

	    dst.resize(size-1);

	    maGetSystemProperty(key, dst.pointer(), size);

	    return size;
}