Files
gitx/PBGitLane.h
T
Nathan Kinsinger c17215e55e Create wrapper class around git_oid and use it
This is a convenience class to replace using NSStrings to store and compare SHAs. PBGitSHA has a much faster isEqual: function.

It is <NSCopying> compliant and implements isEqual: and hash so it can be used as a key in dictionaries.
2010-07-04 09:46:12 -06:00

51 lines
708 B
Objective-C

//
// PBGitLane.h
// GitX
//
// Created by Pieter de Bie on 27-08-08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#include "git/oid.h"
class PBGitLane {
static int s_colorIndex;
git_oid d_sha;
int d_index;
public:
PBGitLane(git_oid *sha)
{
d_index = s_colorIndex++;
d_sha = *sha;
}
PBGitLane(NSString *sha)
{
git_oid_mkstr(&d_sha, [sha UTF8String]);
d_index = s_colorIndex++;
}
PBGitLane()
{
d_index = s_colorIndex++;
}
bool isCommit(git_oid sha) const
{
return !git_oid_cmp(&d_sha, &sha);
}
void setSha(git_oid sha);
git_oid const *sha() const
{
return &d_sha;
}
int index() const;
static void resetColors();
};