VirtualBox

Ignore:
Timestamp:
Oct 22, 2010 11:52:30 AM (14 years ago)
Author:
vboxsync
Message:

Main-OVF: Select the target format out of the available formats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r33240 r33344  
    850850}
    851851
     852/**
     853 * Returns a medium format object corresponding to the given file extension or
     854 * null if no such format.
     855 *
     856 * @param aExt   File extension.
     857 *
     858 * @return ComObjPtr<MediumFormat>
     859 */
     860ComObjPtr<MediumFormat> SystemProperties::mediumFormatFromExtension(const Utf8Str &aExt)
     861{
     862    ComObjPtr<MediumFormat> format;
     863
     864    AutoCaller autoCaller(this);
     865    AssertComRCReturn (autoCaller.rc(), format);
     866
     867    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     868
     869    bool fFound = false;
     870    for (MediumFormatList::const_iterator it = m_llMediumFormats.begin();
     871         it != m_llMediumFormats.end() && !fFound;
     872         ++it)
     873    {
     874        /* MediumFormat is all const, no need to lock */
     875        MediumFormat::StrList aFileList = (*it)->getFileExtensions();
     876        for (MediumFormat::StrList::const_iterator it1 = aFileList.begin();
     877             it1 != aFileList.end();
     878             ++it1)
     879        {
     880            if ((*it1).compare(aExt, Utf8Str::CaseInsensitive) == 0)
     881            {
     882                format = *it;
     883                fFound = true;
     884                break;
     885            }
     886        }
     887    }
     888
     889    return format;
     890}
     891
    852892// private methods
    853893/////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette