2002-11-15 22:57:05 +00:00
|
|
|
/*
|
|
|
|
EOModelExtensions.m
|
|
|
|
|
2005-08-17 08:07:57 +00:00
|
|
|
Copyright (C) 2001,2002,2003,2004,2005 Free Software Foundation, Inc.
|
2002-11-15 22:57:05 +00:00
|
|
|
|
2006-09-14 16:06:21 +00:00
|
|
|
Author: Mirko Viviani <mirko.viviani@gmail.com>
|
2002-11-15 22:57:05 +00:00
|
|
|
Date: January 2001
|
|
|
|
|
|
|
|
This file is part of the GNUstep Database Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2005-05-13 00:00:56 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2002-11-15 22:57:05 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2007-07-12 06:39:22 +00:00
|
|
|
version 3 of the License, or (at your option) any later version.
|
2002-11-15 22:57:05 +00:00
|
|
|
|
|
|
|
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
|
2005-05-13 00:00:56 +00:00
|
|
|
Lesser General Public License for more details.
|
2002-11-15 22:57:05 +00:00
|
|
|
|
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
|
2002-11-15 22:57:05 +00:00
|
|
|
*/
|
|
|
|
|
2003-03-31 00:24:15 +00:00
|
|
|
#include "config.h"
|
2002-12-31 16:25:21 +00:00
|
|
|
|
2003-07-11 19:04:05 +00:00
|
|
|
#ifndef GNUSTEP
|
2003-08-25 20:01:59 +00:00
|
|
|
#include <GNUstepBase/GNUstep.h>
|
2004-01-29 13:23:22 +00:00
|
|
|
#include <GNUstepBase/GSCategories.h>
|
2003-07-11 19:04:05 +00:00
|
|
|
#endif
|
|
|
|
|
2008-05-09 20:32:12 +00:00
|
|
|
#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>
|
* EOControl/EOAndQualifier.m,
* EOControl/EOFault.m,
* EOControl/EOFaultHandler.m,
* EOControl/EOKeyComparisonQualifier.m,
* EOControl/EOKeyValueArchiver.m,
* EOControl/EOKeyValueCoding.m,
* EOControl/EOKeyValueCodingBase.m,
* EOControl/EOMutableKnownKeyDictionary.h,
* EOControl/EONotQualifier.m,
* EOControl/EOOrQualifier.m,
* EOControl/EOQualifier.m,
* EOAccess/EOAdaptor.m,
* EOAccess/EOAdaptorContext.m,
* EOAccess/EOAttribute.m,
* EOAccess/EODatabase.m,
* EOAccess/EODatabaseContext.m,
* EOAccess/EOExpressionArray.m,
* EOAccess/EOJoin.m,
* EOAccess/EOModel.m,
* EOAccess/EOModelGroup.m,
* EOAccess/EORelationship.m,
* EOAccess/EOSQLExpression.m,
* EOAccess/EOSQLQualifier.m,
* EOAccess/EOSchemaGeneration.m,
* EOAccess/EOStoredProcedure.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Adaptor.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Channel.m,
* EOInterface/EOTableViewAssociation.m,
* EOModeler/EOModelExtensions.m,
* EOModeler/EOModelerApp.m,
* DBModeler/ModelerAttributeEditor.m,
* DBModeler/ModelerEntityEditor.m: Remove references to NSUtilities.h.
Add includes for missing header references.
* DBModeler/Modeler.m (-[showEditor:]): Add cast to avoid compiler
warning.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25994 72102866-910b-0410-8b05-ffd578937521
2008-01-22 13:57:07 +00:00
|
|
|
#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>
|
* EOControl/EOAndQualifier.m,
* EOControl/EOFault.m,
* EOControl/EOFaultHandler.m,
* EOControl/EOKeyComparisonQualifier.m,
* EOControl/EOKeyValueArchiver.m,
* EOControl/EOKeyValueCoding.m,
* EOControl/EOKeyValueCodingBase.m,
* EOControl/EOMutableKnownKeyDictionary.h,
* EOControl/EONotQualifier.m,
* EOControl/EOOrQualifier.m,
* EOControl/EOQualifier.m,
* EOAccess/EOAdaptor.m,
* EOAccess/EOAdaptorContext.m,
* EOAccess/EOAttribute.m,
* EOAccess/EODatabase.m,
* EOAccess/EODatabaseContext.m,
* EOAccess/EOExpressionArray.m,
* EOAccess/EOJoin.m,
* EOAccess/EOModel.m,
* EOAccess/EOModelGroup.m,
* EOAccess/EORelationship.m,
* EOAccess/EOSQLExpression.m,
* EOAccess/EOSQLQualifier.m,
* EOAccess/EOSchemaGeneration.m,
* EOAccess/EOStoredProcedure.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Adaptor.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Channel.m,
* EOInterface/EOTableViewAssociation.m,
* EOModeler/EOModelExtensions.m,
* EOModeler/EOModelerApp.m,
* DBModeler/ModelerAttributeEditor.m,
* DBModeler/ModelerEntityEditor.m: Remove references to NSUtilities.h.
Add includes for missing header references.
* DBModeler/Modeler.m (-[showEditor:]): Add cast to avoid compiler
warning.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25994 72102866-910b-0410-8b05-ffd578937521
2008-01-22 13:57:07 +00:00
|
|
|
#include <Foundation/NSString.h>
|
2008-05-09 20:32:12 +00:00
|
|
|
#endif
|
* EOControl/EOAndQualifier.m,
* EOControl/EOFault.m,
* EOControl/EOFaultHandler.m,
* EOControl/EOKeyComparisonQualifier.m,
* EOControl/EOKeyValueArchiver.m,
* EOControl/EOKeyValueCoding.m,
* EOControl/EOKeyValueCodingBase.m,
* EOControl/EOMutableKnownKeyDictionary.h,
* EOControl/EONotQualifier.m,
* EOControl/EOOrQualifier.m,
* EOControl/EOQualifier.m,
* EOAccess/EOAdaptor.m,
* EOAccess/EOAdaptorContext.m,
* EOAccess/EOAttribute.m,
* EOAccess/EODatabase.m,
* EOAccess/EODatabaseContext.m,
* EOAccess/EOExpressionArray.m,
* EOAccess/EOJoin.m,
* EOAccess/EOModel.m,
* EOAccess/EOModelGroup.m,
* EOAccess/EORelationship.m,
* EOAccess/EOSQLExpression.m,
* EOAccess/EOSQLQualifier.m,
* EOAccess/EOSchemaGeneration.m,
* EOAccess/EOStoredProcedure.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Adaptor.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Channel.m,
* EOInterface/EOTableViewAssociation.m,
* EOModeler/EOModelExtensions.m,
* EOModeler/EOModelerApp.m,
* DBModeler/ModelerAttributeEditor.m,
* DBModeler/ModelerEntityEditor.m: Remove references to NSUtilities.h.
Add includes for missing header references.
* DBModeler/Modeler.m (-[showEditor:]): Add cast to avoid compiler
warning.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25994 72102866-910b-0410-8b05-ffd578937521
2008-01-22 13:57:07 +00:00
|
|
|
|
2008-05-09 20:32:12 +00:00
|
|
|
#ifdef NeXT_GUI_LIBRARY
|
|
|
|
#include <AppKit/AppKit.h>
|
|
|
|
#else
|
* EOControl/EOAndQualifier.m,
* EOControl/EOFault.m,
* EOControl/EOFaultHandler.m,
* EOControl/EOKeyComparisonQualifier.m,
* EOControl/EOKeyValueArchiver.m,
* EOControl/EOKeyValueCoding.m,
* EOControl/EOKeyValueCodingBase.m,
* EOControl/EOMutableKnownKeyDictionary.h,
* EOControl/EONotQualifier.m,
* EOControl/EOOrQualifier.m,
* EOControl/EOQualifier.m,
* EOAccess/EOAdaptor.m,
* EOAccess/EOAdaptorContext.m,
* EOAccess/EOAttribute.m,
* EOAccess/EODatabase.m,
* EOAccess/EODatabaseContext.m,
* EOAccess/EOExpressionArray.m,
* EOAccess/EOJoin.m,
* EOAccess/EOModel.m,
* EOAccess/EOModelGroup.m,
* EOAccess/EORelationship.m,
* EOAccess/EOSQLExpression.m,
* EOAccess/EOSQLQualifier.m,
* EOAccess/EOSchemaGeneration.m,
* EOAccess/EOStoredProcedure.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Adaptor.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Channel.m,
* EOInterface/EOTableViewAssociation.m,
* EOModeler/EOModelExtensions.m,
* EOModeler/EOModelerApp.m,
* DBModeler/ModelerAttributeEditor.m,
* DBModeler/ModelerEntityEditor.m: Remove references to NSUtilities.h.
Add includes for missing header references.
* DBModeler/Modeler.m (-[showEditor:]): Add cast to avoid compiler
warning.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25994 72102866-910b-0410-8b05-ffd578937521
2008-01-22 13:57:07 +00:00
|
|
|
#include <AppKit/NSFont.h>
|
|
|
|
#include <AppKit/NSAttributedString.h>
|
2008-05-09 20:32:12 +00:00
|
|
|
#endif
|
* EOControl/EOAndQualifier.m,
* EOControl/EOFault.m,
* EOControl/EOFaultHandler.m,
* EOControl/EOKeyComparisonQualifier.m,
* EOControl/EOKeyValueArchiver.m,
* EOControl/EOKeyValueCoding.m,
* EOControl/EOKeyValueCodingBase.m,
* EOControl/EOMutableKnownKeyDictionary.h,
* EOControl/EONotQualifier.m,
* EOControl/EOOrQualifier.m,
* EOControl/EOQualifier.m,
* EOAccess/EOAdaptor.m,
* EOAccess/EOAdaptorContext.m,
* EOAccess/EOAttribute.m,
* EOAccess/EODatabase.m,
* EOAccess/EODatabaseContext.m,
* EOAccess/EOExpressionArray.m,
* EOAccess/EOJoin.m,
* EOAccess/EOModel.m,
* EOAccess/EOModelGroup.m,
* EOAccess/EORelationship.m,
* EOAccess/EOSQLExpression.m,
* EOAccess/EOSQLQualifier.m,
* EOAccess/EOSchemaGeneration.m,
* EOAccess/EOStoredProcedure.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m,
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Adaptor.m,
* EOAdaptors/SQLiteAdaptor/SQLite3Channel.m,
* EOInterface/EOTableViewAssociation.m,
* EOModeler/EOModelExtensions.m,
* EOModeler/EOModelerApp.m,
* DBModeler/ModelerAttributeEditor.m,
* DBModeler/ModelerEntityEditor.m: Remove references to NSUtilities.h.
Add includes for missing header references.
* DBModeler/Modeler.m (-[showEditor:]): Add cast to avoid compiler
warning.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25994 72102866-910b-0410-8b05-ffd578937521
2008-01-22 13:57:07 +00:00
|
|
|
|
|
|
|
#include <EOControl/EODebug.h>
|
|
|
|
|
|
|
|
#include "EOModeler/EOModelExtensions.h"
|
2002-11-15 22:57:05 +00:00
|
|
|
|
|
|
|
@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
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
|
2002-11-15 22:57:05 +00:00
|
|
|
EOAttribute *attr;
|
|
|
|
NSMutableArray *array;
|
|
|
|
|
|
|
|
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
array = [NSMutableArray arrayWithCapacity:10];
|
|
|
|
|
|
|
|
while((attr = [enumerator nextObject]))
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
if([attr isKindOfClass: [EOAttribute class]] && [attr isScalar] == YES)
|
2002-11-15 22:57:05 +00:00
|
|
|
[array addObject:attr];
|
|
|
|
}
|
|
|
|
|
|
|
|
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)classNonScalarAttributes
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
|
2002-11-15 22:57:05 +00:00
|
|
|
EOAttribute *attr;
|
|
|
|
NSMutableArray *array;
|
|
|
|
|
|
|
|
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
array = [NSMutableArray arrayWithCapacity:10];
|
|
|
|
|
|
|
|
while((attr = [enumerator nextObject]))
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
if([attr isKindOfClass: [EOAttribute class]] && [attr isScalar] == NO)
|
2002-11-15 22:57:05 +00:00
|
|
|
[array addObject:attr];
|
|
|
|
}
|
|
|
|
|
|
|
|
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)classToManyRelationships
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
|
2002-11-15 22:57:05 +00:00
|
|
|
EORelationship *relationship;
|
|
|
|
NSMutableArray *array;
|
|
|
|
|
|
|
|
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
array = [NSMutableArray arrayWithCapacity:10];
|
|
|
|
|
|
|
|
while((relationship = [enumerator nextObject]))
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
if([relationship isKindOfClass: [EORelationship class]]
|
|
|
|
&& [relationship isToMany] == YES)
|
2002-11-15 22:57:05 +00:00
|
|
|
[array addObject:relationship];
|
|
|
|
}
|
|
|
|
|
|
|
|
EOFLOGObjectFnStopOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)classToOneRelationships
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
NSEnumerator *enumerator = [[self classProperties] objectEnumerator];
|
2002-11-15 22:57:05 +00:00
|
|
|
EORelationship *relationship;
|
|
|
|
NSMutableArray *array;
|
|
|
|
|
|
|
|
EOFLOGObjectFnStartOrCond2(@"ModelingClasses",@"EOEntity");
|
|
|
|
|
|
|
|
array = [NSMutableArray arrayWithCapacity:10];
|
|
|
|
|
|
|
|
while((relationship = [enumerator nextObject]))
|
|
|
|
{
|
2002-12-04 18:07:27 +00:00
|
|
|
if([relationship isKindOfClass: [EORelationship class]]
|
|
|
|
&& [relationship isToMany] == NO)
|
2002-11-15 22:57:05 +00:00
|
|
|
[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
|
|
|
|
{
|
2010-04-29 02:28:23 +00:00
|
|
|
NSString * vType = [self valueType];
|
|
|
|
unichar myChar;
|
|
|
|
|
2010-04-29 18:14:30 +00:00
|
|
|
if ([vType length] < 1) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2010-04-29 02:28:23 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2002-11-15 22:57:05 +00:00
|
|
|
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);
|
2002-11-15 22:57:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|