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

📄 atlstl.hpp

📁 用STL的方式封装了WindowsAPI、COM调用、ACE、ATL、MFC、WTL等多种组件
💻 HPP
📖 第 1 页 / 共 2 页
字号:
 *  not defined              not defined             = stlsoft::atlstl_project
 *  not defined              defined                 not defined
 *  defined                  not defined             atlstl
 *  defined                  defined                 not defined
 *
 *
 *
 * The macro atlstl_ns_qual() macro can be used to refer to elements in the
 * ATLSTL libraries irrespective of whether they are in the
 * stlsoft::atlstl_project (or atlstl) namespace or in the global namespace.
 *
 * Furthermore, some compilers do not support the standard library in the std
 * namespace, so the atlstl_ns_qual_std() macro can be used to refer to elements
 * in the ATLSTL libraries irrespective of whether they are in the std namespace
 * or in the global namespace.
 *
 *
 * The ATL libraries themselves may or may not be defined within the ATL
 * namespace, so the atlstl_ns_qual_stl() macro can be used to refer to
 * elements in the ATLSTL libraries irrespective of whether they are in the std
 * namespace or in the global namespace.
 */

/* No STLSoft namespaces means no ATLSTL namespaces */
#ifdef _STLSOFT_NO_NAMESPACES
# define _ATLSTL_NO_NAMESPACES
#endif /* _STLSOFT_NO_NAMESPACES */

/* No ATLSTL namespaces means no atlstl namespace */
#ifdef _ATLSTL_NO_NAMESPACES
# define _ATLSTL_NO_NAMESPACE
#endif /* _ATLSTL_NO_NAMESPACES */

#ifndef _ATLSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
     defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
/* There is no stlsoft namespace, so must define ::atlstl */
/** \brief The <code class="namespace">atlstl</code> namespace contains all components
 *   in the \ref group__project__atlstl "ATLSTL" project.
 *
 * By default, the <code>atlstl</code> namespace is actually an alias for
 * the namespace <code>stlsoft::atlstl_project</code>, which is where all
 * the \ref group__project__atlstl "ATLSTL" components actually reside. This
 * measure allows all components within the main the
 * \ref group__project__stlsoft "STLSoft" project (which are defined within
 * the <code>stlsoft</code> namespace) to be visible to all components
 * "within" the <code>atlstl</code> namespace. (Otherwise, there would be a
 * whole lot of onerous qualification throughout the code of all
 * \ref group__projects "sub-projects".)
 *
 * \note If either/both of the symbols <code>_STLSOFT_NO_NAMESPACES</code>
 * and <code>_ATLSTL_NO_NAMESPACE</code> are defined, all 
 * \ref group__project__atlstl "ATLSTL" components will be defined in the
 * global namespace. Conversely, if the <code>_STLSOFT_NO_NAMESPACE</code>
 * symbol (not to be confused with the 
 * <code>_STLSOFT_NO_NAMESPACES</code> symbol!) is defined - meaning that
 * all \ref group__project__stlsoft "main project" components are to be
 * defined in the global namespace, and <code>_ATLSTL_NO_NAMESPACE</code>
 * is <b>not</b> defined, then all \ref group__project__atlstl "ATLSTL"
 * components will be defined within a bona fide <code>atlstl</code>
 * namespace.
 *
 * \note This is a vestige of compatibility with compilers with
 * no (or no sensible) namespace support that is maintained for reasons of
 * backwards compatiblity and because it is, in <i>rare circumstances</i>, a
 * useful facility.
 */
namespace atlstl
{
# else
/* Define stlsoft::atlstl_project */

namespace stlsoft
{

namespace atlstl_project
{

# endif /* _STLSOFT_NO_NAMESPACE */
#else
stlsoft_ns_using(move_lhs_from_rhs)
#endif /* !_ATLSTL_NO_NAMESPACE */

/** \def atlstl_ns_qual(x)
 * Qualifies with <b>atlstl::</b> if ATLSTL is using namespaces or, if not, does not qualify
 */

/** \def atlstl_ns_using(x)
 * Declares a using directive (with respect to <b>atlstl</b>) if ATLSTL is using namespaces or, if not, does nothing
 */

#ifndef _ATLSTL_NO_NAMESPACE
# define atlstl_ns_qual(x)          ::atlstl::x
# define atlstl_ns_using(x)         using ::atlstl::x;
#else /* ? _ATLSTL_NO_NAMESPACE */
# define atlstl_ns_qual(x)          x
# define atlstl_ns_using(x)
#endif /* !_ATLSTL_NO_NAMESPACE */

/** \def atlstl_ns_qual_std(x)
 * Qualifies with <b>std::</b> if ATLSTL is being translated in the context of the standard library being within the <b>std</b> namespace or, if not, does not qualify
 */

/** \def atlstl_ns_using_std(x)
 * Declares a using directive (with respect to <b>std</b>) if ATLSTL is being translated in the context of the standard library being within the <b>std</b> namespace or, if not, does nothing
 */

#ifdef STLSOFT_CF_std_NAMESPACE
# define atlstl_ns_qual_std(x)      ::std::x
# define atlstl_ns_using_std(x)     using ::std::x;
#else /* ? STLSOFT_CF_std_NAMESPACE */
# define atlstl_ns_qual_std(x)      x
# define atlstl_ns_using_std(x)
#endif /* !STLSOFT_CF_std_NAMESPACE */

/** \def atlstl_ns_qual_atl(x)
 * Qualifies with <b>ATL::</b> if ATLSTL is being translated in the context of ATL being within the <b>ATL</b> namespace or, if not, does not qualify
 */

/** \def atlstl_ns_using_atl(x)
 * Declares a using directive (with respect to <b>ATL</b>) if ATLSTL is being translated in the context of ATL being within the <b>ATL</b> namespace or, if not, does nothing
 */

#ifndef ATL_NO_NAMESPACE
# define atlstl_ns_qual_atl(x)       ::ATL::x
# define atlstl_ns_using_atl(x)      using ::ATL::x;
#else /* ? ATL_NO_NAMESPACE */
# define atlstl_ns_qual_atl(x)       x
# define atlstl_ns_using_atl(x)
#endif /* !ATL_NO_NAMESPACE */

/* /////////////////////////////////////////////////////////////////////////
 * Typedefs
 *
 * The ATLSTL uses a number of typedefs to aid in compiler-independence in the
 * libraries' main code.
 */

#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION

typedef stlsoft_ns_qual(ss_char_a_t)        as_char_a_t;    //!< Ansi char type
typedef stlsoft_ns_qual(ss_char_w_t)        as_char_w_t;    //!< Unicode char type
typedef stlsoft_ns_qual(ss_sint8_t)         as_sint8_t;     //!< 8-bit signed integer
typedef stlsoft_ns_qual(ss_uint8_t)         as_uint8_t;     //!< 8-bit unsigned integer
typedef stlsoft_ns_qual(ss_int16_t)         as_int16_t;     //!< 16-bit integer
typedef stlsoft_ns_qual(ss_sint16_t)        as_sint16_t;    //!< 16-bit signed integer
typedef stlsoft_ns_qual(ss_uint16_t)        as_uint16_t;    //!< 16-bit unsigned integer
typedef stlsoft_ns_qual(ss_int32_t)         as_int32_t;     //!< 32-bit integer
typedef stlsoft_ns_qual(ss_sint32_t)        as_sint32_t;    //!< 32-bit signed integer
typedef stlsoft_ns_qual(ss_uint32_t)        as_uint32_t;    //!< 32-bit unsigned integer
#ifdef STLSOFT_CF_64BIT_INT_SUPPORT
typedef stlsoft_ns_qual(ss_int64_t)         as_int64_t;     //!< 64-bit integer
typedef stlsoft_ns_qual(ss_sint64_t)        as_sint64_t;    //!< 64-bit signed integer
typedef stlsoft_ns_qual(ss_uint64_t)        as_uint64_t;    //!< 64-bit unsigned integer
#endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
typedef stlsoft_ns_qual(ss_int_t)           as_int_t;       //!< integer
typedef stlsoft_ns_qual(ss_sint_t)          as_sint_t;      //!< signed integer
typedef stlsoft_ns_qual(ss_uint_t)          as_uint_t;      //!< unsigned integer
typedef stlsoft_ns_qual(ss_long_t)          as_long_t;      //!< long
typedef stlsoft_ns_qual(ss_bool_t)          as_bool_t;      //!< bool
typedef DWORD                               as_dword_t;     //!< dword
typedef stlsoft_ns_qual(ss_size_t)          as_size_t;      //!< size
typedef stlsoft_ns_qual(ss_ptrdiff_t)       as_ptrdiff_t;   //!< ptr diff
typedef stlsoft_ns_qual(ss_streampos_t)     as_streampos_t; //!< streampos
typedef stlsoft_ns_qual(ss_streamoff_t)     as_streamoff_t; //!< streamoff

#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/* /////////////////////////////////////////////////////////////////////////
 * Values
 *
 * Since the boolean type may not be supported natively on all compilers, the
 * values of true and false may also not be provided. Hence the values of
 * as_true_v and as_false_v are defined, and are used in all code.
 */

#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION

#define as_true_v       ss_true_v
#define as_false_v      ss_false_v

#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
 * Code modification macros
 */

#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
/* Exception signatures. */
#define atlstl_throw_0()                                stlsoft_throw_0()
#define atlstl_throw_1(x1)                              stlsoft_throw_1(x1)
#define atlstl_throw_2(x1, x2)                          stlsoft_throw_2(x1, x2)
#define atlstl_throw_3(x1, x2, x3)                      stlsoft_throw_3(x1, x2, x3)
#define atlstl_throw_4(x1, x2, x3, x4)                  stlsoft_throw_4(x1, x2, x3, x4)
#define atlstl_throw_5(x1, x2, x3, x4, x5)              stlsoft_throw_5(x1, x2, x3, x4, x5)
#define atlstl_throw_6(x1, x2, x3, x4, x5, x6)          stlsoft_throw_6(x1, x2, x3, x4, x5, x6)
#define atlstl_throw_7(x1, x2, x3, x4, x5, x6, x7)      stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7)
#define atlstl_throw_8(x1, x2, x3, x4, x5, x6, x7, x8)  stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8)
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/// Evaluates, at compile time, to the number of elements within the given vector entity
///
/// \param ar An array whose dimension is to be evaluated
#define ATLSTL_NUM_ELEMENTS(ar)                         STLSOFT_NUM_ELEMENTS(ar)
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define atlstl_num_elements(ar)                        ATLSTL_NUM_ELEMENTS(ar)
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/** \brief [DEPRECATED] Destroys the given instance \c p of the given type (\c t and \c _type)
 *
 * \deprecated This is <b>heavily</b> deprecated in favour of \ref STLSOFT_DESTROY_INSTANCE().
 */
#define atlstl_destroy_instance(t, _type, p)            STLSOFT_DESTROY_INSTANCE(t, _type, p)

/** \brief [DEPRECATED] Generates an opaque type with the name \c _htype
 *
 * \deprecated This is <b>heavily</b> deprecated in favour of \ref STLSOFT_GEN_OPAQUE().
 */
#define atlstl_gen_opaque(_htype)                       STLSOFT_GEN_OPAQUE(_htype)

/* /////////////////////////////////////////////////////////////////////////
 * Functions
 */

/** This function is needed since there are ambiguities between COM headers and
 * ATL headers
 */
#if _ATL_VER < 0x0700
inline as_bool_t InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
{
   return ( ((as_int32_t*) &rguid1)[0] == ((as_int32_t*) &rguid2)[0] &&
            ((as_int32_t*) &rguid1)[1] == ((as_int32_t*) &rguid2)[1] &&
            ((as_int32_t*) &rguid1)[2] == ((as_int32_t*) &rguid2)[2] &&
            ((as_int32_t*) &rguid1)[3] == ((as_int32_t*) &rguid2)[3]);
}
#endif /* _ATL_VER < 0x0700 */

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

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

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

#ifndef _ATLSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
     defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace atlstl
# else
} // namespace atlstl_project
} // namespace stlsoft
namespace atlstl = ::stlsoft::atlstl_project;
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_ATLSTL_NO_NAMESPACE */

/* /////////////////////////////////////////////////////////////////////////
 * Inclusion
 */

#ifdef STLSOFT_CF_PRAGMA_ONCE_SUPPORT
# pragma once
#endif /* STLSOFT_CF_PRAGMA_ONCE_SUPPORT */

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

#endif /* ATLSTL_INCL_ATLSTL_HPP_ATLSTL */

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

⌨️ 快捷键说明

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