The in-memory representation of a schema as defined by ECSchemaXML. More...
#include <ECSchema.h>
Public Member Functions | |
SchemaKeyCR | GetSchemaKey () const |
Returns a SchemaKey fully describing this schema. More... | |
void | DebugDump () const |
Prints out detailed information about this ECSchema, and then calls Dump() on each ECClass. More... | |
ECSchemaId | GetId () const |
Return unique id (May return 0 until it has been explicitly set by ECDb or a similar system) More... | |
ECObjectsStatus | SetName (WStringCR value) |
Sets the name of this schema. More... | |
WStringCR | GetName () const |
Returns the name of this ECSchema. More... | |
ECObjectsStatus | SetNamespacePrefix (WStringCR value) |
Sets the namespace prefix for this ECSchema. More... | |
WStringCR | GetNamespacePrefix () const |
Gets the namespace prefix for this ECSchema. More... | |
ECObjectsStatus | SetDescription (WStringCR value) |
Sets the description for this ECSchema. More... | |
WStringCR | GetDescription () const |
Gets the description for this ECSchema. Returns the localized description if one exists. More... | |
WStringCR | GetInvariantDescription () const |
Gets the invariant description for this ECSchema. More... | |
ECObjectsStatus | SetDisplayLabel (WStringCR value) |
Sets the display label for this ECSchema. More... | |
WStringCR | GetDisplayLabel () const |
Gets the DisplayLabel for this ECSchema. More... | |
WStringCR | GetInvariantDisplayLabel () const |
Gets the invariant display label for this ECSchema. More... | |
ECObjectsStatus | SetVersionMajor (uint32_t value) |
Sets the major version of this schema. More... | |
uint32_t | GetVersionMajor () const |
Gets the major version of this schema. More... | |
ECObjectsStatus | SetVersionMinor (uint32_t value) |
Sets the minor version of this schema. More... | |
uint32_t | GetVersionMinor () const |
Gets the minor version of this schema. More... | |
ECClassContainerCR | GetClasses () const |
Returns an iterable container of ECClasses sorted by name. For unsorted called overload. More... | |
uint32_t | GetClassCount () const |
Gets the number of classes in the schema. More... | |
bool | GetIsDisplayLabelDefined () const |
Returns true if the display label has been set explicitly for this schema or not. More... | |
bool | IsStandardSchema () const |
Returns true if the schema is an ECStandard schema. More... | |
bool | IsSamePrimarySchema (ECSchemaR primarySchema) const |
Returns true if the passed in schema is the same base schema as the current schema. More... | |
bool | IsSupplementalSchema () const |
Indicates whether this schema is a supplemental schema or not. More... | |
bool | IsSupplemented () const |
Returns true if the schema is a supplemented schema. More... | |
SupplementalSchemaInfoPtr const | GetSupplementalInfo () const |
Gets the SupplementalSchemaInfo for this ECSchema. More... | |
bool | ShouldNotBeStored () const |
Returns true if and only if the full schema name (including version) represents a standard schema that should never be stored persistently in a repository (we expect it to be found elsewhere) More... | |
ECObjectsStatus | CreateClass (ECClassP &ecClass, WStringCR name) |
If the class name is valid, will create an ECClass object and add the new class to the schema. More... | |
ECObjectsStatus | CreateRelationshipClass (ECRelationshipClassP &relationshipClass, WStringCR name) |
If the class name is valid, will create an ECRelationshipClass object and add the new class to the schema. More... | |
ECSchemaCP | GetSchemaByNamespacePrefixP (WStringCR namespacePrefix) const |
Get a schema by namespace prefix within the context of this schema and its referenced schemas. More... | |
ECObjectsStatus | ResolveNamespacePrefix (ECSchemaCR schema, WStringR namespacePrefix) const |
Resolve a namespace prefix for the specified schema within the context of this schema and its references. More... | |
ECClassCP | GetClassCP (WCharCP name) const |
Get a class by name within the context of this schema. More... | |
ECClassP | GetClassP (WCharCP name) |
Get a class by name within the context of this schema. More... | |
ECSchemaReferenceListCR | GetReferencedSchemas () const |
Gets the other schemas that are used by classes within this schema. More... | |
ECObjectsStatus | AddReferencedSchema (ECSchemaR refSchema) |
Adds an ECSchema as a referenced schema in this schema. More... | |
ECObjectsStatus | AddReferencedSchema (ECSchemaR refSchema, WStringCR prefix) |
Adds an ECSchema as a referenced schema in this schema. More... | |
ECObjectsStatus | RemoveReferencedSchema (ECSchemaR refSchema) |
Removes an ECSchema from the list of referenced schemas. More... | |
SchemaWriteStatus | WriteToXmlString (WStringR ecSchemaXml) const |
Serializes an ECXML schema to a string. More... | |
SchemaWriteStatus | WriteToXmlString (Utf8StringR ecSchemaXml) const |
Serializes an ECXML schema to a string. More... | |
SchemaWriteStatus | WriteToXmlFile (WCharCP ecSchemaXmlFile, bool utf16=false) |
Serializes an ECXML schema to a file. More... | |
SchemaWriteStatus | WriteToXmlStream (IStreamP ecSchemaXmlStream, bool utf16=false) |
Writes an ECXML schema to an IStream. More... | |
WString | GetFullSchemaName () const |
Return full schema name in format GetName().MM.mm where Name is the schema name, MM is major version and mm is minor version. More... | |
ECObjectsStatus | CopyClass (ECClassP &targetClass, ECClassCR sourceClass) |
Given a source class, will copy that class into this schema if it does not already exist. More... | |
ECObjectsStatus | CopySchema (ECSchemaPtr &schemaOut) const |
Copies this schema. More... | |
IECCustomAttributeContainer & | GetCustomAttributeContainer () |
Get the IECCustomAttributeContainer holding this schema's custom attributes. More... | |
IECCustomAttributeContainer const & | GetCustomAttributeContainer () const |
Get the const IECCustomAttributeContainer holding this schema's custom attributes. More... | |
void | FindAllSchemasInGraph (bvector< ECN::ECSchemaCP > &allSchemas, bool includeRootSchema=true) const |
Find all ECSchemas in the schema graph, avoiding duplicates and any cycles. More... | |
void | FindAllSchemasInGraph (bvector< ECN::ECSchemaP > &allSchemas, bool includeRootSchema=true) |
Find all ECSchemas in the schema graph, avoiding duplicates and any cycles. More... | |
ECSchemaCP | FindSchema (SchemaKeyCR schema, SchemaMatchType matchType) const |
Returns this if the name matches, otherwise searches referenced ECSchemas for one whose name matches schemaName. More... | |
ECSchemaP | FindSchemaP (SchemaKeyCR schema, SchemaMatchType matchType) |
Returns this if the name matches, otherwise searches referenced ECSchemas for one whose name matches schemaName. More... | |
void | SetImmutable () |
Set the schema to be immutable. Immutable schema cannot be modified. More... | |
![]() | |
void * | operator new (size_t size) |
void | operator delete (void *rawMemory, size_t size) |
UInt32 | AddRef () const |
UInt32 | Release () const |
RefCounted () | |
RefCounted (RefCounted const &rhs) | |
RefCounted & | operator= (RefCounted const &rhs) |
UInt32 | GetRefCount () const |
Static Public Member Functions | |
static void | SetErrorHandling (bool showMessages, bool doAssert) |
Used for debugging purposes. More... | |
static bool | ShouldNotBeStored (SchemaKeyCR key) |
Returns true if and only if the full schema name (including version) represents a standard schema that should never be stored persistently in a repository (we expect it to be found elsewhere) More... | |
static uint32_t | ComputeSchemaXmlStringCheckSum (WCharCP str, size_t len) |
Given a str containing SchemaXml, will compute the CheckSum. More... | |
static ECObjectsStatus | CreateSchema (ECSchemaPtr &schemaOut, WStringCR schemaName, uint32_t versionMajor, uint32_t versionMinor) |
If the given schemaName is valid, this will create a new schema object. More... | |
static WString | FormatSchemaVersion (uint32_t &versionMajor, uint32_t &versionMinor) |
Generate a schema version string given the major and minor version values. More... | |
static ECObjectsStatus | ParseSchemaFullName (WString &schemaName, uint32_t &versionMajor, uint32_t &versionMinor, WCharCP fullName) |
Given a version string MM.NN, this will parse other major and minor versions. More... | |
static ECObjectsStatus | ParseSchemaFullName (WString &schemaName, uint32_t &versionMajor, uint32_t &versionMinor, WStringCR fullName) |
Given a version string MM.NN, this will parse other major and minor versions. More... | |
static ECObjectsStatus | ParseVersionString (uint32_t &versionMajor, uint32_t &versionMinor, WCharCP versionString) |
Given a version string MM.NN, this will parse other major and minor versions. More... | |
static bool | IsSchemaReferenced (ECSchemaCR thisSchema, ECSchemaCR potentiallyReferencedSchema) |
Given two schemas, will check to see if the second schema is referenced by the first schema. More... | |
static SchemaReadStatus | ReadFromXmlFile (ECSchemaPtr &schemaOut, WCharCP ecSchemaXmlFile, ECSchemaReadContextR schemaContext) |
Writes an ECSchema from an ECSchemaXML-formatted file. More... | |
static ECSchemaPtr | LocateSchema (SchemaKeyR schema, ECSchemaReadContextR schemaContext) |
Locate a schema using the provided schema locators and paths. More... | |
static SchemaReadStatus | ReadFromXmlString (ECSchemaPtr &schemaOut, Utf8CP ecSchemaXml, ECSchemaReadContextR schemaContext) |
Reads an ECSchema from a UTF-8 encoded ECSchemaXML-formatted string. More... | |
static SchemaReadStatus | ReadFromXmlString (ECSchemaPtr &schemaOut, WCharCP ecSchemaXml, ECSchemaReadContextR schemaContext) |
Reads an ECSchema from an ECSchemaXML-formatted string. More... | |
static SchemaReadStatus | ReadFromXmlString (ECSchemaPtr &schemaOut, WCharCP ecSchemaXml, ECSchemaCacheR schemaCache) |
Writes an ECSchema from an ECSchemaXML-formatted string. More... | |
static SchemaReadStatus | ReadFromXmlStream (ECSchemaPtr &schemaOut, IStreamP ecSchemaXmlStream, ECSchemaReadContextR schemaContext) |
Writes an ECSchema from an ECSchemaXML-formatted string in an IStream. More... | |
static bool | IsStandardSchema (WStringCR schemaName) |
Returns true if the schema is an ECStandard schema. More... | |
Additional Inherited Members | |
![]() | |
virtual | ~RefCounted () |
![]() | |
virtual | ~IRefCounted () |
void * | operator new (size_t size) |
void | operator delete (void *rawMemory, size_t size) |
The in-memory representation of a schema as defined by ECSchemaXML.
ECObjectsStatus AddReferencedSchema | ( | ECSchemaR | refSchema | ) |
ECObjectsStatus AddReferencedSchema | ( | ECSchemaR | refSchema, |
WStringCR | prefix | ||
) |
Adds an ECSchema as a referenced schema in this schema.
It is necessary to add any ECSchema as a referenced schema that will be used when adding a base class from a different schema, or custom attributes from a different schema.
[in] | refSchema | The schema to add as a referenced schema |
[in] | prefix | The prefix to use within the context of this schema for referencing the referenced schema |
Given a str containing SchemaXml, will compute the CheckSum.
ECObjectsStatus CopyClass | ( | ECClassP & | targetClass, |
ECClassCR | sourceClass | ||
) |
Given a source class, will copy that class into this schema if it does not already exist.
[out] | targetClass | If successful, will contain a new ECClass object that is a copy of the sourceClass |
[in] | sourceClass | The class to copy |
ECObjectsStatus CopySchema | ( | ECSchemaPtr & | schemaOut | ) | const |
Copies this schema.
[out] | schemaOut | If successful, will contain a copy of this schema |
ECObjectsStatus CreateClass | ( | ECClassP & | ecClass, |
WStringCR | name | ||
) |
If the class name is valid, will create an ECClass object and add the new class to the schema.
[out] | ecClass | If successful, will contain a new ECClass object |
[in] | name | Name of the class to create |
ECObjectsStatus CreateRelationshipClass | ( | ECRelationshipClassP & | relationshipClass, |
WStringCR | name | ||
) |
If the class name is valid, will create an ECRelationshipClass object and add the new class to the schema.
[out] | relationshipClass | If successful, will contain a new ECRelationshipClass object |
[in] | name | Name of the class to create |
|
static |
If the given schemaName is valid, this will create a new schema object.
[out] | schemaOut | if successful, will contain a new schema object |
[in] | schemaName | Name of the schema to be created. |
[in] | versionMajor | The major version number. |
[in] | versionMinor | The minor version number. |
void DebugDump | ( | ) | const |
void FindAllSchemasInGraph | ( | bvector< ECN::ECSchemaCP > & | allSchemas, |
bool | includeRootSchema = true |
||
) | const |
Find all ECSchemas in the schema graph, avoiding duplicates and any cycles.
[out] | allSchemas | Vector of schemas including rootSchema. |
[in] | includeRootSchema | If true then root schema is added to the vector of allSchemas. Defaults to true. |
void FindAllSchemasInGraph | ( | bvector< ECN::ECSchemaP > & | allSchemas, |
bool | includeRootSchema = true |
||
) |
Find all ECSchemas in the schema graph, avoiding duplicates and any cycles.
[out] | allSchemas | Vector of schemas including rootSchema. |
[in] | includeRootSchema | If true then root schema is added to the vector of allSchemas. Defaults to true. |
ECSchemaCP FindSchema | ( | SchemaKeyCR | schema, |
SchemaMatchType | matchType | ||
) | const |
Returns this if the name matches, otherwise searches referenced ECSchemas for one whose name matches schemaName.
ECSchemaP FindSchemaP | ( | SchemaKeyCR | schema, |
SchemaMatchType | matchType | ||
) |
Returns this if the name matches, otherwise searches referenced ECSchemas for one whose name matches schemaName.
Generate a schema version string given the major and minor version values.
[in] | versionMajor | The major version number |
[in] | versionMinor | The minor version number |
uint32_t GetClassCount | ( | ) | const |
Gets the number of classes in the schema.
ECClassCP GetClassCP | ( | WCharCP | name | ) | const |
Get a class by name within the context of this schema.
[in] | name | The name of the class to lookup. This must be an unqualified (short) class name. |
ECClassContainerCR GetClasses | ( | ) | const |
Returns an iterable container of ECClasses sorted by name. For unsorted called overload.
ECClassP GetClassP | ( | WCharCP | name | ) |
Get a class by name within the context of this schema.
[in] | name | The name of the class to lookup. This must be an unqualified (short) class name. |
IECCustomAttributeContainer& GetCustomAttributeContainer | ( | ) |
Get the IECCustomAttributeContainer holding this schema's custom attributes.
IECCustomAttributeContainer const& GetCustomAttributeContainer | ( | ) | const |
Get the const IECCustomAttributeContainer holding this schema's custom attributes.
WStringCR GetDescription | ( | ) | const |
Gets the description for this ECSchema. Returns the localized description if one exists.
WStringCR GetDisplayLabel | ( | ) | const |
WString GetFullSchemaName | ( | ) | const |
Return full schema name in format GetName().MM.mm where Name is the schema name, MM is major version and mm is minor version.
ECSchemaId GetId | ( | ) | const |
Return unique id (May return 0 until it has been explicitly set by ECDb or a similar system)
bool GetIsDisplayLabelDefined | ( | ) | const |
Returns true if the display label has been set explicitly for this schema or not.
ECSchemaReferenceListCR GetReferencedSchemas | ( | ) | const |
Gets the other schemas that are used by classes within this schema.
Referenced schemas are the schemas that contain definitions of base classes, embedded structures, and custom attributes of classes within this schema.
ECSchemaCP GetSchemaByNamespacePrefixP | ( | WStringCR | namespacePrefix | ) | const |
Get a schema by namespace prefix within the context of this schema and its referenced schemas.
[in] | namespacePrefix | The prefix of the schema to lookup in the context of this schema and it's references. Passing an empty namespacePrefix will return a pointer to the current schema. |
SchemaKeyCR GetSchemaKey | ( | ) | const |
Returns a SchemaKey fully describing this schema.
SupplementalSchemaInfoPtr const GetSupplementalInfo | ( | ) | const |
Gets the SupplementalSchemaInfo for this ECSchema.
uint32_t GetVersionMajor | ( | ) | const |
Gets the major version of this schema.
uint32_t GetVersionMinor | ( | ) | const |
Gets the minor version of this schema.
bool IsSamePrimarySchema | ( | ECSchemaR | primarySchema | ) | const |
Returns true if the passed in schema is the same base schema as the current schema.
|
static |
Given two schemas, will check to see if the second schema is referenced by the first schema.
[in] | thisSchema | The base schema to check the references of |
[in] | potentiallyReferencedSchema | The schema to search for |
bool IsStandardSchema | ( | ) | const |
Returns true if the schema is an ECStandard schema.
|
static |
Returns true if the schema is an ECStandard schema.
[in] | schemaName | Name of the schema to test. This is just the schema name, no version info |
bool IsSupplementalSchema | ( | ) | const |
Indicates whether this schema is a supplemental schema or not.
bool IsSupplemented | ( | ) | const |
Returns true if the schema is a supplemented schema.
|
static |
Locate a schema using the provided schema locators and paths.
If not found in those by either of those parameters standard schema pathes relative to the executing dll will be searched.
[in] | schema | Key describing the schema to be located |
[in] | schemaContext | Required to create schemas |
|
static |
Given a version string MM.NN, this will parse other major and minor versions.
[out] | schemaName | The schema name without version number qualifiers |
[out] | versionMajor | The major version number |
[out] | versionMinor | The minor version number |
[in] | fullName | A string containing the schema name and major and minor versions (GetName().MM.NN) |
|
static |
Given a version string MM.NN, this will parse other major and minor versions.
[out] | schemaName | The schema name without version number qualifiers |
[out] | versionMajor | The major version number |
[out] | versionMinor | The minor version number |
[in] | fullName | A string containing the schema name and major and minor versions (GetName().MM.NN) |
|
static |
Given a version string MM.NN, this will parse other major and minor versions.
[out] | versionMajor | The major version number |
[out] | versionMinor | The minor version number |
[in] | versionString | A string containing the major and minor versions (MM.NN) |
|
static |
Writes an ECSchema from an ECSchemaXML-formatted file.
[out] | schemaOut | The read schema |
[in] | ecSchemaXmlFile | The absolute path of the file to write. |
[in] | schemaContext | Required to create schemas |
|
static |
Writes an ECSchema from an ECSchemaXML-formatted string in an IStream.
[out] | schemaOut | The read schema |
[in] | ecSchemaXmlStream | The IStream containing ECSchemaXML to write |
[in] | schemaContext | Required to create schemas |
|
static |
Reads an ECSchema from a UTF-8 encoded ECSchemaXML-formatted string.
[out] | schemaOut | The read schema |
[in] | ecSchemaXml | The UTF-8 encoded string containing ECSchemaXML to write |
[in] | schemaContext | Required to create schemas |
|
static |
Reads an ECSchema from an ECSchemaXML-formatted string.
[out] | schemaOut | The read schema |
[in] | ecSchemaXml | The string containing ECSchemaXML to write |
[in] | schemaContext | Required to create schemas |
|
static |
Writes an ECSchema from an ECSchemaXML-formatted string.
[out] | schemaOut | The read schema |
[in] | ecSchemaXml | The string containing ECSchemaXML to write |
[in] | schemaCache | Will own the read ECSchema and referenced ECSchemas. |
ECObjectsStatus RemoveReferencedSchema | ( | ECSchemaR | refSchema | ) |
Removes an ECSchema from the list of referenced schemas.
[in] | refSchema | The schema that should be removed from the list of referenced schemas |
ECObjectsStatus ResolveNamespacePrefix | ( | ECSchemaCR | schema, |
WStringR | namespacePrefix | ||
) | const |
Resolve a namespace prefix for the specified schema within the context of this schema and its references.
[in] | schema | The schema to lookup a namespace prefix in the context of this schema and its references. |
[out] | namespacePrefix | The namespace prefix if schema is a referenced schema; empty string if the sechema is the current schema; |
|
static |
Used for debugging purposes.
[in] | showMessages | Controls whether messages are displayed during BeXml operations. Defaults to true. |
[in] | doAssert | Controls whether asserts should be tested or not. Defaults to true. |
void SetImmutable | ( | ) |
Set the schema to be immutable. Immutable schema cannot be modified.
ECObjectsStatus SetName | ( | WStringCR | value | ) |
Sets the name of this schema.
[in] | value | The name of the ECSchema |
ECObjectsStatus SetVersionMajor | ( | uint32_t | value | ) |
Sets the major version of this schema.
ECObjectsStatus SetVersionMinor | ( | uint32_t | value | ) |
Sets the minor version of this schema.
bool ShouldNotBeStored | ( | ) | const |
Returns true if and only if the full schema name (including version) represents a standard schema that should never be stored persistently in a repository (we expect it to be found elsewhere)
|
static |
Returns true if and only if the full schema name (including version) represents a standard schema that should never be stored persistently in a repository (we expect it to be found elsewhere)
[in] | key | SchemaKey to test |
SchemaWriteStatus WriteToXmlFile | ( | WCharCP | ecSchemaXmlFile, |
bool | utf16 = false |
||
) |
Serializes an ECXML schema to a file.
[in] | ecSchemaXmlFile | The absolute path of the file to serialize the schema to |
[in] | utf16 | 'false' (the default) to use utf-8 encoding |
SchemaWriteStatus WriteToXmlStream | ( | IStreamP | ecSchemaXmlStream, |
bool | utf16 = false |
||
) |
Writes an ECXML schema to an IStream.
[in] | ecSchemaXmlStream | The IStream to write the serialized XML to |
[in] | utf16 | 'false' (the default) to use utf-8 encoding |
SchemaWriteStatus WriteToXmlString | ( | WStringR | ecSchemaXml | ) | const |
Serializes an ECXML schema to a string.
[out] | ecSchemaXml | The string containing the Xml of the serialized schema |
SchemaWriteStatus WriteToXmlString | ( | Utf8StringR | ecSchemaXml | ) | const |
Serializes an ECXML schema to a string.
[out] | ecSchemaXml | The string containing the Xml of the serialized schema |