![]() |
AIAutoNameGenerator Struct ReferenceInformation about the kind of names allowed for a named entity (such as layers, swatches, and styles). More...
Detailed DescriptionInformation about the kind of names allowed for a named entity (such as layers, swatches, and styles). Used to generate a legal name, using The following pseudocode indicates how you can create your own AutoNameGenerator class by publicly inheriting AIAutoNameGenerator and following the implementation guidelines. class AutoNameGenerator : public AIAutoNameGenerator { public: // Constructor for a name generator. Its supplied with the pluginref in // case the name generator needs to look in the plugin's resources e.g for // the default name. The next new name index is supplied since the plugin // probably needs to store this in its globals so that it can be preserved // across unload and reload. AutoNameGenerator (SPPluginRef pluginref, int nextNameIndex) { // fill in fDefaultName GetDefaultName(pluginref); // initialize the base members // note kMaxCollectionStringLength accounts for null terminator and maximumLength does not maximumLength = kMaxCollectionStringLength-1; uniqueNames = true; baseName = fDefaultName; nextNewNameIndex = nextNameIndex; HasName = sHasName; } private: void GetDefaultName (SPPluginRef pluginref) { // Somehow initialize fDefaultName with the default name for the // collection. The pluginref is probably needed in order to look // up the name in the plugin resources. } AIErr hasName (const ai::UnicodeString &name, AIBoolean &hasit) { // Code to answer the question. When comparing 'name' against // names of objects in the collection it's important to use the // AIUserSuite::SameName() API. The name generation process does // not use a simple string comparison. } static AIAPI AIErr sHasName (AIAutoNameGenerator &self, const ai::UnicodeString &name, AIBoolean &hasit) { return static_cast<AutoNameGenerator&>(self).hasName(name, hasit); } ai::UnicodeString fDefaultName; }; Member Data DocumentationA base for generating names, a Unicode-encoded string.
A callback function to determine whether a given name is already in the set. Use
The maximum length for names in the collection, a number of Excludes the null terminator. The index to use for the next new name generated. Name generation functions automatically increment the index. True if names in the collection must be unique. The documentation for this struct was generated from the following file: |
||||||||||||||||||||||||||||||||||||||
|
![]() |
|