MCPcopy Create free account
hub / github.com/anjo76/angelscript / GetDeclarationStr

Method GetDeclarationStr

sdk/angelscript/source/as_scriptfunction.cpp:683–841  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

681
682// internal
683asCString asCScriptFunction::GetDeclarationStr(bool includeObjectName, bool includeNamespace, bool includeParamNames) const
684{
685 asCString str;
686
687 // TODO: default arg: Make the declaration with the default args an option
688
689 // Don't add the return type for constructors and destructors
690 if( !(returnType.GetTokenType() == ttVoid &&
691 objectType &&
692 (name == objectType->name || (name.GetLength() > 0 && name[0] == '~') ||
693 name == "$beh0" || name == "$beh2")) )
694 {
695 str = returnType.Format(nameSpace, includeNamespace);
696 str += " ";
697 }
698 if( objectType && includeObjectName )
699 {
700 asCDataType dt = asCDataType::CreateType(objectType, false);
701 str += dt.Format(nameSpace, includeNamespace);
702 str += "::";
703 }
704 else if (funcdefType && funcdefType->parentClass && includeObjectName)
705 {
706 asCDataType dt = asCDataType::CreateType(funcdefType->parentClass, false);
707 str += dt.Format(nameSpace, includeNamespace);
708 str += "::";
709 }
710 else if( includeNamespace && nameSpace->name != "" && !objectType && !(funcdefType && funcdefType->parentClass) )
711 {
712 str += nameSpace->name + "::";
713 }
714 if( name == "" )
715 str += "_unnamed_function_(";
716 else if( name.SubString(0,4) == "$beh" && name.GetLength() == 5 )
717 {
718 if( name[4] == '0' + asBEHAVE_CONSTRUCT )
719 str += objectType->name + "(";
720 else if( name[4] == '0' + asBEHAVE_FACTORY )
721 str += returnType.GetTypeInfo()->name + "(";
722 else if( name[4] == '0' + asBEHAVE_DESTRUCT )
723 str += "~" + objectType->name + "(";
724 else
725 str += name + "(";
726 }
727 else
728 {
729 if (funcType == asFUNC_TEMPLATE)
730 {
731 str += name + "<";
732 for (asUINT t = 0; t < templateSubTypes.GetLength()-1; t++)
733 str += templateSubTypes[t].GetTypeInfo()->name + ",";
734 str += templateSubTypes[templateSubTypes.GetLength() - 1].GetTypeInfo()->name;
735 str += ">(";
736 }
737 else
738 str += name + "(";
739 }
740

Callers 6

PerformFunctionCallMethod · 0.80
CompileFunctionsMethod · 0.80
as_callfunc.cppFile · 0.80

Calls 7

GetTokenTypeMethod · 0.80
SubStringMethod · 0.80
GetTypeInfoMethod · 0.80
GetLengthMethod · 0.45
FormatMethod · 0.45
IsReferenceMethod · 0.45
AddressOfMethod · 0.45

Tested by

no test coverage detected