Re: NSMutableDictionary or Custom Object when adding properties?
Howdy, It's very easy to do using runtime. I have a framework for doing dynamic creation at runtime. Also, It's easy to get O-C based class elements such as properties, ivars, protocols. methods using runtime. You can take a look at this. https://gist.github.com/Ch0c0late/5575679 It introspects protocol conformed by a class also it could add new protocol to the class. The rest of the code is on my local. You can feel free using it. It's part of a SCK framework. If you need more type e.g. methods, properties, etc, you can take a look at my framework. I'm coding an OODBMS for OS X that uses O-C runtime so much. Again using runtime it's easy. How? First of all the system creates an empty array. Then the user can create any type of object he/she wants without any limit. For archiving unarchiving I used Boxing UnBoxing classes(NSNumber, NSValue, NSNull) that let me to archive c primitive types and so on. There is s.t. interesting that could be your answer. Take a look at this one https://github.com/snej/MYUtilities/blob/master/MYDynamicObject.h It's a good class that you can use to create dynamic object at runtime. I added Archiving UnArchiving mechanism to it for my own. Please note that in 64 bit system there is no need to declare iVars. The runtime acts as iVar property with property. Down the hatch. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problems converting to ARC
I want to convert my code to ARC but this problems doesn't let me to do this. I read the errors but I couldn't do nothing. All the problems are in these else if statement and are colored Red. else if (isupper(character)){ 1) Pointer to non-const type 'NSString *' with no explicit ownership NSString **classOrProtocolName = (isParsingProtocolName ? protocolName : className); 2) Passing address of non-local object to __autoreleasing parameter for write back i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), classOrProtocolName); isParsingProtocolName = NO; }else if (i == 0){ 3) Passing address of non-local object to __autoreleasing parameter for write back int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), typePrefix); if (advancement == 0) return; i += advancement; }else{ 2) Passing address of non-local object to __autoreleasing parameter for write back i += parseTypeSuffix(unparsedText, strlen(unparsedText), typeSuffix); } You could rewrite the above code like this: else if (isupper(character)){ NSString *classOrProtocolName; i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), classOrProtocolName); if (isParsingProtocolName) protocolName = classOrProtocolName; else className = classOrProtocolName; isParsingProtocolName = NO; }else if (i == 0){ NSString* localTypePrefix; int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), localTypePrefix); typePrefix = localTypePrefix; if (advancement == 0) return; i += advancement; }else{ NSString* localTypeSuffix; i += parseTypeSuffix(unparsedText, strlen(unparsedText), localTypeSuffix); typeSuffix = localTypeSuffix; } Regards, Ken Why did you changed the source code? The aspect is correct but the problem was ARC that I solved all of them. I used __strong and it'a ok now. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problems converting to ARC
I want to convert my code to ARC but this problems doesn't let me to do this. I read the errors but I couldn't do nothing. All the problems are in these else if statement and are colored Red. else if (isupper(character)){ 1) Pointer to non-const type 'NSString *' with no explicit ownership NSString **classOrProtocolName = (isParsingProtocolName ? protocolName : className); 2) Passing address of non-local object to __autoreleasing parameter for write back i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), classOrProtocolName); isParsingProtocolName = NO; }else if (i == 0){ 3) Passing address of non-local object to __autoreleasing parameter for write back int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), typePrefix); if (advancement == 0) return; i += advancement; }else{ 2) Passing address of non-local object to __autoreleasing parameter for write back i += parseTypeSuffix(unparsedText, strlen(unparsedText), typeSuffix); } You could rewrite the above code like this: else if (isupper(character)){ NSString *classOrProtocolName; i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), classOrProtocolName); if (isParsingProtocolName) protocolName = classOrProtocolName; else className = classOrProtocolName; isParsingProtocolName = NO; }else if (i == 0){ NSString* localTypePrefix; int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), localTypePrefix); typePrefix = localTypePrefix; if (advancement == 0) return; i += advancement; }else{ NSString* localTypeSuffix; i += parseTypeSuffix(unparsedText, strlen(unparsedText), localTypeSuffix); typeSuffix = localTypeSuffix; } Regards, Ken Why did you changed the source code? The aspect is correct but the problem was ARC that I solved all of them. Also I tried your solution at the first time that I got stuck but ARC complains about it. I used __strong and it'a ok now. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Clang File not found - in cocoa app
I'm coding an app that generates document. For generating document of XML i used the NSXMLParser and for generating document of source code i used libclang. If you want to know more I can help you to find how to use libclang for accomplish the same task as me. Because you are curious I want to describe a little more. Before compiling to object code, the compiler front end builds an internal representation of the program. It's called IR. Well, you can use some part of this process such as CXCursor , clang_getCursorSpelling, and clang_getCursorkind to accomplish your task as I did. Note that I solved my problem. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSInvocation's getArgument setReurnValue question
Hi there, I used - getArgument:atIndex: method but it gives me error. I don't know what's the problem. I used this as below: if ([component isEqualToString: @class]) { 1) id arg; 2) [invocation getArgument: arg atIndex: i + 2]; 3) [self class:arg]; } The error is this: NSInvocation's getArgument is not safe to be used with an object with ownership other than __unsafe_unretained. The error is colored Red. And also I used -setReturnValue: and it gives me two errors. [invocation setReturnValue: self]; The first is: NSInvocation's setReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained. The second is: Sending 'DocHTMLElement *const __strong *' to parameter of type 'void *' changes retain/release properties of pointer. The error is colored Red. So Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Problems converting to ARC
Hi there, I want to convert my code to ARC but this problems doesn't let me to do this. I read the errors but I couldn't do nothing. All the problems are in these else if statement and are colored Red. else if (isupper(character)){ 1) Pointer to non-const type 'NSString *' with no explicit ownership NSString **classOrProtocolName = (isParsingProtocolName ? protocolName : className); 2) Passing address of non-local object to __autoreleasing parameter for write back i += parseClassOrProtocolName(unparsedText, strlen(unparsedText), classOrProtocolName); isParsingProtocolName = NO; }else if (i == 0){ 3) Passing address of non-local object to __autoreleasing parameter for write back int advancement = parseTypePrefix(unparsedText, strlen(unparsedText), typePrefix); if (advancement == 0) return; i += advancement; }else{ 2) Passing address of non-local object to __autoreleasing parameter for write back i += parseTypeSuffix(unparsedText, strlen(unparsedText), typeSuffix); } Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Clang File not found - in cocoa app
Hi there, I used clang in my cocoa app but it doesn't find Clang/Index.h. The error is File not found. I linked to clang but again it doesn't find it. Anybody knows what's the problem. Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dynamic Creation
Ability to create instances of classes that did not exist at the time an app was compiled and dynamically load and link new class at runtime. How to implement it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
What is the meaning of idMyProtocol?
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Accessors
Technique for funneling all access to an objects properties at runtime. As you know we can use accessors that @property declared but the question is there when you create an objects at runtime how to create accessors for them. How to implement it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Archiving and Unarchiving dynamic objects at runtime
Used to copy or store a group of interrelated dynamic objects at runtime. How to implement it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Associative Storage
Organizes data and keys so that data can be quickly and easily accessed used the corresponding keys at runtime based on dynamic objects. How to implement it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Flyweight
1- Reduce storage requirements 2- Stand-Ins for other objects How to implement it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Facade
1- Provide a simple interface to a complex subsystem. 2- Limit coupling. How to implement them? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Proxies and Forwarding
1- Allow message to be sent to an objector that is separated from the message's sender by time or space. 2- Forwarding simplifies the capture of messages as invocations so that they can be resent, delayed, repeated, stored, or altered How to implement them? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dynamic Object, How to implement B-Tree in Objective-c, Archiving on each B-Tree node
Hello How to create dynamic object based on user request and then how to insert it in a B-Tree and then how to archive/unarchive this tree. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to use NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, NSManagedObject
Hello I want to use these classes in my app but I don't want to use it in Core Data. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to create a dynamic object - The question is mark than it please read full text
The question is here that how to create a dynamic object. But keep it in mind and let's expand it. Each object has several instance variable and several method. How to add to a dynamic object instance variable and method? And then how to forward the message and use method? And how to generate relationship based on user choice. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to create OODBSM's database engine in Objective-C cocoa?
Please note that my database is Object Oriented Database management system. I work on it so much and I got something interesting. First of all I implemented B-Tree but now days the problem is how to add dynamic object with it's instance variable to a binary tree. I want to give you an example for clarity: For instance we have our database and user write this as SQl command: Create Table exampleTable ( StrignObject first name IntegerObject age FloatObject salary ); Insert into exampleTable (christ, 19, 500$); Insert into exampleTable (Joanna, 19, 500$); … The problem is because every object use Archiving mechanism to save themselves on disk how to forward message to each object. The methods are -initWithCoder: and encodeWithCoder:. Another problem is what is table? Another question is how to implement relationship. And so on. Any suggestions are welcomed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com