ObjFW  Check-in [68ef210228]

Overview
Comment:Rename OFConstString to OFConstantString.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 68ef210228aeae6acbfecfcb9dc73a51b77362ef43d5b1cd72e7d8f2f27cc726
User & Date: js on 2010-09-16 00:08:10
Other Links: manifest | tags
Context
2010-09-16
00:08
Bump lib major as we already have incompatible changes. check-in: be24ecc7a9 user: js tags: trunk
00:08
Rename OFConstString to OFConstantString. check-in: 68ef210228 user: js tags: trunk
00:00
Documentation improvements. check-in: 0f04c85a63 user: js tags: trunk
Changes

Modified README from [9edbf03130] to [c99d17394d].

30
31
32
33
34
35
36
37
38
39
40
41
42
43


USING THE MAC OS X FRAMWORK IN XCODE

  To use the Mac OS X framework in Xcode, you need to add the .framework
  to your project and add the following flags to "Other C Flags":

    -fconstant-string-class=OFConstString -fno-constant-cfstrings


BUGS AND FEATURE REQUESTS

  If you find any bugs or have feature requests, feel free to send a
  mail to js-spam@webkeks.org (remove -spam from the address!).







|






30
31
32
33
34
35
36
37
38
39
40
41
42
43


USING THE MAC OS X FRAMWORK IN XCODE

  To use the Mac OS X framework in Xcode, you need to add the .framework
  to your project and add the following flags to "Other C Flags":

    -fconstant-string-class=OFConstantString -fno-constant-cfstrings


BUGS AND FEATURE REQUESTS

  If you find any bugs or have feature requests, feel free to send a
  mail to js-spam@webkeks.org (remove -spam from the address!).

Modified configure.ac from [a82a96cd8d] to [fb70c594a6].

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_EGREP

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"

AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCFLAGS="$OBJCFLAGS -pipe"])
AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"])
AX_CHECK_COMPILER_FLAGS(-fno-constant-cfstrings, [
	NO_CONST_CFSTRINGS="-fno-constant-cfstrings"
	OBJCFLAGS="$OBJCFLAGS -fno-constant-cfstrings"])
AC_SUBST(NO_CONST_CFSTRINGS)







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_EGREP

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS"
OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstantString"

AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCFLAGS="$OBJCFLAGS -pipe"])
AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"])
AX_CHECK_COMPILER_FLAGS(-fno-constant-cfstrings, [
	NO_CONST_CFSTRINGS="-fno-constant-cfstrings"
	OBJCFLAGS="$OBJCFLAGS -fno-constant-cfstrings"])
AC_SUBST(NO_CONST_CFSTRINGS)
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
if test x"$GOBJC" = x"yes"; then
	OBJCFLAGS="$OBJCFLAGS -Werror"

	AC_MSG_CHECKING(whether gcc has bug objc/27438)
	AC_TRY_COMPILE([
		#import <objc/objc.h>

		@interface OFConstString
		{
			Class isa;
			const char *string;
			unsigned long size;
		}
		@end

		void *_OFConstStringClassReference;
		], [
		OFConstString *test = @"";
		test++; /* Get rid of unused variable warning */
		], [AC_MSG_RESULT(no)], [
		AC_MSG_RESULT([yes, adding -Wno-unused-variable])
		OBJCFLAGS="$OBJCFLAGS -Wno-unused-variable"
		AC_SUBST(NO_WARN_UNUSED, "-Wno-unused-variable")])

	AC_MSG_CHECKING(whether we need -Wno-strict-aliasing due to gcc bugs)







|







|

|







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
if test x"$GOBJC" = x"yes"; then
	OBJCFLAGS="$OBJCFLAGS -Werror"

	AC_MSG_CHECKING(whether gcc has bug objc/27438)
	AC_TRY_COMPILE([
		#import <objc/objc.h>

		@interface OFConstantString
		{
			Class isa;
			const char *string;
			unsigned long size;
		}
		@end

		void *_OFConstantStringClassReference;
		], [
		OFConstantString *test = @"";
		test++; /* Get rid of unused variable warning */
		], [AC_MSG_RESULT(no)], [
		AC_MSG_RESULT([yes, adding -Wno-unused-variable])
		OBJCFLAGS="$OBJCFLAGS -Wno-unused-variable"
		AC_SUBST(NO_WARN_UNUSED, "-Wno-unused-variable")])

	AC_MSG_CHECKING(whether we need -Wno-strict-aliasing due to gcc bugs)

Modified src/Makefile from [b2d5824793] to [a78e57c409].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
include ../extra.mk

LIB = ${OBJFW_SHARED_LIB}
LIB_MAJOR = ${OBJFW_LIB_MAJOR}
LIB_MINOR = ${OBJFW_LIB_MINOR}
STATIC_LIB = ${OBJFW_STATIC_LIB}

SRCS = OFApplication.m		\
       OFArray.m		\
       OFAutoreleasePool.m	\
       OFConstString.m		\
       OFDataArray.m		\
       OFDictionary.m		\
       OFExceptions.m		\
       OFFile.m			\
       OFHash.m			\
       OFEnumerator.m		\
       OFList.m			\










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
include ../extra.mk

LIB = ${OBJFW_SHARED_LIB}
LIB_MAJOR = ${OBJFW_LIB_MAJOR}
LIB_MINOR = ${OBJFW_LIB_MINOR}
STATIC_LIB = ${OBJFW_STATIC_LIB}

SRCS = OFApplication.m		\
       OFArray.m		\
       OFAutoreleasePool.m	\
       OFConstantString.m	\
       OFDataArray.m		\
       OFDictionary.m		\
       OFExceptions.m		\
       OFFile.m			\
       OFHash.m			\
       OFEnumerator.m		\
       OFList.m			\

Deleted src/OFConstString.h version [2d731ff292].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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 "OFString.h"

#ifdef OF_APPLE_RUNTIME
extern void *_OFConstStringClassReference;
#endif

/**
 * \brief A class for storing constant strings using the \@"" literal.
 */
@interface OFConstString: OFString {}
@end
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































Deleted src/OFConstString.m version [6da12923e2].

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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.
 */

#include "config.h"

#import "OFConstString.h"
#import "OFExceptions.h"

#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>

void *_OFConstStringClassReference;
#endif

@implementation OFConstString
#ifdef OF_APPLE_RUNTIME
+ (void)load
{
	objc_setFutureClass((Class)&_OFConstStringClassReference,
	    "OFConstString");
}
#endif

+ alloc
{
	@throw [OFNotImplementedException newWithClass: self
					      selector: _cmd];
}

- init
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding;
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding
	   length: (size_t)len
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
           length: (size_t)len
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithFormat: (OFString*)fmt, ...
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithFormat: (OFString*)fmt
       arguments: (va_list)args
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithString: (OFString*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void)addMemoryToPool: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)allocMemoryForNItems: (size_t)nitems
                     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)resizeMemory: (void*)ptr
	       toSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)resizeMemory: (void*)ptr
	     toNItems: (size_t)nitems
	     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void)freeMemory: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- retain
{
	return self;
}

- autorelease
{
	return self;
}

- (size_t)retainCount
{
	return SIZE_MAX;
}

- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
}
@end
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































Added src/OFConstantString.h version [5a76a73ac7].













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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 "OFString.h"

#ifdef OF_APPLE_RUNTIME
extern void *_OFConstantStringClassReference;
#endif

/**
 * \brief A class for storing constant strings using the \@"" literal.
 */
@interface OFConstantString: OFString {}
@end

Added src/OFConstantString.m version [d070e3d08a].

























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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.
 */

#include "config.h"

#import "OFConstantString.h"
#import "OFExceptions.h"

#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>

void *_OFConstantStringClassReference;
#endif

@implementation OFConstantString
#ifdef OF_APPLE_RUNTIME
+ (void)load
{
	objc_setFutureClass((Class)&_OFConstantStringClassReference,
	    "OFConstantString");
}
#endif

+ alloc
{
	@throw [OFNotImplementedException newWithClass: self
					      selector: _cmd];
}

- init
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding;
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
	 encoding: (enum of_string_encoding)encoding
	   length: (size_t)len
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithCString: (const char*)str
           length: (size_t)len
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithFormat: (OFString*)fmt, ...
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithFormat: (OFString*)fmt
       arguments: (va_list)args
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithString: (OFString*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void)addMemoryToPool: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)allocMemoryForNItems: (size_t)nitems
                     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)resizeMemory: (void*)ptr
	       toSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void*)resizeMemory: (void*)ptr
	     toNItems: (size_t)nitems
	     withSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- (void)freeMemory: (void*)ptr
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- retain
{
	return self;
}

- autorelease
{
	return self;
}

- (size_t)retainCount
{
	return SIZE_MAX;
}

- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
}
@end

Modified src/OFString.h from [9830becdb5] to [b8bdd51fbc].

371
372
373
374
375
376
377
378
379
380
381
382
383
 * Writes the string into the specified file using UTF-8 encoding.
 *
 * \param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;
@end

#import "OFConstString.h"
#import "OFMutableString.h"
#import "OFString+Hashing.h"
#import "OFString+URLEncoding.h"
#import "OFString+XMLEscaping.h"
#import "OFString+XMLUnescaping.h"







|





371
372
373
374
375
376
377
378
379
380
381
382
383
 * Writes the string into the specified file using UTF-8 encoding.
 *
 * \param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;
@end

#import "OFConstantString.h"
#import "OFMutableString.h"
#import "OFString+Hashing.h"
#import "OFString+URLEncoding.h"
#import "OFString+XMLEscaping.h"
#import "OFString+XMLUnescaping.h"

Modified utils/objfw-config.in from [1dc0842083] to [9ae51844d3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
CFLAGS=""
CPPFLAGS="-I@includedir@"
CXXFLAGS=""
OBJC="@OBJC@"
OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @BLOCKS_FLAGS@ @NO_WARN_UNUSED@"
LDFLAGS=""
LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@"
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
VERSION="0.4-dev"










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
CFLAGS=""
CPPFLAGS="-I@includedir@"
CXXFLAGS=""
OBJC="@OBJC@"
OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstantString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @BLOCKS_FLAGS@ @NO_WARN_UNUSED@"
LDFLAGS=""
LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@"
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
VERSION="0.4-dev"