LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) { if( aComponent == NULL ) return NULL; // Conflict detection: See if already existing aliases exist, // and if yes, ask user for continue or abort // Special case: if the library is the library cache of the project, // old aliases are always removed to avoid conflict, // and user is not prompted ) if( Conflicts( aComponent ) && !IsCache() ) { wxFAIL_MSG( wxT( "Cannot add component <" ) + aComponent->GetName() + wxT( "> to library <" ) + GetName() + wxT( "> due to name conflict." ) ); return NULL; } LIB_COMPONENT* newCmp = new LIB_COMPONENT( *aComponent, this ); for( size_t i = 0; i < newCmp->m_aliases.size(); i++ ) { wxString aliasname = newCmp->m_aliases[i]->GetName(); LIB_ALIAS* alias = FindAlias( aliasname ); if( alias != NULL ) RemoveEntry( alias ); aliases[ aliasname ] = newCmp->m_aliases[i]; } isModified = true; return newCmp; }
void nsEudoraAddress::ProcessNote( const char *pLine, PRInt32 len, nsString& errors) { nsCString name; PRInt32 cnt = GetAliasName( pLine, len, name); pLine += cnt; len -= cnt; if (!cnt || !len) return; // Find the alias for this note and store the note data there! CAliasEntry *pEntry = nsnull; PRInt32 idx = FindAlias( name); if (idx == -1) return; pEntry = (CAliasEntry *) m_alias.ElementAt( idx); pEntry->m_notes.Append( pLine, len); pEntry->m_notes.Trim( kWhitespace); }
/*--------------------------------------------------------------------------*/ char *getlanguagealias(void) { return FindAlias(CURRENTLANGUAGESTRING); }