VirtualBox

Changeset 67733 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jun 30, 2017 1:35:14 PM (8 years ago)
Author:
vboxsync
Message:

Main: Added Global::getOSTypeIndexFromId.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/Global.h

    r65158 r67733  
    8989     */
    9090    static const char *OSTypeId(VBOXOSTYPE aOSType);
     91
     92    /**
     93     * Maps an OS type ID string to index into sOSTypes.
     94     * @returns index on success, UINT32_MAX if not found.
     95     */
     96    static uint32_t getOSTypeIndexFromId(const char *pszId);
    9197
    9298    /**
  • trunk/src/VBox/Main/src-all/Global.cpp

    r66816 r67733  
    528528
    529529    return sOSTypes[0].id;
     530}
     531
     532/**
     533 * Maps an OS type ID string to index into sOSTypes.
     534 *
     535 * @returns index on success, UINT32_MAX if not found.
     536 * @param   pszId       The OS type ID string.
     537 */
     538/* static */ uint32_t Global::getOSTypeIndexFromId(const char *pszId)
     539{
     540    size_t const cOSTypes = Global::cOSTypes;
     541    for (size_t i = 0; i < cOSTypes; ++i)
     542        if (!RTStrICmp(pszId, Global::sOSTypes[i].id))
     543            return (uint32_t)i;
     544    return UINT32_MAX;
    530545}
    531546
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