If no namespace used do not try to concatenate the namespace

If using ClassGenerator for non namespace classes no methods are found inside classes, as the classname check fails always.
Only try to remove the namespace from classname if there is a namespace and add backslash for non namespace classes

For non-namespace classes this substr/strlen algorithm removed the first character of the classname.
The slash is needed when generating namespace classes, which use non-namespace classes.