コード例 #1
0
/**
 * Function name			CDeleteGvlImport::Init
 * Description		Parses the resource for import directives and pops up a dialog
	                contaning a list of those import directives, so the user could
                    choose one to delete
 * @return			void 
 * @exception			
 * @see			    CFileSelDlg
*/
void CDeleteGvlImport::Init()
{
    if(m_bAutomationMode)
    {
        SetFileName();
    }

    if(!ParseResource())
    {
        return;
    }

    CStringArray aStrGvlFiles;
    CString strFileName;
    import_directives_citer iter;
    const import_directives_type Imports = m_Resource->getImportDirectives();
    if(Imports.size() != 0)
    {
        for(iter = Imports.begin(); iter < Imports.end(); iter++)
        {
            strFileName = ((*iter)->getFileName()).c_str();
            aStrGvlFiles.Add(strFileName);
        }
    }
    CFileSelDlg     tFileSelDlg;
    CString         strTitle;
    strTitle.LoadString(IDS_GLOB_VARSELEC);

    if(!m_bAutomationMode)
    {
        tFileSelDlg.Initialize(strTitle, aStrGvlFiles);
        if(tFileSelDlg.DoModal() == IDOK)
        {
            tFileSelDlg.GetSelection(m_aStrGvlFilesSel);
        }
    }
    
}
コード例 #2
0
// Parse all resources in a set
bool XML_ResourceFork::ParseResourceSet(ResType Type)
{
    short NumResources = Count1Resources(Type);

    if (NumResources <= 0) {
        return false;
    }

    // This sorting is necessary so that the resources will be read in ascending order of ID's
    short *IDList = new short[NumResources];

    // Get the resource ID's
    SetResLoad(false);

    for (int ir=0; ir<NumResources; ir++)
    {
        // Zero-based to one-based indexing
        ResourceHandle = Get1IndResource(Type,ir+1);
        ResType _Type;
        Str255 Name;
        GetResInfo(ResourceHandle,&IDList[ir],&_Type,Name);
        ReleaseResource(ResourceHandle);
    }

    SetResLoad(true);

    // Using a better sorter; STL will succeed where Rhys Hill had failed :-)
    sort(IDList,IDList+NumResources);

    // Now get the resources
    for (int ir=0; ir<NumResources; ir++)
    {
        ParseResource(Type,IDList[ir]);
    }

    delete [] IDList;
    return true;
}