⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file_operations.hpp

📁 用STL的方式封装了WindowsAPI、COM调用、ACE、ATL、MFC、WTL等多种组件
💻 HPP
📖 第 1 页 / 共 3 页
字号:
/// \param from The file to delete
/// \param flags One or more of the FILEOP_FLAGS values.
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(ws_char_w_t const *from, FILEOP_FLAGS flags, ws_bool_t &bAborted)
{
    return shell_delete_w_(NULL, from, NULL, flags, &bAborted);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(ws_char_w_t const *from, ws_char_w_t const *progressTitle)
{
    return shell_delete_w_(NULL, from, progressTitle, 0, NULL);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(ws_char_w_t const *from, ws_char_w_t const *progressTitle, ws_bool_t &bAborted)
{
    return shell_delete_w_(NULL, from, progressTitle, 0, &bAborted);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
/// \param flags One or more of the FILEOP_FLAGS values.
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored. The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(ws_char_w_t const *from, ws_char_w_t const *progressTitle, FILEOP_FLAGS flags)
{
    return shell_delete_w_(NULL, from, progressTitle, flags, NULL);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
/// \param flags One or more of the FILEOP_FLAGS values.
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored. The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(ws_char_w_t const *from, ws_char_w_t const *progressTitle, FILEOP_FLAGS flags, ws_bool_t &bAborted)
{
    return shell_delete_w_(NULL, from, progressTitle, flags, &bAborted);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from)
{
    return shell_delete_w_(hwnd, from, NULL, 0, NULL);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, ws_bool_t &bAborted)
{
    return shell_delete_w_(hwnd, from, NULL, 0, &bAborted);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param flags One or more of the FILEOP_FLAGS values.
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored.
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, FILEOP_FLAGS flags)
{
    return shell_delete_w_(hwnd, from, NULL, flags, NULL);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param flags One or more of the FILEOP_FLAGS values.
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored.
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, FILEOP_FLAGS flags, ws_bool_t &bAborted)
{
    return shell_delete_w_(hwnd, from, NULL, flags, &bAborted);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, ws_char_w_t const *progressTitle)
{
    return shell_delete_w_(hwnd, from, progressTitle, 0, NULL);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, ws_char_w_t const *progressTitle, ws_bool_t &bAborted)
{
    return shell_delete_w_(hwnd, from, progressTitle, 0, &bAborted);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
/// \param flags One or more of the FILEOP_FLAGS values.
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored. The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, ws_char_w_t const *progressTitle, FILEOP_FLAGS flags)
{
    return shell_delete_w_(hwnd, from, progressTitle, flags, NULL);
}

/// \brief Requests the shell to delete the given file
///
/// \ingroup group__library__windows_shell
///
/// \param hwnd Handle to the window that will act as the parent to any dialogs displayed
/// \param from The file to delete
/// \param progressTitle String to be displayed describing the operation
/// \param flags One or more of the FILEOP_FLAGS values.
/// \param bAborted A Boolean that will indicate whether the operation was aborted
///
/// \note Throws std::bad_alloc on allocation failure on translators that support it
///
/// \note The FOF_WANTMAPPINGHANDLE flag is always ignored. The flag FOF_SIMPLEPROGRESS is automatically added if progressTitle is non-NULL
///
/// \return A status code indicating the success of the operation
///
/// \retval 0 The operation completed successfully
/// \retval ERROR_NOT_ENOUGH_MEMORY This is returned only when compiling with translators that do not support throwing std::bad_alloc on memory allocation failure
/// \retval !0 Any other Win32 error code
inline int shell_delete(HWND hwnd, ws_char_w_t const *from, ws_char_w_t const *progressTitle, FILEOP_FLAGS flags, ws_bool_t &bAborted)
{
    return shell_delete_w_(hwnd, from, progressTitle, flags, &bAborted);
}


////////////////////////////////////////////////////////////////////////////
// Unit-testing

#ifdef STLSOFT_UNITTEST
# include "./unittest/file_operations_unittest_.h"
#endif /* STLSOFT_UNITTEST */

/* ////////////////////////////////////////////////////////////////////// */

#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
     defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace winstl
# else
} // namespace winstl_project
} // namespace stlsoft
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */

/* ////////////////////////////////////////////////////////////////////// */

#endif /* WINSTL_INCL_WINSTL_SHELL_HPP_FILE_OPERATIONS */

/* ////////////////////////////////////////////////////////////////////// */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -