File: connection.m

package info (click to toggle)
gnustep-dl2 0.12.0%2Bgit20250112-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,092 kB
  • sloc: objc: 68,223; makefile: 60; sh: 48
file content (39 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <Foundation/Foundation.h>
#include <EOAccess/EOAccess.h>
#include <EOControl/EOControl.h>

int
main(int arcg, char *argv[], char **envp)
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  EOModelGroup *modelGroup = [EOModelGroup defaultGroup];
  EOModel *model = [modelGroup modelNamed:@"library"];
  EOAdaptor *adaptor;
  EOAdaptorContext *context;
  EOAdaptorChannel *channel;
  NSDictionary *dict = nil;

  /* Tools don't have resources so we have to add the model manually. */ 
  if (!model)
    {
      NSString *path = @"./library.eomodel";
      model = [[EOModel alloc] initWithContentsOfFile: path];
      dict = [model connectionDictionary];
      [modelGroup addModel:model];
      [model release];
    }
 
  adaptor = [EOAdaptor adaptorWithName:[model adaptorName]];
  [adaptor setConnectionDictionary: dict];
  context = [adaptor createAdaptorContext];
  channel = [context createAdaptorChannel];

  [channel openChannel];

  /* insert code here */

  [channel closeChannel];
  [pool release];
  return 0;
}