Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22876 add U_SHOW_CPLUSPLUS_HEADER_API for C++ header-only APIs #3161

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions icu4c/source/common/unicode/uset.h
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ U_CAPI UBool U_EXPORT2
uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
UChar32* pStart, UChar32* pEnd);

#if U_SHOW_CPLUSPLUS_API
#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
#ifndef U_HIDE_DRAFT_API

namespace U_HEADER_ONLY_NAMESPACE {
Expand Down Expand Up @@ -1893,6 +1893,6 @@ class USetElements {
} // namespace U_HEADER_ONLY_NAMESPACE

#endif // U_HIDE_DRAFT_API
#endif // U_SHOW_CPLUSPLUS_API
#endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API

#endif // __USET_H__
19 changes: 17 additions & 2 deletions icu4c/source/common/unicode/utypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,37 @@
* integer and other types.
*/

/** @{ API visibility control */

/**
* \def U_SHOW_CPLUSPLUS_API
* When defined to 1 (=default) and compiled with a C++ compiler, both C and C++ APIs are visible.
* Otherwise, only C APIs are visible; this is for C++ users who want to
* restrict their usage to binary stable C APIs exported by ICU DLLs.
* @internal
*/
/**
* \def U_SHOW_CPLUSPLUS_HEADER_API
* When defined to 1 (=default) and compiled with a C++ compiler, C++ header-only APIs are visible.
* This is for C++ users who restrict their usage to binary stable C APIs exported by ICU DLLs
* (U_SHOW_CPLUSPLUS_API=0)
* but who still want to use C++ header-only APIs which do not rely on ICU DLL exports.
* @internal
*/
#ifdef __cplusplus
# ifndef U_SHOW_CPLUSPLUS_API
# define U_SHOW_CPLUSPLUS_API 1
# endif
# ifndef U_SHOW_CPLUSPLUS_HEADER_API
# define U_SHOW_CPLUSPLUS_HEADER_API 1
# endif
#else
# undef U_SHOW_CPLUSPLUS_API
# define U_SHOW_CPLUSPLUS_API 0
# undef U_SHOW_CPLUSPLUS_HEADER_API
# define U_SHOW_CPLUSPLUS_HEADER_API 0
#endif

/** @{ API visibility control */

/**
* \def U_HIDE_DRAFT_API
* Define this to 1 to request that draft API be "hidden"
Expand Down