libs-gdl2/EOModeler/EOModelExtensions.m

357 lines
7.9 KiB
Mathematica
Raw Normal View History

/*
EOModelExtensions.m
Copyright (C) 2001,2002,2003,2004,2005 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@gmail.com>
Date: January 2001
This file is part of the GNUstep Database Library.
This library is free software; you can redistribute it and/or
* GNUmakefile: Compile EOInterface, EOModeler, DBModeler, GDL2Palette if gui is installed. * EOModeler/EOModelExtensions.h: Update copyright header. * EOModeler/EOModelExtensions.m: Ditto. * EOModeler/GNUmakefile: Make EOModeler a native-library, add new files. * EOModeler/Makefile.preamble: Change link flag to use FND_LIBS. * EOModeler/EODefines.h: New file, initial implementation. * EOModeler/EOMInspector.h/m: Ditto. * EOModeler/EOMInspectorController.h/m: Ditto. * EOModeler/EOModelerApp.h/m: Ditto. * EOModeler/EOModelerDocument.h/m: Ditto. * EOModeler/EOModelerEditor.h/m: Ditto. * DBModeler: New directory. * DBModeler/COPYING: New file... * DBModeler/AdaptorsPanel.h/m: New files. * DBModeler/DefaultColumnProvider.h/m: Ditto. * DBModeler/EOAdditions.h/m: Ditto. * DBModeler/KVDataSource.h/m: Ditto. * DBModeler/MainModelEdtior.h/m: Ditto. * DBModeler/Modeler.m: Ditto. * DBModeler/ModelerAttributeEditor.h/m: Ditto. * DBModeler/ModelerTableEmbedibleEditor.h/m: Ditto. * DBModeler/main.m: Ditto. * DBModeler/GNUmakefile: Ditto. * DBModeler/Resources: New directory. * DBModeler/Resources/ModelDrag.tiff: New file. * DBModeler/Resources/ClassProperty_On.tiff: Ditto. * DBModeler/Resources/Key_On.tiff: Ditto. * DBModeler/Inspectors: New directory. * DBModeler/Inspectors/RelationshipInspector.h/m: New files. * DBModeler/Inspectors/AttributeInspector.h/m: Ditto. * DBModeler/Inspectors/RelationshipInspector.gorm: New gorm directory. * DBModeler/Inspectors/AttributeInspector.gorm: Ditto. * GDL2Palette: New directory. * GDL2Palette/GNUmakefile: New file. * GDL2Palette/ConnectionInspector.h/m: Ditto. * GDL2Palette/Foundation+Categories.h/m: Ditto. * GDL2Palette/IB+Categories.m: Ditto. * GDL2Palette/Palette.h/m: Ditto. * GDL2Palette/ResourceManager.h/m: Ditto. * GDL2Palette/GDL2ConnectionInspector.gorm: Ditto. * GDL2Palette/GDL2Palette.tiff: Ditto * GDL2Palette/palette.table git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21223 72102866-910b-0410-8b05-ffd578937521
2005-05-13 00:00:56 +00:00
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNUmakefile: Compile EOInterface, EOModeler, DBModeler, GDL2Palette if gui is installed. * EOModeler/EOModelExtensions.h: Update copyright header. * EOModeler/EOModelExtensions.m: Ditto. * EOModeler/GNUmakefile: Make EOModeler a native-library, add new files. * EOModeler/Makefile.preamble: Change link flag to use FND_LIBS. * EOModeler/EODefines.h: New file, initial implementation. * EOModeler/EOMInspector.h/m: Ditto. * EOModeler/EOMInspectorController.h/m: Ditto. * EOModeler/EOModelerApp.h/m: Ditto. * EOModeler/EOModelerDocument.h/m: Ditto. * EOModeler/EOModelerEditor.h/m: Ditto. * DBModeler: New directory. * DBModeler/COPYING: New file... * DBModeler/AdaptorsPanel.h/m: New files. * DBModeler/DefaultColumnProvider.h/m: Ditto. * DBModeler/EOAdditions.h/m: Ditto. * DBModeler/KVDataSource.h/m: Ditto. * DBModeler/MainModelEdtior.h/m: Ditto. * DBModeler/Modeler.m: Ditto. * DBModeler/ModelerAttributeEditor.h/m: Ditto. * DBModeler/ModelerTableEmbedibleEditor.h/m: Ditto. * DBModeler/main.m: Ditto. * DBModeler/GNUmakefile: Ditto. * DBModeler/Resources: New directory. * DBModeler/Resources/ModelDrag.tiff: New file. * DBModeler/Resources/ClassProperty_On.tiff: Ditto. * DBModeler/Resources/Key_On.tiff: Ditto. * DBModeler/Inspectors: New directory. * DBModeler/Inspectors/RelationshipInspector.h/m: New files. * DBModeler/Inspectors/AttributeInspector.h/m: Ditto. * DBModeler/Inspectors/RelationshipInspector.gorm: New gorm directory. * DBModeler/Inspectors/AttributeInspector.gorm: Ditto. * GDL2Palette: New directory. * GDL2Palette/GNUmakefile: New file. * GDL2Palette/ConnectionInspector.h/m: Ditto. * GDL2Palette/Foundation+Categories.h/m: Ditto. * GDL2Palette/IB+Categories.m: Ditto. * GDL2Palette/Palette.h/m: Ditto. * GDL2Palette/ResourceManager.h/m: Ditto. * GDL2Palette/GDL2ConnectionInspector.gorm: Ditto. * GDL2Palette/GDL2Palette.tiff: Ditto * GDL2Palette/palette.table git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21223 72102866-910b-0410-8b05-ffd578937521
2005-05-13 00:00:56 +00:00
Lesser General Public License for more details.
* GNUmakefile: Compile EOInterface, EOModeler, DBModeler, GDL2Palette if gui is installed. * EOModeler/EOModelExtensions.h: Update copyright header. * EOModeler/EOModelExtensions.m: Ditto. * EOModeler/GNUmakefile: Make EOModeler a native-library, add new files. * EOModeler/Makefile.preamble: Change link flag to use FND_LIBS. * EOModeler/EODefines.h: New file, initial implementation. * EOModeler/EOMInspector.h/m: Ditto. * EOModeler/EOMInspectorController.h/m: Ditto. * EOModeler/EOModelerApp.h/m: Ditto. * EOModeler/EOModelerDocument.h/m: Ditto. * EOModeler/EOModelerEditor.h/m: Ditto. * DBModeler: New directory. * DBModeler/COPYING: New file... * DBModeler/AdaptorsPanel.h/m: New files. * DBModeler/DefaultColumnProvider.h/m: Ditto. * DBModeler/EOAdditions.h/m: Ditto. * DBModeler/KVDataSource.h/m: Ditto. * DBModeler/MainModelEdtior.h/m: Ditto. * DBModeler/Modeler.m: Ditto. * DBModeler/ModelerAttributeEditor.h/m: Ditto. * DBModeler/ModelerTableEmbedibleEditor.h/m: Ditto. * DBModeler/main.m: Ditto. * DBModeler/GNUmakefile: Ditto. * DBModeler/Resources: New directory. * DBModeler/Resources/ModelDrag.tiff: New file. * DBModeler/Resources/ClassProperty_On.tiff: Ditto. * DBModeler/Resources/Key_On.tiff: Ditto. * DBModeler/Inspectors: New directory. * DBModeler/Inspectors/RelationshipInspector.h/m: New files. * DBModeler/Inspectors/AttributeInspector.h/m: Ditto. * DBModeler/Inspectors/RelationshipInspector.gorm: New gorm directory. * DBModeler/Inspectors/AttributeInspector.gorm: Ditto. * GDL2Palette: New directory. * GDL2Palette/GNUmakefile: New file. * GDL2Palette/ConnectionInspector.h/m: Ditto. * GDL2Palette/Foundation+Categories.h/m: Ditto. * GDL2Palette/IB+Categories.m: Ditto. * GDL2Palette/Palette.h/m: Ditto. * GDL2Palette/ResourceManager.h/m: Ditto. * GDL2Palette/GDL2ConnectionInspector.gorm: Ditto. * GDL2Palette/GDL2Palette.tiff: Ditto * GDL2Palette/palette.table git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21223 72102866-910b-0410-8b05-ffd578937521
2005-05-13 00:00:56 +00:00
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
2003-03-30 David Ayers <d.ayers@inode.at> * *.h/m, *.h/m): Used #include instead of depricated #import. Avoid including entire library headers. Use export macro where applicable. * EOControl/GNUmakefile: Removed EOKeyValueCodingBase.m/h and EOUndoMananger.h. Added EOArrayDataSource.m/h, EODefines.h and EODepricated.h. * EOControl/EODefines.h: Updated for GDL2 & gnustep-make. * EOControl/EODebug.h: Updated. * EOControl/EODepricated.h: Updated for current state of GDL2. ([NSObject +flushClassKeyBindings]): Added declaration. ([EOClassDescription +setDelegate:]): Added declaration. ([EOClassDescription +delegate]): Added declaration. (EOUndoManager): Moved declaration of interface here. * EOControl/EOKeyValueCoding.m ([EOClassDescription +flushClassKeyBindings]): Added empty implementation. ([NSObject takeStoredValuesFromDictionary:]): Cache EONull instance and use it instead of isKindOfClass:. * EOControl/EOEditingContext.m ([EOEditingContext +initialize]): Tidied. ([EOEditingContest -deleteObject]): Use NSUndoManager instead of EOUndoManager. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Added minor optimization tweak. * EOControl/EOClassDescription.m: Removed inactive commented code. Added private declerations of EOAccess methods to avoid compiler warnings. ([EOClassDescription +initialize]): Tidied. ([EOClassDescription -classDescriptionForClass:]): Use GSObjCName() instead of objc runtime routines. * EOControl/EOFault.m: Exchanged direct usages of ObjC runtime routines with NS/GSObjCRuntime abstraction API. ([EOFault +superclass]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -respondsToSelector:]): Ditto. ([EOFault +initialize]): Cache static class variable. ([EOFault +isKindOfClass]): Use static class variable. ([EOFault +handlerForFault:]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -dealloc]): Ditto. * EOControl/EOGenericRecord.m: ([EOGenericRecord +initialize]): Tidied. * EOControl/EOKeyComparisonQualifier.m: Tidied documentation. * EOControl/EOKeyValueQualifier.m: Ditto. * EOControl/EONSAddOns.h/m: Added declarations to surpress compiler warnings. ([NSObject -eoCompareOnName:]): Adjusted casts to surpress compiler warnings. (GSUseStrictWO451Compatibility): Added function. (GDL2GlobalLock, GDL2GlobalRecursive): Ditto. * EOControl/EONull: Remove implementations for foundation libraries without key value coding and fully rely on NSNull. Added assertions in all intance methods as instances should never be created. ([EONull +allocWithZone:]) Corrected method name so it will actually be used. * EOControl/EOSortOrdering.m ([NSArray sortedArrayUsingKeyOrderArray:]): Tidied. ([NSMutableArray sortUsingKeyOrderArray:]): Ditto. ([EONull compareAscending:]): Sync with referencs implementation. ([EONull compareDescending:]): Ditto. ([EONull compareCaseInsensitiveAscending:]): Ditto. ([EONull compareCaseInsensitiveDescending:]): Ditto. * EOAccess/EOAdaptor.h: Added comment about API compatibility. * EOAccess/EOAdaptor.m ([EOAdaptor -contexts]): Return array of adaptor contexts rather tham GC-wrapper objects containing adaptor contexts. ([EOAdaptor -databaseEncoding]): Use GSEncodingName() instead of GetEncodingName(). * EOAccess/EODatabaseContext.m ([EODatabaseContext -_turnFault:gid:editingContext:isComplete:]): Use GSObjCClass() instead of trying to access isa by dereferencing from id with incorrect member. * EOAccess/EOModel.m ([EOModel -entityNames]): Sort returned array to insure comparable output. * EOAccess/EOSQLExpression.m ([EOSQLExpression sqlStringForArrayOfQualifiers:operation:]): Added cast to surpress compiler warning. * EOAccess/EOUtilities.m ([EOObjectStoreCoordinator setModelGroup:]): Ditto. * EOAccess/EORelationship.h ([EORelationship -docComment]): Added declaration. * EOAccess/GNUmakefile: Added EODefines.h and EODepricated.h. * Tools/*.m: Use RCS_ID macro. * Tools/EOAttribute+GSDoc.h: ([EOAttribute gsdocContentWithTagName:idPtr:]): Corrected Typo. * Tools/EOModel+GSDoc.h/m: ([EOModel gsdocContentSplittedByEntities:idPtr:]): Ditto. * Tools/EORelationship+GSDoc.m: ([EORelationship gsdocContentWithTagName:idPtr:]): Change variable type to supress compiler warnings. * Tools/eoutil.m (dump): Initialize variables to supress compiler warnings. * Tools/gsdoc-model.m: Include GSCategories.h to supress compiler warnings. (main): Added cast to supress compiler warning. Fixed typo in method invocation. 2003-03-25 Stephane Corthesy <stephane@sente.ch> * EOControl/EODefines.h: Added new file for export/win32 support. * EOControl/EODepricated.h: Added new file for depricated features. * EOControl/EOControl.h: Added EOArrayDataSource.h and EODefines.h. * EOControl/EOArrayDataSource.h/m: Added new files. Some methods (<NSCoding> and qualifier bindings) are empty stubs. * EOControl/EODebug.h: Use export macro instead of explicit extern for function and symbol declarations. * EOControl/EOGlobalID.h: Ditto. * EOControl/EONull.h: Ditto. * EOControl/EOObjectStore.h: Ditto. * EOControl/EOOrQualifier.m: Replaced autorelease by AUTORELEASE and fixed typo. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Implemented. * EOControl/EONSAddOns.m: Use volatile in some exception handlers (man longjmp for more info). * EOControl/EOSortOrdering.h/m ([EOSortOrdering -copyWithZone:]): Implemented <NSCopying>. ([EOSortOrdering -encodeWithKeyValueArchiver:]): Implemented. * EOAccess/EODefines.h: Added new file for export/win32 support. * EOAccess/EODepricated.h: Added new file for depricated features. * EOAccess/EOAccess.h: Added EODefines.h. * EOAccess/EOSQLExpression.h/m: Fixed typo for EOPrimaryKeyConstraintKey. * EOAccess/EOExpressionArray.h/m: Use volatile for variables usein in exception handlers. (man longjmp for more info) * EOAccess/EODatabase.h: Use export macro instead of explicit extern for function and symbol declarations. * EOAccess/EOEntity.h: Ditto. * EOAccess/EOModel.h: Ditto. * EOAccess/EOSchemaGeneration.h: Ditto. * EOAccess/EOSQLExpression.h: Ditto. * EOAccess/EOUtilities.h: Ditto. * Tools/eoutil.m (dump): Implemented use of -postinstall option. Corrected bug when getting adaptor's expression class. Renamed symbol EOPrimaryKeyContraintsKey into EOPrimaryKeyConstraintsKey. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@16298 72102866-910b-0410-8b05-ffd578937521
2003-03-31 00:24:15 +00:00
#include "config.h"
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
* EOAccess/EOAdaptor.m: Include GNUstep-specific headers for non-GNUstep systems. * EOAccess/EOAdaptorChannel.m: Ditto. * EOAccess/EOAdaptorContext.m: Ditto. * EOAccess/EOAttribute.m: Ditto. * EOAccess/EODatabaseChannel.m: Ditto. * EOAccess/EODatabaseDataSource.m: Ditto. * EOAccess/EOEntity.m: Ditto. * EOAccess/EOModel.m: Ditto. * EOAccess/EOModelGroup.m: Ditto. * EOAccess/EORelationship.m: Ditto. * EOAccess/EOSQLQualifier.m: Ditto. * EOAccess/EOUtilities.m: Ditto. * EOControl/EOAndQualifier.m: Ditto. * EOControl/EOClassDescription.m: Ditto. * EOControl/EODataSource.m: Ditto. * EOControl/EOEditingContext.m: Ditto. * EOControl/EOFault.m: Ditto. * EOControl/EOFaultHandler.m: Ditto. * EOControl/EOFetchSpecification.m: Ditto. * EOControl/EOKeyValueArchiver.m: Ditto. * EOControl/EOKeyValueQualifier.m: Ditto. * EOControl/EOMutableKnownKeyDictionary.m: Ditto. * EOControl/EONSAddOns.m: Ditto. * EOControl/EOObjectStore.m: Ditto. * EOControl/EOObjectStoreCoordinator.m: Ditto. * EOControl/EOObserver.m: Ditto. * EOControl/EOOrQualifier.m: Ditto. * EOControl/EOQualifier.m: Ditto. * EOControl/EOUndoManager.m: Ditto. * EOModeler/EOModelExtensions.m: Ditto. * EOAccess/EOModel.h/m (+/-[EOModel version]) Remove. ([EOModel init]): Handle version internally. ([EOModel encodeTableOfContentsIntoPropertyList:]): Ditto. ([EOModel encodeIntoPropertyList:]): Ditto. * EOAccess/EODatabaseContext.m ([EODatabaseContext dealloc]): Use NSCountHashTable instead of NSCountMapTable on hash table. * EOAccess/EOAttribute.m ([EOAttribute newValueForBytes:length:]): Added casts to avoid warnings. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@18500 72102866-910b-0410-8b05-ffd578937521
2004-01-29 13:23:22 +00:00
#include <GNUstepBase/GSCategories.h>
#endif
#ifdef NeXT_Foundation_LIBRARY
#include <Foundation/Foundation.h>
#else
* EOModeler/EOMInspectorController.m (-init): Don't release the window on close. (_selectionChanged:): Fix view swapping. Set view as needing display. * EOModeler/EOModelExtensions.m: (+mutableAttributedStringWithBoldSubstitutionsWithFormat:): Implement. * EOModeler/EOModelerApp.h: Add -removeDocument:, -documentAtPath:, and -loadDocumentAtPath: methods. * EOModeler/EOModelerApp.m (-init:): Add parentheses around assignment. (-allPasteboardTypes): Initial implementation. (-removeDocument:): If removing the active document, set the active document to nil. (-documentWithPath:): Change array iterators to unsigned. (-registerColumNames:forClass:provider:): Ditto. (-modelContainingFetchSpecification:): Temporarily return nil. (-nameForFetchSpecification:): Ditto. * EOModeler/EOModelerDocument.h: Declare consistency check notification constants. Add -adaptor, -appendConsistencyCheckErrorText:, -appendConsistencyCheckSuccessText:, -addEntity:, -addRelationship, -addAttribute and -delete. * EOModeler/EOModelerDocument.m: Add consistency check notification constants. Add private category interface. (-firstSelectionOfClass:): Change array iterators to unsigned. Remove debugging logs. (-validateMenuItem:): Initial implementation. (-initWithModel:): Add parentheses around assignment. Add the model to the default model group. (-dealloc, -delete:): Initial implementation. (-isDirty, -prepareToSave,-checkCloseDocument): Return no temporarily until implemented. (-saveToPath:): Break long messages into separate lines. (-addDefaultEditor:, -addEntity:, -addAttribute:): Ditto. (-addRelationship:, ): (-activate): Remove commented out code. (-closeEditor:, -checkCloseEditor:): Add comments. (-canFlattenSelectedAttribute): Add temporary return value. (-windowWillClose:): Remove self from the open documents. (-checkConsistency:): Implement. (-appendConsistencyCheckErrorText:): Ditto. (-appendConsistencyCheckSuccessText:): Ditto. * EOModeler/EOModelerEditor.m (-initWithDocument:): Add parentheses around assignment. Don't retain our document. (-selectionPath:, -viewedObjectPath): Return nil. (-[EOModelerCompoundEditor dealloc]): Implement. (-[EOModelerCompoundEditor initWithParentObject:): Add parentheses around assignment. (-[EOModelerEmbedibleEditor pathViewPreferenceHint:): Return nil. * EOModeler/GNUmakefile: Remove extra whitespace. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21440 72102866-910b-0410-8b05-ffd578937521
2005-07-09 17:44:40 +00:00
#include <Foundation/NSDictionary.h>
#include <Foundation/NSEnumerator.h>
* EOModeler/EOMInspectorController.m (-init): Don't release the window on close. (_selectionChanged:): Fix view swapping. Set view as needing display. * EOModeler/EOModelExtensions.m: (+mutableAttributedStringWithBoldSubstitutionsWithFormat:): Implement. * EOModeler/EOModelerApp.h: Add -removeDocument:, -documentAtPath:, and -loadDocumentAtPath: methods. * EOModeler/EOModelerApp.m (-init:): Add parentheses around assignment. (-allPasteboardTypes): Initial implementation. (-removeDocument:): If removing the active document, set the active document to nil. (-documentWithPath:): Change array iterators to unsigned. (-registerColumNames:forClass:provider:): Ditto. (-modelContainingFetchSpecification:): Temporarily return nil. (-nameForFetchSpecification:): Ditto. * EOModeler/EOModelerDocument.h: Declare consistency check notification constants. Add -adaptor, -appendConsistencyCheckErrorText:, -appendConsistencyCheckSuccessText:, -addEntity:, -addRelationship, -addAttribute and -delete. * EOModeler/EOModelerDocument.m: Add consistency check notification constants. Add private category interface. (-firstSelectionOfClass:): Change array iterators to unsigned. Remove debugging logs. (-validateMenuItem:): Initial implementation. (-initWithModel:): Add parentheses around assignment. Add the model to the default model group. (-dealloc, -delete:): Initial implementation. (-isDirty, -prepareToSave,-checkCloseDocument): Return no temporarily until implemented. (-saveToPath:): Break long messages into separate lines. (-addDefaultEditor:, -addEntity:, -addAttribute:): Ditto. (-addRelationship:, ): (-activate): Remove commented out code. (-closeEditor:, -checkCloseEditor:): Add comments. (-canFlattenSelectedAttribute): Add temporary return value. (-windowWillClose:): Remove self from the open documents. (-checkConsistency:): Implement. (-appendConsistencyCheckErrorText:): Ditto. (-appendConsistencyCheckSuccessText:): Ditto. * EOModeler/EOModelerEditor.m (-initWithDocument:): Add parentheses around assignment. Don't retain our document. (-selectionPath:, -viewedObjectPath): Return nil. (-[EOModelerCompoundEditor dealloc]): Implement. (-[EOModelerCompoundEditor initWithParentObject:): Add parentheses around assignment. (-[EOModelerEmbedibleEditor pathViewPreferenceHint:): Return nil. * EOModeler/GNUmakefile: Remove extra whitespace. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21440 72102866-910b-0410-8b05-ffd578937521
2005-07-09 17:44:40 +00:00
#include <Foundation/NSScanner.h>
#include <Foundation/NSString.h>
#endif
#ifdef NeXT_GUI_LIBRARY
#include <AppKit/AppKit.h>
#else
#include <AppKit/NSFont.h>
#include <AppKit/NSAttributedString.h>
#endif
#include <EOControl/EODebug.h>
#include "EOModeler/EOModelExtensions.h"
@implementation EOEntity (EOModelExtensions)
- (NSArray *)classAttributes
{
NSEnumerator *enumerator = [[self attributes] objectEnumerator];
EOAttribute *attr;
NSMutableArray *array;
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
array = [NSMutableArray arrayWithCapacity:10];
while((attr = [enumerator nextObject]))
{
[array addObject:attr];
}
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
return array;
}
- (NSArray *)classScalarAttributes
{
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
EOAttribute *attr;
NSMutableArray *array;
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
array = [NSMutableArray arrayWithCapacity:10];
while((attr = [enumerator nextObject]))
{
if([attr isKindOfClass: [EOAttribute class]] && [attr isScalar] == YES)
[array addObject:attr];
}
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
return array;
}
- (NSArray *)classNonScalarAttributes
{
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
EOAttribute *attr;
NSMutableArray *array;
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
array = [NSMutableArray arrayWithCapacity:10];
while((attr = [enumerator nextObject]))
{
if([attr isKindOfClass: [EOAttribute class]] && [attr isScalar] == NO)
[array addObject:attr];
}
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
return array;
}
- (NSArray *)classToManyRelationships
{
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
EORelationship *relationship;
NSMutableArray *array;
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
array = [NSMutableArray arrayWithCapacity:10];
while((relationship = [enumerator nextObject]))
{
if([relationship isKindOfClass: [EORelationship class]]
&& [relationship isToMany] == YES)
[array addObject:relationship];
}
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
return array;
}
- (NSArray *)classToOneRelationships
{
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
EORelationship *relationship;
NSMutableArray *array;
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
array = [NSMutableArray arrayWithCapacity:10];
while((relationship = [enumerator nextObject]))
{
if([relationship isKindOfClass: [EORelationship class]]
&& [relationship isToMany] == NO)
[array addObject:relationship];
}
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
return array;
}
- (NSArray *)referencedClasses
{
NSEnumerator *enumerator = [[self relationships] objectEnumerator];
EORelationship *relationship;
NSMutableArray *array;
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
array = [NSMutableArray arrayWithCapacity:10];
while((relationship = [enumerator nextObject]))
{
[array addObject:[[relationship destinationEntity] className]];
}
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
return array;
}
- (NSString *)referenceClassName
{
if([[self className] isEqual:@"EOGenericRecord"])
return @"id";
return [NSString stringWithFormat:@"%@ *", [self className]];
}
- (NSString *)referenceJavaClassName
{
if([[self className] isEqual:@"EOGenericRecord"])
return @"CustomObject";
return [self className];
}
- (NSString *)parentClassName
{
if([self parentEntity])
return [[self parentEntity] className];
return @"NSObject";
}
- (NSString *)javaParentClassName
{
if([self parentEntity])
return [[self parentEntity] className];
return @"EOCustomObject";
}
- (NSArray *)arrayWithParentClassNameIfNeeded
{
NSMutableArray *array;
array = [NSMutableArray arrayWithCapacity:1];
if([self parentEntity])
[array addObject:[[self parentEntity] className]];
return array;
}
- (NSString *)classNameWithoutPackage
{
return [self className];
}
- (NSArray *)classPackage
{
return [NSArray array];
}
@end
@implementation EOAttribute (EOModelExtensions)
- (BOOL)isScalar
{
return NO;
}
- (NSString *)cScalarTypeString
{
NSString * vType = [self valueType];
unichar myChar;
if ([vType length] < 1) {
return nil;
}
myChar = [vType characterAtIndex:0];
switch (myChar) {
case 'c': return @"char";
break;
case 'C': return @"unsigned char";
break;
case 's': return @"short";
break;
case 'S': return @"unsigned short";
break;
case 'i': return @"int";
break;
case 'I': return @"unsigned int";
break;
case 'l': return @"long";
break;
case 'L': return @"unsigned long";
break;
case 'u': return @"long long";
break;
case 'U': return @"unsigned long long";
break;
case 'f': return @"float";
break;
case 'd': return @"double";
break;
default:
break;
}
return nil;
}
- (BOOL)isDeclaredBySuperClass
{
return NO;
}
- (NSString *)javaValueClassName
{
[self notImplemented:_cmd];
return nil;
}
@end
@implementation EORelationship (EOModelExtensions)
- (BOOL)isDeclaredBySuperClass
{
return NO;
}
@end
@implementation NSMutableAttributedString (_EOModelerErrorConstruction)
+ (NSMutableAttributedString *)mutableAttributedStringWithBoldSubstitutionsWithFormat:(NSString *)format, ...
{
* EOModeler/EOMInspectorController.m (-init): Don't release the window on close. (_selectionChanged:): Fix view swapping. Set view as needing display. * EOModeler/EOModelExtensions.m: (+mutableAttributedStringWithBoldSubstitutionsWithFormat:): Implement. * EOModeler/EOModelerApp.h: Add -removeDocument:, -documentAtPath:, and -loadDocumentAtPath: methods. * EOModeler/EOModelerApp.m (-init:): Add parentheses around assignment. (-allPasteboardTypes): Initial implementation. (-removeDocument:): If removing the active document, set the active document to nil. (-documentWithPath:): Change array iterators to unsigned. (-registerColumNames:forClass:provider:): Ditto. (-modelContainingFetchSpecification:): Temporarily return nil. (-nameForFetchSpecification:): Ditto. * EOModeler/EOModelerDocument.h: Declare consistency check notification constants. Add -adaptor, -appendConsistencyCheckErrorText:, -appendConsistencyCheckSuccessText:, -addEntity:, -addRelationship, -addAttribute and -delete. * EOModeler/EOModelerDocument.m: Add consistency check notification constants. Add private category interface. (-firstSelectionOfClass:): Change array iterators to unsigned. Remove debugging logs. (-validateMenuItem:): Initial implementation. (-initWithModel:): Add parentheses around assignment. Add the model to the default model group. (-dealloc, -delete:): Initial implementation. (-isDirty, -prepareToSave,-checkCloseDocument): Return no temporarily until implemented. (-saveToPath:): Break long messages into separate lines. (-addDefaultEditor:, -addEntity:, -addAttribute:): Ditto. (-addRelationship:, ): (-activate): Remove commented out code. (-closeEditor:, -checkCloseEditor:): Add comments. (-canFlattenSelectedAttribute): Add temporary return value. (-windowWillClose:): Remove self from the open documents. (-checkConsistency:): Implement. (-appendConsistencyCheckErrorText:): Ditto. (-appendConsistencyCheckSuccessText:): Ditto. * EOModeler/EOModelerEditor.m (-initWithDocument:): Add parentheses around assignment. Don't retain our document. (-selectionPath:, -viewedObjectPath): Return nil. (-[EOModelerCompoundEditor dealloc]): Implement. (-[EOModelerCompoundEditor initWithParentObject:): Add parentheses around assignment. (-[EOModelerEmbedibleEditor pathViewPreferenceHint:): Return nil. * EOModeler/GNUmakefile: Remove extra whitespace. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21440 72102866-910b-0410-8b05-ffd578937521
2005-07-09 17:44:40 +00:00
va_list ap;
NSMutableAttributedString *s = [[NSMutableAttributedString alloc] init];
NSScanner *scanner = [NSScanner scannerWithString:format];
NSString *tmp;
NSDictionary *boldAttributes;
boldAttributes =
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSFont boldSystemFontOfSize:[NSFont systemFontSize]],
NSFontAttributeName,
nil];
[scanner setCharactersToBeSkipped:nil];
if (format == nil)
return nil;
va_start(ap, format);
[scanner scanUpToString:@"%@" intoString:&tmp];
[s appendAttributedString:AUTORELEASE([[NSAttributedString alloc]
initWithString:tmp])];
while ([scanner scanString:@"%@" intoString:NULL])
{
NSAttributedString *boldStr;
boldStr = [[NSAttributedString alloc]
initWithString:(NSString *)va_arg(ap, NSString *)
attributes: boldAttributes];
[s appendAttributedString:AUTORELEASE(boldStr)];
if ([scanner scanUpToString:@"%@" intoString:&tmp])
[s appendAttributedString:AUTORELEASE([[NSAttributedString alloc]
initWithString:tmp])];
}
va_end(ap);
RELEASE(boldAttributes);
return AUTORELEASE(s);
}
@end