VirtualBox

Changeset 46008 in vbox for trunk/include


Ignore:
Timestamp:
May 13, 2013 11:05:55 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85671
Message:

iprt/dir.h,++: Added RTDirQueryUnknownType, RTDirQueryUnknownTypeEx, RTDirEntryIsStdDotLink and RTDirEntryExIsStdDotLink to simplify directory enumeration.

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dir.h

    r44528 r46008  
    273273     * systems (or Unixes) stores the type of a directory entry and instead
    274274     * expects the user to use stat() to get it.  So, when you see this you
    275      * should use RTPathQueryInfo to get the type, or if if you're lazy, use
    276      * RTDirReadEx. */
     275     * should use RTDirQueryUnknownType or RTDirQueryUnknownTypeEx to get the type,
     276     * or if if you're lazy, use RTDirReadEx. */
    277277    RTDIRENTRYTYPE  enmType;
    278278    /** The length of the filename, excluding the terminating nul character. */
     
    285285/** Pointer to a directory entry. */
    286286typedef RTDIRENTRY *PRTDIRENTRY;
     287/** Pointer to a const directory entry. */
     288typedef RTDIRENTRY const *PCRTDIRENTRY;
    287289
    288290
     
    314316/** Pointer to a directory entry. */
    315317typedef RTDIRENTRYEX *PRTDIRENTRYEX;
     318/** Pointer to a const directory entry. */
     319typedef RTDIRENTRYEX const *PCRTDIRENTRYEX;
    316320
    317321
     
    410414RTDECL(int) RTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags);
    411415
     416/**
     417 * Resolves RTDIRENTRYTYPE_UNKNOWN values returned by RTDirRead.
     418 *
     419 * @returns IPRT status code (see RTPathQueryInfo).
     420 * @param   pszComposedName The path to the directory entry. The caller must
     421 *                          compose this, it's NOT sufficient to pass
     422 *                          RTDIRENTRY::szName!
     423 * @param   penmType        Pointer to the RTDIRENTRY::enmType member.  If this
     424 *                          is not RTDIRENTRYTYPE_UNKNOWN, the function will
     425 *                          return immediately without doing anything.  If it
     426 *                          is, it will use RTPathQueryInfo to try figure out
     427 *                          the correct value.  On failure, this will be
     428 *                          unchanged.
     429 */
     430RTDECL(int) RTDirQueryUnknownType(const char *pszComposedName, RTDIRENTRYTYPE *penmType);
     431
     432/**
     433 * Resolves RTDIRENTRYTYPE_UNKNOWN values returned by RTDirRead, extended
     434 * version.
     435 *
     436 * @returns IPRT status code (see RTPathQueryInfo).
     437 * @param   pszComposedName The path to the directory entry. The caller must
     438 *                          compose this, it's NOT sufficient to pass
     439 *                          RTDIRENTRY::szName!
     440 * @param   penmType        Pointer to the RTDIRENTRY::enmType member or
     441 *                          similar.  Will NOT be checked on input.
     442 * @param   pObjInfo        The object info buffer to use with RTPathQueryInfo.
     443 */
     444RTDECL(int) RTDirQueryUnknownTypeEx(const char *pszComposedName, RTDIRENTRYTYPE *penmType, PRTFSOBJINFO pObjInfo);
     445
     446/**
     447 * Checks if the directory entry returned by RTDirRead is '.', '..' or similar.
     448 *
     449 * @returns true / false.
     450 * @param   pDirEntry       The directory entry to check.
     451 */
     452RTDECL(bool) RTDirEntryIsStdDotLink(PRTDIRENTRY pDirEntry);
     453
     454/**
     455 * Checks if the directory entry returned by RTDirReadEx is '.', '..' or
     456 * similar.
     457 *
     458 * @returns true / false.
     459 * @param   pDirEntryEx     The extended directory entry to check.
     460 */
     461RTDECL(bool) RTDirEntryExIsStdDotLink(PCRTDIRENTRYEX pDirEntryEx);
    412462
    413463/**
  • trunk/include/iprt/mangling.h

    r45994 r46008  
    426426# define RTDirCreateTempSecure                          RT_MANGLER(RTDirCreateTempSecure)
    427427# define RTDirCreateUniqueNumbered                      RT_MANGLER(RTDirCreateUniqueNumbered)
     428# define RTDirEntryIsStdDotLink                         RT_MANGLER(RTDirEntryIsStdDotLink)
     429# define RTDirEntryExIsStdDotLink                       RT_MANGLER(RTDirEntryExIsStdDotLink)
    428430# define RTDirExists                                    RT_MANGLER(RTDirExists)
    429431# define RTDirFlush                                     RT_MANGLER(RTDirFlush)
     
    432434# define RTDirOpenFiltered                              RT_MANGLER(RTDirOpenFiltered)
    433435# define RTDirQueryInfo                                 RT_MANGLER(RTDirQueryInfo)
     436# define RTDirQueryUnknownType                          RT_MANGLER(RTDirQueryUnknownType)
     437# define RTDirQueryUnknownTypeEx                        RT_MANGLER(RTDirQueryUnknownTypeEx)
    434438# define RTDirRead                                      RT_MANGLER(RTDirRead)
    435439# define RTDirReadEx                                    RT_MANGLER(RTDirReadEx)
Note: See TracChangeset for help on using the changeset viewer.

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