Cleaned code, removed smc.h, fixed typos
List :
- Cleaned code (by removing smc.h and transferring missing typedefs into SMCWrapper.h, by wiping useless macros, by reordering typedefs, by having all includes in the same place - the header, by normalising carriage returns and indentation)
- Corrected some silly mistakes (SMCWrapper.m includes its header, fixed a segfaulting typo that took me an hour to find)
- stringRepresentationForBytes:...:toNSString now actually returns a value
- Added methods to request raw hex values (e.g. 68 65 6c 6c 6f) from SMCVals
- Added FAILURE_REPRESENTING_STRUCT in SMCState enum, to be used when the SMCVal couldn't be represented (through stringRepresentation... methods). (NOT YET IN USE)
Bump ?
Take a look at the 'SMCWrapper' branch in http://github.com/perfaram/xline, this is where most improvements I made here come from.
Just asking, why are we passing NSStrings by reference anyways ? Couldn't we just return the NSString (which is usually easier for the programmer who uses SMCWrapper) and have the error passed by ref ? Or have a @property for errors, making the whole thing very much easier, especially knowing that we are going to have more detailed errors ?
Cleaner list of options, in which Error stands either for NSError** or SMCState_t * :
-(BOOL) readKey:(NSString *)key intoString:(NSString **)str;(current)-(NSString*) readKey:(NSString *)key withError:(Error **)err;(passing byref)-(NSString*) readKey:(NSString *)key;(setting @property in method)
I vote for the last one.
After working a bit on other projects, I changed my mind. The current version seems good. BUT, to have more precision, we could also have a @property [...] error, so that it doesn't break with current version, but we can have additional data for debugging.