Skip to content

Commit 5026166

Browse files
author
Nat!
committed
* moved MulleObjCLockFoundation into MulleObjC
* renamed MulleObject to MulleDynamicObject * renamed MulleLockingObject to... MulleObject (!) (by default it doesn't lock, unless your subclass adds protocols)
1 parent e07c611 commit 5026166

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+21779
-1890
lines changed

cmake/reflect/_Headers.cmake

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmake/reflect/_Sources.cmake

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MulleObjC.h

+9
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,23 @@
4444

4545
// classes
4646
#import "MulleObjCLoader.h"
47+
48+
#import "MulleDynamicObject.h"
4749
#import "MulleObject.h"
50+
4851
#import "NSAutoreleasePool.h"
52+
#import "NSCondition.h"
53+
#import "NSConditionLock.h"
4954
#import "NSInvocation.h"
55+
#import "NSLock.h"
5056
#import "NSMethodSignature.h"
5157
#import "NSNull.h"
5258
#import "NSObject.h"
5359
#import "NSProxy.h"
60+
#import "NSRecursiveLock.h"
5461
#import "NSThread.h"
5562

63+
5664
// protocols and protocolclasses
5765
#import "MulleObjCClassCluster.h"
5866
#import "MulleObjCException.h"
@@ -66,6 +74,7 @@
6674
#import "NSCopying.h"
6775
#import "NSCopyingWithAllocator.h"
6876
#import "NSFastEnumeration.h"
77+
#import "NSLocking.h"
6978
#import "NSMutableCopying.h"
7079
#import "NSObjectProtocol.h"
7180

src/class/MulleDynamicObject.h

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// MulleDynamicObject.m
3+
// MulleObjC
4+
//
5+
// Copyright (c) 2020 Nat! - Mulle kybernetiK.
6+
// Copyright (c) 2020 Codeon GmbH.
7+
// All rights reserved.
8+
//
9+
//
10+
// Redistribution and use in source and binary forms, with or without
11+
// modification, are permitted provided that the following conditions are met:
12+
//
13+
// Redistributions of source code must retain the above copyright notice, this
14+
// list of conditions and the following disclaimer.
15+
//
16+
// Redistributions in binary form must reproduce the above copyright notice,
17+
// this list of conditions and the following disclaimer in the documentation
18+
// and/or other materials provided with the distribution.
19+
//
20+
// Neither the name of Mulle kybernetiK nor the names of its contributors
21+
// may be used to endorse or promote products derived from this software
22+
// without specific prior written permission.
23+
//
24+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34+
// POSSIBILITY OF SUCH DAMAGE.
35+
//
36+
#import "NSObject.h"
37+
38+
#import "NSMutableCopying.h"
39+
40+
//
41+
// The convenient superclass of all "non-value" and "non-container" objects.
42+
//
43+
// This allows us to add properties via categories.
44+
// You declare them with @property( dynamic) int foo; in the @interface
45+
// and @dynamic foo; in the @implementation of a category on MulleDynamicObject.
46+
//
47+
// For this scheme to work, there must be NSValue and NSNumber classes present
48+
// in the runtime. Otherwise you can only store NSInteger, NSUInteger, char *
49+
// and any object (but not NSRange or floating point values or any integer
50+
// exceeding the sizeof( void *)
51+
//
52+
@interface MulleDynamicObject : NSObject < NSMutableCopying>
53+
{
54+
struct mulle__pointermap __ivars; // use __ to "hide" it
55+
}
56+
57+
//
58+
// You MUST NOT call [super forward:] to inherit this. See NSObject
59+
// forward: for more details
60+
//
61+
- (void *) forward:(void *) args;
62+
63+
64+
//
65+
// -isFullyDynamic set to YES creates descriptors on the fly
66+
// and guesses their type to be id.
67+
// The created descriptors are global and will affect everything. If your
68+
// registration of -myIntValue comes later in a NSBundle, it's tough luck.
69+
// The signature is already set to '@'.
70+
//
71+
// -isFullyDynamic is a non-thread safe global for performance reasons.
72+
//
73+
// Only override with a category!, don't override in a subclass! (As this
74+
// would obscure the actual extent of what this does). The idea is that
75+
// this is a global switch, that will affect all objects in the program.
76+
// It's supposed to be a "design" decision.
77+
//
78+
+ (BOOL) isFullyDynamic;
79+
80+
@end
81+
82+
83+
MULLE_C_NONNULL_FIRST_FOURTH
84+
void _MulleDynamicObjectValueSetter( MulleDynamicObject *self, SEL _cmd, void *_param, char *objcType);
85+
86+
MULLE_C_NONNULL_FIRST_FOURTH
87+
void _MulleDynamicObjectNumberSetter( MulleDynamicObject *self, mulle_objc_methodid_t _cmd, void *_param, char *objcType);
88+
89+
MULLE_C_NONNULL_FIRST
90+
void _MulleDynamicObjectValueGetter( MulleDynamicObject *self, SEL _cmd, void *_param);
91+
92+
93+
@interface MulleDynamicObject( NSMutableCopying)< NSMutableCopying>
94+
95+
// we can't do NSCopying, because we are mutable, but mutableCopy is sorta
96+
// outlawed (I am so conflicted)
97+
- (id) mutableCopy;
98+
99+
@end

0 commit comments

Comments
 (0)