ICU-10347 add U_FINAL and U_OVERRIDE for C++11 "final" and "override".

Added them to several "not for subclassing" classes.
Some exceptions:
* Commented out U_FINAL where there's an internal override needed.
* For tests, added "#define U_FINAL" at the top to disable this.
#defined to null for Doxygen.

X-SVN-Rev: 36177
This commit is contained in:
Steven R. Loomis 2014-08-16 01:30:43 +00:00
parent 0a429569ff
commit e3dc3bc456
14 changed files with 68 additions and 22 deletions

View file

@ -1,7 +1,7 @@
# Doxyfile 1.3.7
# ********************************************************************
# * COPYRIGHT:
# * Copyright (c) 2004-2012, International Business Machines Corporation
# * Copyright (c) 2004-2014, International Business Machines Corporation
# * and others. All Rights Reserved.
# ********************************************************************
@ -192,7 +192,7 @@ EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = U_EXPORT2= U_STABLE= U_DRAFT= U_INTERNAL= U_SYSTEM= U_DEPRECATED= U_OBSOLETE= U_CALLCONV= U_CDECL_BEGIN= U_CDECL_END= U_NO_THROW=\ "U_NAMESPACE_BEGIN=namespace icu{" "U_NAMESPACE_END=}" U_HAVE_STD_STRING=1 U_SHOW_CPLUSPLUS_API=1 U_DEFINE_LOCAL_OPEN_POINTER()= U_IN_DOXYGEN=1
PREDEFINED = U_EXPORT2= U_STABLE= U_DRAFT= U_INTERNAL= U_SYSTEM= U_DEPRECATED= U_OBSOLETE= U_CALLCONV= U_CDECL_BEGIN= U_CDECL_END= U_NO_THROW=\ "U_NAMESPACE_BEGIN=namespace icu{" "U_NAMESPACE_END=}" U_HAVE_STD_STRING=1 U_SHOW_CPLUSPLUS_API=1 U_DEFINE_LOCAL_OPEN_POINTER()= U_IN_DOXYGEN=1 U_OVERRIDE= U_FINAL=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2011, International Business Machines Corporation and
* Copyright (C) 1996-2014, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@ -69,7 +69,7 @@ Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMB
* @author C++ port by V. Weinstein
* @stable ICU 2.4
*/
class U_COMMON_API CanonicalIterator : public UObject {
class U_COMMON_API CanonicalIterator U_FINAL : public UObject {
public:
/**
* Construct a CanonicalIterator object

View file

@ -1,6 +1,6 @@
/*
***************************************************************************
* Copyright (C) 1999-2013 International Business Machines Corporation *
* Copyright (C) 1999-2014 International Business Machines Corporation *
* and others. All rights reserved. *
***************************************************************************
@ -62,7 +62,7 @@ struct RBBIStateTable;
* not part of the ICU API, and may not remain stable.</p>
*
*/
class U_COMMON_API RuleBasedBreakIterator : public BreakIterator {
class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
protected:
/**

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1999-2012, International Business Machines
* Copyright (C) 1999-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -13,7 +13,7 @@
* created on: 1999sep13
* created by: Markus W. Scherer
*
* This file defines basic types and constants for utf.h to be
* This file defines basic types and constants for ICU to be
* platform-independent. umachine.h and utf.h are included into
* utypes.h to provide all the general definitions for ICU.
* All of these definitions used to be in utypes.h before
@ -116,6 +116,44 @@
/** This is used to declare a function as an internal ICU C API */
#define U_INTERNAL U_CAPI
/**
* \def U_OVERRIDE
* Defined to the C++11 "override" keyword if available.
* Denotes a class or member which is an override of the base class.
* May result in an error if it applied to something not an override.
* (NOTE: '#define U_OVERRIDE' at the top of a compilation unit will
* disable this keyword's use.)
* @internal
*/
/**
* \def U_FINAL
* Defined to the C++11 "final" keyword if available.
* Denotes a class or member which may not be overridden in subclasses.
* May result in an error if subclasses attempt to override.
* (NOTE: '#define U_FINAL' at the top of a compilation unit will
* disable this keyword's use.)
* @internal
*/
#if defined(__cplusplus) && __cplusplus>=201103L
/* C++11 */
#ifndef U_OVERRIDE
#define U_OVERRIDE override
#endif
#ifndef U_FINAL
#define U_FINAL final
#endif
#else
/* not C++11 - define to nothing */
#ifndef U_OVERRIDE
#define U_OVERRIDE
#endif
#ifndef U_FINAL
#define U_FINAL
#endif
#endif
/*==========================================================================*/
/* limits for int32_t etc., like in POSIX inttypes.h */
/*==========================================================================*/

View file

@ -1,6 +1,6 @@
/*
***************************************************************************
* Copyright (C) 1999-2013, International Business Machines Corporation
* Copyright (C) 1999-2014, International Business Machines Corporation
* and others. All Rights Reserved.
***************************************************************************
* Date Name Description
@ -273,7 +273,7 @@ class RuleCharacterIterator;
* @author Alan Liu
* @stable ICU 2.0
*/
class U_COMMON_API UnicodeSet : public UnicodeFilter {
class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
int32_t len; // length of list used; 0 <= len <= capacity
int32_t capacity; // capacity of list

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2002-2008, International Business Machines
* Copyright (c) 2002-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -58,7 +58,7 @@ class UnicodeString;
* @author M. Davis
* @stable ICU 2.4
*/
class U_COMMON_API UnicodeSetIterator : public UObject {
class U_COMMON_API UnicodeSetIterator U_FINAL : public UObject {
protected:

View file

@ -113,7 +113,7 @@ class UVector32;
* @see RuleBasedCollator
* @version 1.8 Jan 16 2001
*/
class U_I18N_API CollationElementIterator : public UObject {
class U_I18N_API CollationElementIterator U_FINAL : public UObject {
public:
// CollationElementIterator public data member ------------------------------

View file

@ -76,7 +76,7 @@ class Hashtable;
* locale at least contains any resources that are to be particularized for the
* calendar type.
*/
class U_I18N_API DateFormatSymbols : public UObject {
class U_I18N_API DateFormatSymbols U_FINAL : public UObject {
public:
/**
* Construct a DateFormatSymbols object by loading format data from

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2008-2011,2013, International Business Machines Corporation and
* Copyright (C) 2008-2014, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@ -148,7 +148,7 @@ U_NAMESPACE_BEGIN
* @stable ICU 4.0
**/
class U_I18N_API DateIntervalInfo : public UObject {
class U_I18N_API DateIntervalInfo U_FINAL : public UObject {
public:
#ifndef U_HIDE_INTERNAL_API
/**

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2002-2013, International Business Machines
* Copyright (C) 2002-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
@ -80,7 +80,7 @@ class UVector64;
*
* @stable ICU 2.4
*/
class U_I18N_API RegexPattern: public UObject {
class U_I18N_API RegexPattern U_FINAL : public UObject {
public:
/**
@ -622,7 +622,7 @@ private:
*
* @stable ICU 2.4
*/
class U_I18N_API RegexMatcher: public UObject {
class U_I18N_API RegexMatcher U_FINAL : public UObject {
public:
/**

View file

@ -129,7 +129,7 @@ U_NAMESPACE_BEGIN
* @since ICU 2.0
*/
class U_I18N_API StringSearch : public SearchIterator
class U_I18N_API StringSearch U_FINAL : public SearchIterator
{
public:

View file

@ -107,7 +107,7 @@ class UVector64;
* Note, RuleBasedCollator is not to be subclassed.
* @see Collator
*/
class U_I18N_API RuleBasedCollator : public Collator {
class U_I18N_API RuleBasedCollator U_FINAL : public Collator {
public:
/**
* RuleBasedCollator constructor. This takes the table rules and builds a

View file

@ -4,6 +4,10 @@
* others. All Rights Reserved.
********************************************************************/
// My4146160Collator overrides RBC. Disable U_FINAL for this test.
#define U_FINAL
#define U_OVERRIDE
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2000-2013, International Business Machines
* Copyright (C) 2000-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@ -8,6 +8,10 @@
**********************************************************************
*/
// AbbreviatedUnicodeSetIterator overrides UnicodeSetIterator.
#define U_FINAL
#define U_OVERRIDE
#include "unicode/utypes.h"
#if !UCONFIG_NO_TRANSLITERATION