Author: gcasa
Date: Wed Apr 16 23:29:08 2014
New Revision: 37799

URL: http://svn.gna.org/viewcvs/gnustep?rev=37799&view=rev
Log:
Addition of XIBObject base class for handling objects parsed out of the XIB 
file.

Modified:
    libs/gui/trunk/ChangeLog
    libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibElement.h
    libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibObjectContainer.h
    libs/gui/trunk/Source/GSXibElement.m
    libs/gui/trunk/Source/GSXibParser.m

Modified: libs/gui/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=37799&r1=37798&r2=37799&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog    (original)
+++ libs/gui/trunk/ChangeLog    Wed Apr 16 23:29:08 2014
@@ -1,3 +1,11 @@
+2014-04-16 17:28-EDT Gregory John Casamento <[email protected]>
+
+       * Headers/Additions/GNUstepGUI/GSXibElement.h
+       * Headers/Additions/GNUstepGUI/GSXibObjectContainer.h
+       * Source/GSXibElement.m
+       * Source/GSXibParser.m: More XIB changes.  Addition of XIBObject
+       class.
+
 2014-04-03 00:55-EDT Gregory John Casamento <[email protected]>
 
        * Source/GSXibParser.m: Add code to parse XML into a tree

Modified: libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibElement.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibElement.h?rev=37799&r1=37798&r2=37799&view=diff
==============================================================================
--- libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibElement.h  (original)
+++ libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibElement.h  Wed Apr 16 
23:29:08 2014
@@ -53,6 +53,7 @@
 - (void) setValue: (NSString*)text;
 - (NSString*) attributeForKey: (NSString*)key;
 - (GSXibElement*) elementForKey: (NSString*)key;
+- (NSDictionary *) attributes;
 @end
 
 #endif

Modified: libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibObjectContainer.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibObjectContainer.h?rev=37799&r1=37798&r2=37799&view=diff
==============================================================================
--- libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibObjectContainer.h  
(original)
+++ libs/gui/trunk/Headers/Additions/GNUstepGUI/GSXibObjectContainer.h  Wed Apr 
16 23:29:08 2014
@@ -29,7 +29,13 @@
 
 #import <Foundation/NSObject.h>
 
+@class NSMutableArray;
+
 @interface GSXibObjectContainer : NSObject
+{
+  NSMutableArray *objects;
+  NSMutableArray *connections;
+}
 @end
 
 #endif

Modified: libs/gui/trunk/Source/GSXibElement.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/GSXibElement.m?rev=37799&r1=37798&r2=37799&view=diff
==============================================================================
--- libs/gui/trunk/Source/GSXibElement.m        (original)
+++ libs/gui/trunk/Source/GSXibElement.m        Wed Apr 16 23:29:08 2014
@@ -100,6 +100,11 @@
   return [elements objectForKey: key];
 }
 
+- (NSDictionary *)attributes
+{
+  return attributes;
+}
+
 - (NSString*) description
 {
   return [NSString stringWithFormat: 

Modified: libs/gui/trunk/Source/GSXibParser.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/GSXibParser.m?rev=37799&r1=37798&r2=37799&view=diff
==============================================================================
--- libs/gui/trunk/Source/GSXibParser.m (original)
+++ libs/gui/trunk/Source/GSXibParser.m Wed Apr 16 23:29:08 2014
@@ -34,6 +34,65 @@
 #import "GNUstepGUI/GSXibParser.h"
 #import "GNUstepGUI/GSXibElement.h"
 
+// XIB Object...
+@interface XIBObject : NSObject
+{
+  NSMutableArray *connections;
+}
+- (id) initWithXibElement: (GSXibElement *)element;
+- (id) instantiateObject;
+@end
+
+@implementation XIBObject
+- (id) initWithXibElement: (GSXibElement *)element
+{
+  if ((self = [super init]) != nil)
+    {
+      connections = [[NSMutableArray alloc] initWithCapacity: 10];
+    }
+  return self;
+}
+
+- (void) dealloc
+{
+  [connections release];
+  [super dealloc];
+}
+
+- (id) instantiateObject
+{
+  return nil;
+}
+
+- (NSArray *) connections
+{
+  return connections;
+}
+@end
+
+@interface XIBAction : XIBObject
+- (void) setSelector: (NSString *)selectorName;
+- (NSString *) selector;
+- (void) setTarget: (NSString *)targetId;
+- (NSString *) target;
+@end
+
+@interface XIBOutlet : XIBObject
+- (void) setProperty: (NSString *)propertyName;
+- (NSString *) property;
+- (void) setDestination: (NSString *)destinationId;
+- (NSString *) destination;
+@end
+
+@interface XIBCustomObject
+- (void) setUserLabel: (NSString *)label;
+- (NSString *) userLabel;
+- (void) setCustomClass: (NSString *)className;
+- (NSString *) customClass;
+@end
+
+
+
 @implementation GSXibParser 
 
 - (id) initWithData: (NSData *)data
@@ -64,6 +123,34 @@
   NS_ENDHANDLER;
   
   return objects;
+}
+
+- (NSMutableDictionary *) instantiateObjects
+{
+  return nil;
+}
+
+- (NSString *)classNameFromType: (NSString *)typeName
+{
+  NSString *className = [@"XIB" stringByAppendingString: [typeName 
capitalizedString]];
+  return className;
+}
+
+- (id) instantiateObjectForElement: (GSXibElement *)element
+{
+  NSString *className = [self classNameFromType: [element type]];
+  id obj = nil;
+
+  if (className != nil)
+    {
+      Class cls = NSClassFromString(className);
+      if (cls != nil)
+       {
+         obj = [[cls alloc] initWithXibElement:element];
+       }
+    }
+
+  return obj;
 }
 
 - (void) parser: (NSXMLParser*)parser
@@ -92,6 +179,7 @@
     {
       if (key != nil)
        {
+         // id obj = [self instantiateObjectForElement: element];
          [currentElement setElement: element forKey: key];
        }
       else
@@ -115,5 +203,9 @@
       currentElement = [stack lastObject];
       [stack removeLastObject];
     }
-}
-@end
+  else
+    {
+      objects = [self instantiateObjects];
+    }
+}
+@end


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to