ObjFW  Artifact [d6f7c115da]

Artifact d6f7c115daeb40ee4a397ddad1a3507c1fb0836dc1968af5e9accb6128844db0:


/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "config.h"

#import <wchar.h>
#import "OFConstWideCString.h"

@implementation OFConstWideCString
- initWithConstWideCString: (const wchar_t*)str
{
	if ((self = [super init])) {
		if (str == NULL) {
			length = 0;
			string = NULL;
		} else {
			length = wcslen(str);
			string = str;
		}
	}
	return self;
}

- (const wchar_t*)wcString
{
	return string;
}

- (size_t)length
{
	return length;
}

- (OFString*)clone
{
	return [OFString newWithConstWideCString: string];
}

- (int)compareTo: (OFString*)str
{
	return wcscmp(string, [str wcString]);
}
@end