本文整理汇总了C++中VString::MAC_FromMacPString方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::MAC_FromMacPString方法的具体用法?C++ VString::MAC_FromMacPString怎么用?C++ VString::MAC_FromMacPString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::MAC_FromMacPString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetString
Boolean VMacResFile::GetString(VString& outString, sLONG inID) const
{
outString.Clear();
if (!testAssert(fRefNum != -1))
return false;
if (!testAssert(inID >= -32768 && inID <= 32767))
return false;
sWORD curres = ::CurResFile();
if (curres != fRefNum)
::UseResFile(fRefNum);
Handle data = fUseResourceChain ? ::GetResource('STR ', (short) inID) : ::Get1Resource('STR ', (short) inID);
if (curres != fRefNum)
::UseResFile(curres);
Boolean isOK = false;
if (testAssert(data != NULL))
{
if (testAssert(*data != NULL))
{
::HLock(data);
outString.MAC_FromMacPString((StringPtr) *data);
::HUnlock(data);
isOK = true;
}
}
return isOK;
}
示例2: GetCurrentResourceName
void VMacResourceIterator::GetCurrentResourceName(VString& outName)
{
if (!testAssert(fPos >= 1 && fPos <= fIDs.GetCount()))
return;
sWORD refnum = fRefNums.GetWord(fPos);
sWORD id = fIDs.GetWord(fPos);
sWORD curres = ::CurResFile();
if (curres != refnum)
::UseResFile(refnum);
::SetResLoad(false);
Handle data = ::Get1Resource(fType, id);
OSErr macError = ::ResError();
::SetResLoad(true);
if (curres != refnum)
::UseResFile(curres);
if (data != NULL)
{
ResType type;
sWORD id2;
Str255 spName;
::GetResInfo(data, &id2, &type, spName);
macError = ::ResError();
if (testAssert(macError == noErr))
outName.MAC_FromMacPString(spName);
}
}
示例3: GetResourceListNames
VError VMacResFile::GetResourceListNames(const VString& inType, VArrayString& outNames) const
{
OSErr macError = noErr;
outNames.SetCount(0);
if (!testAssert(fRefNum != -1))
return VE_STREAM_NOT_OPENED;
ResType type = inType.GetOsType();
if (type == 0)
return VE_INVALID_PARAMETER;
sWORD oldref = ::CurResFile();
sWORD ref = fRefNum;
while(ref != -1 && ref != 0)
{
::UseResFile(ref);
sWORD count = ::Count1Resources(type);
::UseResFile(oldref);
for(sWORD i = 1 ; i <= count ; ++i)
{
::UseResFile(ref);
::SetResLoad(false);
Handle data = ::Get1IndResource(type, i);
macError = ::ResError();
::SetResLoad(true);
::UseResFile(oldref); // one must restore proper context before calling VArrayValue::AppendWord
if (data != NULL)
{
ResType type2;
sWORD id;
Str255 spName;
::GetResInfo(data, &id, &type2, spName);
macError = ::ResError();
if (macError == noErr && spName[0] > 0)
{
VString name;
name.MAC_FromMacPString(spName);
if (outNames.Find(name) == -1)
outNames.AppendString(name);
}
}
}
if (!fUseResourceChain)
break;
else
{
macError = ::GetNextResourceFile(ref, &ref); // returns ref = 0 and noerror at the end
if (!testAssert(macError == noErr))
break;
}
}
return VE_OK;
}
示例4: GetResourceName
VError VMacResFile::GetResourceName(const VString& inType, sLONG inID, VString& outName) const
{
outName.Clear();
Handle data = NULL;
VError error = _GetResource(inType, inID, &data);
if (error == VE_OK)
{
ResType type;
sWORD id;
Str255 spName;
::GetResInfo(data, &id, &type, spName);
OSErr macError = ::ResError();
if (testAssert(macError == noErr))
{
outName.MAC_FromMacPString(spName);
} else
error = VErrorBase::NativeErrorToVError((VNativeError)macError);
}
return error;
}