Objective-C plugin for Dia2Code


an iconic image showing a UML colored cube and the beginning of a c source file

Dia2Code transforms UML class diagrams made with Dia into skeleton source code. I wrote a plugin for it that will produce Objective-C code. Below you can see a sample diagram and the code it yields, there still is a bit to do.

Diagram

upertestclass.m


#include "supertestclass.h"

@implementation superTestClass
- (int) zap: (NSString*)baz
{
};

+ (id) superTestClassFromString: (NSString*)aString
{
};

notMe 
{
};


// Attribute accessors

@end;


// Private messages
@implementation superTestClass (Private)

@end


// Protected messages
@implementation superTestClass (Protected)

@end
 

upertestclass.h


#ifndef SUPERTESTCLASS_H
#define SUPERTESTCLASS_H


// powertype
@interface superTestClass
{
// Associations
// Attributes
@protected // public by accessor
        float scoobyness;
        float barness;
@private
        NSString* doobyname;
        static int numberOfObjects;
@protected
        int foofooid;
}

// Operations
- (int) zap: (NSString*)baz;
+ (id) superTestClassFromString: (NSString*)aString;
notMe ;

// Attribute accessors

@end;


// Private messages, as a user of this class you should not use these!
@interface superTestClass (Private)

@end


// Protected messages, as a user of this class you should not use these!
@interface superTestClass (Protected)

@end

#endif


#include "testclass.h"

@implementation testClass
+ (void) glork: (int)dork
{
};

- (void) blinkWithColor: (int)color andFreq: (int)fre
{
};


// Attribute accessors

@end;


// Private messages
@implementation testClass (Private)

@end


// Protected messages
@implementation testClass (Protected)

@end


testclass.h


#ifndef TESTCLASS_H
#define TESTCLASS_H

#include "testinterface.h"
#include "supertestclass.h"

// utility
@interface testClass : superTestClass, testInterface
{
// Associations
// Attributes
@private
        byte fooness;
}

// Operations
+ (void) glork: (int)dork;
- (void) blinkWithColor: (int)color andFreq: (int)fre;

// Attribute accessors

@end;


// Private messages, as a user of this class you should not use these!
@interface testClass (Private)

@end


// Protected messages, as a user of this class you should not use these!
@interface testClass (Protected)

@end

#endif


testinterface.h


#include "testinterface.h"

@implementation testInterface
- (BOOL) testMe 
{
};


// Attribute accessors

@end;


// Private messages
@implementation testInterface (Private)

@end


// Protected messages
@implementation testInterface (Protected)

@end


testclass.m


#include "testclass.h"

@implementation testClass
+ (void) glork: (int)dork
{
};

- (void) blinkWithColor: (int)color andFreq: (int)fre
{
};


// Attribute accessors

@end;


// Private messages
@implementation testClass (Private)

@end


// Protected messages
@implementation testClass (Protected)

@end

testclass.m


#ifndef TESTCLASS_H
#define TESTCLASS_H

#include "testinterface.h"
#include "supertestclass.h"

// utility
@interface testClass : superTestClass, testInterface
{
// Associations
// Attributes
@private
        byte fooness;
}

// Operations
+ (void) glork: (int)dork;
- (void) blinkWithColor: (int)color andFreq: (int)fre;

// Attribute accessors

@end;


// Private messages, as a user of this class you should not use these!
@interface testClass (Private)

@end


// Protected messages, as a user of this class you should not use these!
@interface testClass (Protected)

@end

#endif


Björn Gohla
Created with
    XEmacs| Genpage - Version: 1.0.7