Public Member Functions | Static Public Member Functions | List of all members
ECClass Struct Referenceabstract

The in-memory representation of an ECClass as defined by ECSchemaXML. More...

#include <ECSchema.h>

Inheritance diagram for ECClass:
IECCustomAttributeContainer ECRelationshipClass

Public Member Functions

ECClassId GetId () const
 Return unique id (May return 0 until it has been explicitly set by ECDb or a similar system) More...
 
StandaloneECEnablerP GetDefaultStandaloneEnabler () const
 Returns the StandaloneECEnabler for this class. More...
 
ECRelationshipClassCP GetRelationshipClassCP () const
 Used to avoid dynamic_cast. More...
 
ECRelationshipClassP GetRelationshipClassP ()
 Used to avoid dynamic_cast. More...
 
ECSchemaCR GetSchema () const
 The ECSchema that this class is defined in. More...
 
WStringCR GetName () const
 The name of this ECClass. More...
 
WCharCP GetFullName () const
 {SchemaName}:{ClassName} The pointer will remain valid as long as the ECClass exists. More...
 
bool GetIsDisplayLabelDefined () const
 Whether the display label is explicitly defined or not. More...
 
ECPropertyIterable GetProperties () const
 Returns an iterable of all the ECProperties defined on this class. More...
 
size_t GetPropertyCount (bool includeBaseProperties=true) const
 Returns the number of ECProperties in this class. More...
 
const ECBaseClassesListGetBaseClasses () const
 Returns a list of the classes this ECClass is derived from. More...
 
const ECDerivedClassesListGetDerivedClasses () const
 Returns a list of the classes that derive from this class. More...
 
ECObjectsStatus SetDescription (WStringCR value)
 Sets the description of this ECClass. More...
 
WStringCR GetDescription () const
 Gets the description of this ECClass. Returns the localized description if one exists. More...
 
WStringCR GetInvariantDescription () const
 Gets the invariant description for this ECClass. More...
 
ECObjectsStatus SetDisplayLabel (WStringCR value)
 Sets the display label of this ECClass. More...
 
WStringCR GetDisplayLabel () const
 Gets the display label of this ECClass. If no display label has been set explicitly, it will return the name of the ECClass. More...
 
WStringCR GetInvariantDisplayLabel () const
 Gets the invariant display label for this ECClass. More...
 
ECPropertyIterable GetProperties (bool includeBaseProperties) const
 Returns a list of properties for this class. More...
 
ECObjectsStatus SetIsStruct (WCharCP isStruct)
 Sets the bool value of whether this class can be used as a struct. More...
 
ECObjectsStatus SetIsStruct (bool value)
 Sets the bool value of whether this class can be used as a struct. More...
 
bool GetIsStruct () const
 Returns whether this class can be used as a struct. More...
 
ECObjectsStatus SetIsCustomAttributeClass (WCharCP isCustomAttribute)
 Sets the bool value of whether this class can be used as a custom attribute. More...
 
ECObjectsStatus SetIsCustomAttributeClass (bool value)
 Sets the bool value of whether this class can be used as a custom attribute. More...
 
bool GetIsCustomAttributeClass () const
 Returns whether this class can be used as a custom attribute. More...
 
ECObjectsStatus SetIsDomainClass (WCharCP isDomainClass)
 Sets the bool value of whether this class can be used as a domain object. More...
 
ECObjectsStatus SetIsDomainClass (bool value)
 Sets the bool value of whether this class can be used as a domain object. More...
 
bool GetIsDomainClass () const
 Gets whether this class can be used as a domain object. More...
 
ECObjectsStatus SetIsFinal (WCharCP isFinal)
 Sets the bool value of whether this class is final and can't be subclassed. More...
 
ECObjectsStatus SetIsFinal (bool value)
 Sets the bool value of whether this class is final and can't be subclassed. More...
 
bool GetIsFinal () const
 Gets whether this class is final and can't be subclassed. More...
 
ECObjectsStatus AddBaseClass (ECClassCR baseClass)
 Adds a base class You cannot add a base class if it creates a cycle. More...
 
bool HasBaseClasses () const
 Returns whether there are any base classes for this class. More...
 
ECObjectsStatus RemoveBaseClass (ECClassCR baseClass)
 Removes a base class. More...
 
bool Is (ECClassCP targetClass) const
 Returns true if the class is the type specified or derived from it. More...
 
bool Is (WCharCP name) const
 Returns true if the class name is of the type specified or derived from it. More...
 
bool Is (WCharCP schemaName, WCharCP className) const
 Returns true if this class matches the specified schema and class name, or is derived from a matching class. More...
 
ECObjectsStatus CreatePrimitiveProperty (PrimitiveECPropertyP &ecProperty, WStringCR name)
 If the given name is valid, creates a primitive property object with the default type of STRING. More...
 
ECObjectsStatus CreatePrimitiveProperty (PrimitiveECPropertyP &ecProperty, WStringCR name, PrimitiveType primitiveType)
 If the given name is valid, creates a primitive property object with the given primitive type. More...
 
ECObjectsStatus CreateStructProperty (StructECPropertyP &ecProperty, WStringCR name)
 If the given name is valid, creates a struct property object using the current class as the struct type. More...
 
ECObjectsStatus CreateStructProperty (StructECPropertyP &ecProperty, WStringCR name, ECClassCR structType)
 If the given name is valid, creates a struct property object using the specified class as the struct type. More...
 
ECObjectsStatus CreateArrayProperty (ArrayECPropertyP &ecProperty, WStringCR name)
 If the given name is valid, creates an array property object using the current class as the array type. More...
 
ECObjectsStatus CreateArrayProperty (ArrayECPropertyP &ecProperty, WStringCR name, PrimitiveType primitiveType)
 If the given name is valid, creates an array property object using the specified primitive type as the array type. More...
 
ECObjectsStatus CreateArrayProperty (ArrayECPropertyP &ecProperty, WStringCR name, ECClassCP structType)
 If the given name is valid, creates an array property object using the specified class as the array type. More...
 
ECObjectsStatus RemoveProperty (WStringCR name)
 Remove the named property. More...
 
ECPropertyP GetPropertyP (WCharCP name, bool includeBaseClasses=true) const
 Get a property by name within the context of this class and its base classes. More...
 
ECPropertyP GetPropertyP (WStringCR name, bool includeBaseClasses=true) const
 Get a property by name within the context of this class and its base classes. More...
 
ECPropertyP GetPropertyP (Utf8CP name, bool includeBaseClasses=true) const
 Get a property by name within the context of this class and its base classes. More...
 
- Public Member Functions inherited from IECCustomAttributeContainer
bool IsDefined (WStringCR schemaName, WStringCR className) const
 Returns true if the container has a custom attribute of a class of the specified name. More...
 
bool IsDefined (ECClassCR classDefinition) const
 Returns true if the container has a custom attribute of a class of the specified class definition. More...
 
IECInstancePtr GetCustomAttribute (WStringCR schemaName, WStringCR className) const
 Retrieves the custom attribute matching the class name. More...
 
IECInstancePtr GetCustomAttribute (ECClassCR classDefinition) const
 Retrieves the custom attribute matching the class definition. More...
 
IECInstancePtr GetCustomAttributeLocal (WStringCR schemaName, WStringCR className) const
 Retrieves the custom attribute matching the class name. More...
 
IECInstancePtr GetCustomAttributeLocal (ECClassCR classDefinition) const
 Retrieves the custom attribute matching the class definition. More...
 
IECInstancePtr GetPrimaryCustomAttribute (WStringCR schemaName, WStringCR className) const
 Retrieves the custom attribute matching the class name. More...
 
IECInstancePtr GetPrimaryCustomAttribute (ECClassCR classDefinition) const
 Retrieves the custom attribute matching the class definition. More...
 
ECCustomAttributeInstanceIterable GetCustomAttributes (bool includeBase) const
 Retrieves all custom attributes from the container including supplemental custom attributes. More...
 
ECCustomAttributeInstanceIterable GetPrimaryCustomAttributes (bool includeBase) const
 Retrieves all custom attributes from the container NOT including supplemental custom attributes. More...
 
ECObjectsStatus SetCustomAttribute (IECInstanceR customAttributeInstance)
 Adds a custom attribute to the container. More...
 
bool RemoveCustomAttribute (WStringCR schemaName, WStringCR className)
 Removes a custom attribute from the container. More...
 
bool RemoveCustomAttribute (ECClassCR classDefinition)
 Removes a custom attribute from the container. More...
 
bool IsDefined (WStringCR className) const
 LEGECY METHODS. More...
 
IECInstancePtr GetCustomAttribute (WStringCR className) const
 
IECInstancePtr GetCustomAttributeLocal (WStringCR className) const
 
IECInstancePtr GetPrimaryCustomAttribute (WStringCR className) const
 
bool RemoveCustomAttribute (WStringCR className)
 

Static Public Member Functions

static ECObjectsStatus ParseClassName (WStringR prefix, WStringR className, WStringCR qualifiedClassName)
 Given a qualified class name, will parse out the schema's namespace prefix and the class name. More...
 
static WString GetQualifiedClassName (ECSchemaCR primarySchema, ECClassCR ecClass)
 Given a schema and a class, will return the fully qualified class name. More...
 
static bool ClassesAreEqualByName (ECClassCP currentBaseClass, const void *arg)
 Given two ECClass's, checks to see if they are equal by name. More...
 

Detailed Description

The in-memory representation of an ECClass as defined by ECSchemaXML.

Member Function Documentation

ECObjectsStatus AddBaseClass ( ECClassCR  baseClass)

Adds a base class You cannot add a base class if it creates a cycle.

For example, if A is a base class of B, and B is a base class of C, you cannot make C a base class of A. Attempting to do so will return an error. You also can't add a base class to final classes

Parameters
[in]baseClassThe class to derive from
static bool ClassesAreEqualByName ( ECClassCP  currentBaseClass,
const void *  arg 
)
static

Given two ECClass's, checks to see if they are equal by name.

Parameters
[in]currentBaseClassThe source class to check against
[in]argThe target to compare to (this parameter must be an ECClassP)
ECObjectsStatus CreateArrayProperty ( ArrayECPropertyP &  ecProperty,
WStringCR  name 
)

If the given name is valid, creates an array property object using the current class as the array type.

ECObjectsStatus CreateArrayProperty ( ArrayECPropertyP &  ecProperty,
WStringCR  name,
PrimitiveType  primitiveType 
)

If the given name is valid, creates an array property object using the specified primitive type as the array type.

ECObjectsStatus CreateArrayProperty ( ArrayECPropertyP &  ecProperty,
WStringCR  name,
ECClassCP  structType 
)

If the given name is valid, creates an array property object using the specified class as the array type.

ECObjectsStatus CreatePrimitiveProperty ( PrimitiveECPropertyP &  ecProperty,
WStringCR  name 
)

If the given name is valid, creates a primitive property object with the default type of STRING.

ECObjectsStatus CreatePrimitiveProperty ( PrimitiveECPropertyP &  ecProperty,
WStringCR  name,
PrimitiveType  primitiveType 
)

If the given name is valid, creates a primitive property object with the given primitive type.

ECObjectsStatus CreateStructProperty ( StructECPropertyP &  ecProperty,
WStringCR  name 
)

If the given name is valid, creates a struct property object using the current class as the struct type.

ECObjectsStatus CreateStructProperty ( StructECPropertyP &  ecProperty,
WStringCR  name,
ECClassCR  structType 
)

If the given name is valid, creates a struct property object using the specified class as the struct type.

const ECBaseClassesList& GetBaseClasses ( ) const

Returns a list of the classes this ECClass is derived from.

StandaloneECEnablerP GetDefaultStandaloneEnabler ( ) const

Returns the StandaloneECEnabler for this class.

const ECDerivedClassesList& GetDerivedClasses ( ) const

Returns a list of the classes that derive from this class.

WStringCR GetDescription ( ) const

Gets the description of this ECClass. Returns the localized description if one exists.

WStringCR GetDisplayLabel ( ) const

Gets the display label of this ECClass. If no display label has been set explicitly, it will return the name of the ECClass.

WCharCP GetFullName ( ) const

{SchemaName}:{ClassName} The pointer will remain valid as long as the ECClass exists.

ECClassId GetId ( ) const

Return unique id (May return 0 until it has been explicitly set by ECDb or a similar system)

WStringCR GetInvariantDescription ( ) const

Gets the invariant description for this ECClass.

WStringCR GetInvariantDisplayLabel ( ) const

Gets the invariant display label for this ECClass.

bool GetIsCustomAttributeClass ( ) const

Returns whether this class can be used as a custom attribute.

bool GetIsDisplayLabelDefined ( ) const

Whether the display label is explicitly defined or not.

bool GetIsDomainClass ( ) const

Gets whether this class can be used as a domain object.

bool GetIsFinal ( ) const

Gets whether this class is final and can't be subclassed.

bool GetIsStruct ( ) const

Returns whether this class can be used as a struct.

WStringCR GetName ( ) const

The name of this ECClass.

ECPropertyIterable GetProperties ( ) const

Returns an iterable of all the ECProperties defined on this class.

ECPropertyIterable GetProperties ( bool  includeBaseProperties) const

Returns a list of properties for this class.

Parameters
[in]includeBasePropertiesIf true, then will return properties that are contained in this class's base class(es)
Returns
An iterable container of ECProperties
size_t GetPropertyCount ( bool  includeBaseProperties = true) const

Returns the number of ECProperties in this class.

ECPropertyP GetPropertyP ( WCharCP  name,
bool  includeBaseClasses = true 
) const

Get a property by name within the context of this class and its base classes.

The pointer returned by this method is valid until the ECClass containing the property is destroyed or the property is removed from the class.

Parameters
[in]nameThe name of the property to lookup.
[in]includeBaseClassesWhether to look on base classes of the current class for the named property
Returns
A pointer to an ECN::ECProperty if the named property exists within the current class; otherwise, NULL
ECPropertyP GetPropertyP ( WStringCR  name,
bool  includeBaseClasses = true 
) const

Get a property by name within the context of this class and its base classes.

The pointer returned by this method is valid until the ECClass containing the property is destroyed or the property is removed from the class.

Parameters
[in]nameThe name of the property to lookup.
[in]includeBaseClassesWhether to look on base classes of the current class for the named property
Returns
A pointer to an ECN::ECProperty if the named property exists within the current class; otherwise, NULL
ECPropertyP GetPropertyP ( Utf8CP  name,
bool  includeBaseClasses = true 
) const

Get a property by name within the context of this class and its base classes.

The pointer returned by this method is valid until the ECClass containing the property is destroyed or the property is removed from the class.

Parameters
[in]nameThe name of the property to lookup.
[in]includeBaseClassesWhether to look on base classes of the current class for the named property
Returns
A pointer to an ECN::ECProperty if the named property exists within the current class; otherwise, NULL
static WString GetQualifiedClassName ( ECSchemaCR  primarySchema,
ECClassCR  ecClass 
)
static

Given a schema and a class, will return the fully qualified class name.

If the class is part of the passed in schema, there is no namespace prefix. Otherwise, the class's schema must be a referenced schema in the passed in schema

Parameters
[in]primarySchemaThe schema used to lookup the namespace prefix of the class's schema
[in]ecClassThe class whose schema should be searched for
Returns
WString The namespace prefix if the class's schema is not the primarySchema
ECRelationshipClassCP GetRelationshipClassCP ( ) const

Used to avoid dynamic_cast.

ECRelationshipClassP GetRelationshipClassP ( )

Used to avoid dynamic_cast.

ECSchemaCR GetSchema ( ) const

The ECSchema that this class is defined in.

bool HasBaseClasses ( ) const

Returns whether there are any base classes for this class.

bool Is ( ECClassCP  targetClass) const

Returns true if the class is the type specified or derived from it.

bool Is ( WCharCP  name) const

Returns true if the class name is of the type specified or derived from it.

bool Is ( WCharCP  schemaName,
WCharCP  className 
) const

Returns true if this class matches the specified schema and class name, or is derived from a matching class.

static ECObjectsStatus ParseClassName ( WStringR  prefix,
WStringR  className,
WStringCR  qualifiedClassName 
)
static

Given a qualified class name, will parse out the schema's namespace prefix and the class name.

Parameters
[out]prefixThe namespace prefix of the schema
[out]classNameThe name of the class
[in]qualifiedClassNameThe qualified name of the class, in the format of ns:className
Returns
A status code indicating whether the qualified name was successfully parsed or not
ECObjectsStatus RemoveBaseClass ( ECClassCR  baseClass)

Removes a base class.

ECObjectsStatus RemoveProperty ( WStringCR  name)

Remove the named property.

Parameters
[in]nameThe name of the property to be removed
ECObjectsStatus SetDescription ( WStringCR  value)

Sets the description of this ECClass.

ECObjectsStatus SetDisplayLabel ( WStringCR  value)

Sets the display label of this ECClass.

ECObjectsStatus SetIsCustomAttributeClass ( WCharCP  isCustomAttribute)

Sets the bool value of whether this class can be used as a custom attribute.

Parameters
[in]isCustomAttributeString representation of true/false
Returns
Success if the string is parsed into a bool
ECObjectsStatus SetIsCustomAttributeClass ( bool  value)

Sets the bool value of whether this class can be used as a custom attribute.

ECObjectsStatus SetIsDomainClass ( WCharCP  isDomainClass)

Sets the bool value of whether this class can be used as a domain object.

Parameters
[in]isDomainClassString representation of true/false
Returns
Success if the string is parsed into a bool
ECObjectsStatus SetIsDomainClass ( bool  value)

Sets the bool value of whether this class can be used as a domain object.

ECObjectsStatus SetIsFinal ( WCharCP  isFinal)

Sets the bool value of whether this class is final and can't be subclassed.

Parameters
[in]isFinalString representation of true/false
Returns
Success if the string is parsed into a bool
ECObjectsStatus SetIsFinal ( bool  value)

Sets the bool value of whether this class is final and can't be subclassed.

ECObjectsStatus SetIsStruct ( WCharCP  isStruct)

Sets the bool value of whether this class can be used as a struct.

Parameters
[in]isStructString representation of true/false
Returns
Success if the string is parsed into a bool
ECObjectsStatus SetIsStruct ( bool  value)

Sets the bool value of whether this class can be used as a struct.


The documentation for this struct was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.