In c2d (obj-c), i have a array with nsstrings, and use NSClassFromString to get class from nsstring dynamic, how to get this in c++?
thanks.
In c2d (obj-c), i have a array with nsstrings, and use NSClassFromString to get class from nsstring dynamic, how to get this in c++?
thanks.
Wow, I saw James Chen was reviewing the source from 2 different contribution of CCClassFromString, this morning. But I don’t know his progress.
In C++, there’s no reflection mechanic, and I guess this class implementation would be either very tricky, or very stupid.
Is it solved now ?
If not then is there any alternative to get classes from corresponding name in CCString object?
You can to get the C++ class name as follow.
#include
#include
namespace util {
template
char* className() {
int status;
return abi::__cxa_demangle(typeid(T).name(), 0, 0, &status);
}
}
Sorry, I miss read the question. No easy way to get class from the string.
Objective-c is internally c/c**, am I right? Does that mean the NSClassFromString is implemented in c/c** by Apple?
bagus flyer wrote:
Objective-c is internally c/c**, am I right? Does that mean the NSClassFromString is implemented in c/c** by Apple?
I’m not quite sure. In a logic context Objective-C is defined as a super set of C**, so the NSClassFromString set of functions not necessarily must be in the C** subset.