mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
80 lines
3.1 KiB
C++
80 lines
3.1 KiB
C++
//===-- KnownProtocols.def - Compiler protocol metaprogramming --*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines macros used for macro-metaprogramming with compiler-known
|
|
// protocols.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
/// \def PROTOCOL(Id, Description)
|
|
///
|
|
/// The enumerator value is \c KnownProtocolKind::Id. The protocol represented
|
|
/// is simply named \p Id.
|
|
#ifndef PROTOCOL
|
|
#define PROTOCOL(Id)
|
|
#endif
|
|
|
|
/// \def LITERAL_CONVERTIBLE_PROTOCOL(Id, Description)
|
|
#ifndef LITERAL_CONVERTIBLE_PROTOCOL
|
|
#define LITERAL_CONVERTIBLE_PROTOCOL(Id, Description) PROTOCOL(Id)
|
|
#endif
|
|
|
|
/// \def BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(Id)
|
|
///
|
|
/// Note that this is not a special form of LITERAL_CONVERTIBLE_PROTOCOL.
|
|
#ifndef BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL
|
|
#define BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(Id) PROTOCOL(Id)
|
|
#endif
|
|
|
|
PROTOCOL(SequenceType)
|
|
PROTOCOL(GeneratorType)
|
|
PROTOCOL(BooleanType)
|
|
PROTOCOL(AnyObject)
|
|
PROTOCOL(RawRepresentable)
|
|
PROTOCOL(RawOptionSetType)
|
|
PROTOCOL(Equatable)
|
|
PROTOCOL(Hashable)
|
|
PROTOCOL(Comparable)
|
|
PROTOCOL(_ErrorType)
|
|
PROTOCOL(_OptionSetType)
|
|
|
|
PROTOCOL(_ObjectiveCBridgeable)
|
|
PROTOCOL(_DestructorSafeContainer)
|
|
|
|
LITERAL_CONVERTIBLE_PROTOCOL(ArrayLiteralConvertible, array)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(BooleanLiteralConvertible, boolean)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(CharacterLiteralConvertible, character)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(DictionaryLiteralConvertible, dictionary)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(ExtendedGraphemeClusterLiteralConvertible, character)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(FloatLiteralConvertible, floating-point)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(IntegerLiteralConvertible, integer)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(StringInterpolationConvertible, string)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(StringLiteralConvertible, string)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(NilLiteralConvertible, nil)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(UnicodeScalarLiteralConvertible, character)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(_ColorLiteralConvertible, color)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(_ImageLiteralConvertible, image)
|
|
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinBooleanLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinCharacterLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinExtendedGraphemeClusterLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinFloatLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinIntegerLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinStringLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinUTF16StringLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(_BuiltinUnicodeScalarLiteralConvertible)
|
|
|
|
#undef LITERAL_CONVERTIBLE_PROTOCOL
|
|
#undef BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL
|
|
#undef PROTOCOL
|