Ejemplo n.º 1
0
bool TRFactory::ReadDescriptions(const string& inRelativePathFilename, TRDescriptionList& outDescriptionList)
{
    bool theSuccess = false;
    bool theDescriptionRead = false;

    // Open file specified by relative path name
    fstream infile;
    infile.open(inRelativePathFilename.c_str(), ios::in);

    if(infile.is_open())
    {
        do
        {
            // Try to read the next description in
            TRDescription theNextDescription;
            theDescriptionRead = ReadDescription(infile, theNextDescription);

            // add it to the description list
            if(theDescriptionRead)
            {
                // Function is successful if at least one description was found
                outDescriptionList.push_back(theNextDescription);
                theSuccess = true;
            }

        } while(theDescriptionRead);

        infile.close();
    }
    return theSuccess;
}
Ejemplo n.º 2
0
bool UIManager::Save(const string& outFilename, const string& outHeader)
{
    // Build description list
    TRDescriptionList theDescriptionList;

    UIComponentListType::iterator theCompIter;
    for(theCompIter = this->mComponentList.begin(); theCompIter != this->mComponentList.end(); theCompIter++)
    {
        theDescriptionList.push_back((*theCompIter)->GetDescription());
    }

    // Write it out!
    TRFactory::WriteDescriptions(outFilename, theDescriptionList, outHeader);

	return true;
}