Murky / Source / HgProject.h

Full commit
//  HgProject.h
//  Murky
//  Copyright 2008-2009 Jens Alfke. All rights reserved.

#import <Cocoa/Cocoa.h>
@class HgRepository;

/** A "Project" is a collection of repositories with a common ancestry.
    For example, for one project you might have local "release" and "experimental" repositories,
    a backup one on your web-host, and a public one on Bitbucket.
    This class doesn't relate diectly to the Mercurial command-set;
    it's used by the ProjectsController as the model for the Projects window. */
@interface HgProject : NSObject <NSCoding>
    NSString *_name;
    NSMutableArray *_children;      // array of child HgProjects
    NSURL *_repositoryURL;          // repository URL (if I'm a leaf)
    NSURL *_browseURL;              // Web URL for browsing repo
    HgRepository *_repository;      // repository object (instantiated lazily)
    NSString *_uuid;                // Unique ID (only for folders)

+ (HgProject*) projectWithName: (NSString*)name;
+ (HgProject*) projectWithRepositoryURL: (NSURL*)url;
+ (HgProject*) projectWithName: (NSString*)name repositoryURL: (NSURL*)url;

@property (copy) NSString *name;
@property (copy) NSArray *children;
@property (readonly) NSString *uuid;

- (BOOL) addChild: (HgProject*)child;
- (BOOL) addChild: (HgProject*)child atIndex: (NSUInteger)index;
- (BOOL) addChild: (HgProject*)child afterChild: (HgProject*)afterChild;
- (BOOL) removeChild: (HgProject*)child;
- (BOOL) removeDescendent: (HgProject*)descendent;

- (BOOL) containsProject: (HgProject*)descendent;

@property (readonly) BOOL isLeaf, isRepository, isLocal;
@property (assign) NSURL* repositoryURL, *browseURL;
@property (readonly) HgRepository* repository;

@property (readonly) NSImage *icon;