ObjFW  Check-in [a566e7bb03]

Overview
Comment:Add OFConstString.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a566e7bb03dfd33d0f1da07897d1e4763567b5e8c769170210243979d9e30864
User & Date: js on 2008-09-12 18:26:50
Other Links: manifest | tags
Context
2008-09-14
12:53
Add OFWideString and OFConstWideString. check-in: 1fe9cb366e user: js tags: trunk
2008-09-12
18:26
Add OFConstString. check-in: a566e7bb03 user: js tags: trunk
18:21
OFString uses OFObject's getMem: and resizeMem:toSize: now. check-in: 0256ab4f09 user: js tags: trunk
Changes

Modified src/Makefile from [53919dfb87] to [b48a2876b6].

1
2
3
4

5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
LIB = ${LIB_PREFIX}objfw${LIB_SUFFIX}
LIB_MAJOR = 1
LIB_MINOR = 0


SRCS = OFList.m		\
       OFListObject.m	\
       OFObject.m	\
       OFString.m

OBJCFLAGS += -fPIC -DPIC -fno-nil-recivers -fconstant-string-class=OFConstString
INCLUDES = OFList.h		\

	   OFListObject.h	\
	   OFObject.h		\
	   OFString.h

include ../buildsys.mk

LD = ${OBJC}
LIBS += -lobjc




>
|





|
>








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
LIB = ${LIB_PREFIX}objfw${LIB_SUFFIX}
LIB_MAJOR = 1
LIB_MINOR = 0

SRCS = OFConstString.m	\
       OFList.m		\
       OFListObject.m	\
       OFObject.m	\
       OFString.m

OBJCFLAGS += -fPIC -DPIC -fno-nil-recivers -fconstant-string-class=OFConstString
INCLUDES = OFConstString.h	\
	   OFList.h		\
	   OFListObject.h	\
	   OFObject.h		\
	   OFString.h

include ../buildsys.mk

LD = ${OBJC}
LIBS += -lobjc

Added src/OFConstString.h version [d944b1298b].

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * 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 <stddef.h>
#import "OFObject.h"

@interface OFConstString: OFObject
{
	const char	*string;
	size_t		length;
}

+ new:(const char*)str;
- init;
- init:(const char*)str;
- (const char*)cString;
- (size_t)length;
@end

/* vim: se syn=objc: */

Added src/OFConstString.m version [f25f4f5f15].





































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
40
41
42
43
44
45
46
47
48
49
50
/*
 * 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];
}

- init
{
	return [self init:NULL];
}

- 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
{
	return string;
}

- (size_t)length
{
	return length;
}
@end

Modified src/OFString.m from [c26b0e5b15] to [ec546376b0].

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * the packaging of this file.
 */

#import <stdlib.h>
#import <string.h>
#import "OFString.h"

/* TODO: Use getMem / resizeMem */

@implementation OFString
+ new:(const char*)str
{
	return [[OFString alloc] init:str];
}

- init







<
<







9
10
11
12
13
14
15


16
17
18
19
20
21
22
 * the packaging of this file.
 */

#import <stdlib.h>
#import <string.h>
#import "OFString.h"



@implementation OFString
+ new:(const char*)str
{
	return [[OFString alloc] init:str];
}

- init