clang  6.0.0svn
Classes | Public Member Functions | List of all members
clang::ast_matchers::dynamic::VariantValue Class Reference

Variant value class. More...

#include "clang/ASTMatchers/Dynamic/VariantValue.h"

Public Member Functions

 VariantValue ()
 
 VariantValue (const VariantValue &Other)
 
 ~VariantValue ()
 
VariantValueoperator= (const VariantValue &Other)
 
 VariantValue (bool Boolean)
 Specific constructors for each supported type. More...
 
 VariantValue (double Double)
 
 VariantValue (unsigned Unsigned)
 
 VariantValue (StringRef String)
 
 VariantValue (const VariantMatcher &Matchers)
 
 VariantValue (int Signed)
 Constructs an unsigned value (disambiguation from bool). More...
 
 operator bool () const
 Returns true iff this is not an empty value. More...
 
bool hasValue () const
 
bool isBoolean () const
 Boolean value functions. More...
 
bool getBoolean () const
 
void setBoolean (bool Boolean)
 
bool isDouble () const
 Double value functions. More...
 
double getDouble () const
 
void setDouble (double Double)
 
bool isUnsigned () const
 Unsigned value functions. More...
 
unsigned getUnsigned () const
 
void setUnsigned (unsigned Unsigned)
 
bool isString () const
 String value functions. More...
 
const std::string & getString () const
 
void setString (StringRef String)
 
bool isMatcher () const
 Matcher value functions. More...
 
const VariantMatchergetMatcher () const
 
void setMatcher (const VariantMatcher &Matcher)
 
bool isConvertibleTo (ArgKind Kind, unsigned *Specificity) const
 Determines if the contained value can be converted to Kind. More...
 
bool isConvertibleTo (ArrayRef< ArgKind > Kinds, unsigned *Specificity) const
 Determines if the contained value can be converted to any kind in Kinds. More...
 
std::string getTypeAsString () const
 String representation of the type of the value. More...
 

Detailed Description

Variant value class.

Basically, a tagged union with value type semantics. It is used by the registry as the return value and argument type for the matcher factory methods. It can be constructed from any of the supported types. It supports copy/assignment.

Supported types:

llvm::StringRef

Definition at line 251 of file VariantValue.h.

Constructor & Destructor Documentation

◆ VariantValue() [1/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( )
inline

Definition at line 253 of file VariantValue.h.

◆ VariantValue() [2/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( const VariantValue Other)

Definition at line 250 of file VariantValue.cpp.

◆ ~VariantValue()

clang::ast_matchers::dynamic::VariantValue::~VariantValue ( )

Definition at line 274 of file VariantValue.cpp.

◆ VariantValue() [3/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( bool  Boolean)

Specific constructors for each supported type.

Definition at line 254 of file VariantValue.cpp.

References setBoolean().

◆ VariantValue() [4/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( double  Double)

Definition at line 258 of file VariantValue.cpp.

References setDouble().

◆ VariantValue() [5/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( unsigned  Unsigned)

Definition at line 262 of file VariantValue.cpp.

References setUnsigned().

◆ VariantValue() [6/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( StringRef  String)

Definition at line 266 of file VariantValue.cpp.

References setString().

◆ VariantValue() [7/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( const VariantMatcher Matchers)

Definition at line 270 of file VariantValue.cpp.

References setMatcher().

◆ VariantValue() [8/8]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( int  Signed)
inline

Constructs an unsigned value (disambiguation from bool).

Definition at line 267 of file VariantValue.h.

Member Function Documentation

◆ getBoolean()

bool clang::ast_matchers::dynamic::VariantValue::getBoolean ( ) const

Definition at line 324 of file VariantValue.cpp.

References isBoolean().

Referenced by operator=().

◆ getDouble()

double clang::ast_matchers::dynamic::VariantValue::getDouble ( ) const

Definition at line 339 of file VariantValue.cpp.

References isDouble().

Referenced by operator=().

◆ getMatcher()

const VariantMatcher & clang::ast_matchers::dynamic::VariantValue::getMatcher ( ) const

◆ getString()

const std::string & clang::ast_matchers::dynamic::VariantValue::getString ( ) const

◆ getTypeAsString()

std::string clang::ast_matchers::dynamic::VariantValue::getTypeAsString ( ) const

◆ getUnsigned()

unsigned clang::ast_matchers::dynamic::VariantValue::getUnsigned ( ) const

Definition at line 354 of file VariantValue.cpp.

References isUnsigned().

Referenced by operator=().

◆ hasValue()

bool clang::ast_matchers::dynamic::VariantValue::hasValue ( ) const
inline

Definition at line 271 of file VariantValue.h.

◆ isBoolean()

bool clang::ast_matchers::dynamic::VariantValue::isBoolean ( ) const

Boolean value functions.

Definition at line 320 of file VariantValue.cpp.

Referenced by getBoolean(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< bool >::is(), and isConvertibleTo().

◆ isConvertibleTo() [1/2]

bool clang::ast_matchers::dynamic::VariantValue::isConvertibleTo ( ArgKind  Kind,
unsigned *  Specificity 
) const

◆ isConvertibleTo() [2/2]

bool clang::ast_matchers::dynamic::VariantValue::isConvertibleTo ( ArrayRef< ArgKind Kinds,
unsigned *  Specificity 
) const

Determines if the contained value can be converted to any kind in Kinds.

Parameters
Kindsthe requested destination types.
Specificityvalue corresponding to the "specificity" of the conversion. It is the maximum specificity of all the possible conversions.

Definition at line 429 of file VariantValue.cpp.

References isConvertibleTo(), and max().

◆ isDouble()

bool clang::ast_matchers::dynamic::VariantValue::isDouble ( ) const

Double value functions.

Definition at line 335 of file VariantValue.cpp.

Referenced by getDouble(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< double >::is(), and isConvertibleTo().

◆ isMatcher()

bool clang::ast_matchers::dynamic::VariantValue::isMatcher ( ) const

◆ isString()

bool clang::ast_matchers::dynamic::VariantValue::isString ( ) const

◆ isUnsigned()

bool clang::ast_matchers::dynamic::VariantValue::isUnsigned ( ) const

Unsigned value functions.

Definition at line 350 of file VariantValue.cpp.

Referenced by getUnsigned(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< unsigned >::is(), and isConvertibleTo().

◆ operator bool()

clang::ast_matchers::dynamic::VariantValue::operator bool ( ) const
inlineexplicit

Returns true iff this is not an empty value.

Definition at line 270 of file VariantValue.h.

◆ operator=()

VariantValue & clang::ast_matchers::dynamic::VariantValue::operator= ( const VariantValue Other)

◆ setBoolean()

void clang::ast_matchers::dynamic::VariantValue::setBoolean ( bool  Boolean)

Definition at line 329 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setDouble()

void clang::ast_matchers::dynamic::VariantValue::setDouble ( double  Double)

Definition at line 344 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setMatcher()

void clang::ast_matchers::dynamic::VariantValue::setMatcher ( const VariantMatcher Matcher)

Definition at line 389 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setString()

void clang::ast_matchers::dynamic::VariantValue::setString ( StringRef  String)

Definition at line 374 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setUnsigned()

void clang::ast_matchers::dynamic::VariantValue::setUnsigned ( unsigned  Unsigned)

Definition at line 359 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().


The documentation for this class was generated from the following files: