1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/*
* 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 <stdlib.h>
#import <string.h>
#import "OFConstString.h"
@implementation OFConstString
+ new:(const char*)str
{
return [[OFConstString alloc] init:str];
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/*
* 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 <string.h>
#import "OFConstString.h"
@implementation OFConstString
+ new:(const char*)str
{
return [[OFConstString alloc] init:str];
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
- init:(const char*)str
{
if ((self = [super init])) {
if (str == NULL) {
length = 0;
string = NULL;
} else {
length = strlen(string);
string = str;
}
}
return self;
}
- (const char*)cString
|
|
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
- init:(const char*)str
{
if ((self = [super init])) {
if (str == NULL) {
length = 0;
string = NULL;
} else {
length = strlen(str);
string = str;
}
}
return self;
}
- (const char*)cString
|