![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
Inheritance diagram for RoutineAnalyzer::CppWrapperSetRoutine:Public Member Functions | |
| CppWrapperSetRoutine (string sql) | |
| override string | GetCode () |
| Should implement creation of the defintion. | |
| override string | GetDeclaration () |
| Should implement creation of the declaration. | |
Protected Member Functions | |
| override RoutineParamBase | CreateRoutineParam (string sql, int index) |
| Implements generating of objects for parameters, these will be children of RoutineParamBase. | |
Definition at line 8 of file CppWrapperSetRoutine.cs.
| RoutineAnalyzer::CppWrapperSetRoutine::CppWrapperSetRoutine | ( | string | sql | ) | [inline] |
Definition at line 10 of file CppWrapperSetRoutine.cs.
: base(sql)
{
}
| override RoutineParamBase RoutineAnalyzer::CppWrapperSetRoutine::CreateRoutineParam | ( | string | sql, |
| int | index | ||
| ) | [inline, protected, virtual] |
| sql | |
| index |
Implements RoutineAnalyzer::RoutineBase.
Definition at line 72 of file CppWrapperSetRoutine.cs.
{
return new CppWrapperSetRoutineParam(sql, index);
}
| override string RoutineAnalyzer::CppWrapperSetRoutine::GetCode | ( | ) | [inline, virtual] |
Implements RoutineAnalyzer::RoutineBase.
Definition at line 32 of file CppWrapperSetRoutine.cs.
References RoutineAnalyzer::RoutineBase::_name, RoutineAnalyzer::RoutineBase::_params, RoutineAnalyzer::ParseHelper::ConvertUnderscoreToCamelCase(), GetDeclaration(), RoutineAnalyzer::RoutineParamBase::GetParameter(), and RoutineAnalyzer::RoutineParamBase::GetPreExecuteCode().
{
//build the start of the function
StringBuilder builder = new StringBuilder();
builder.AppendLine(GetDeclaration());
builder.AppendLine("{");
//before calling the C++ implementation, we may need to convert parameters
foreach (RoutineParamBase param in _params)
{
string preExecCode = param.GetPreExecuteCode();
if (!string.IsNullOrEmpty(preExecCode))
builder.AppendLine(preExecCode);
}
//build a call to the C++ implementation, including each parameter
builder.Append(ParseHelper.ConvertUnderscoreToCamelCase(_name));
builder.Append("(");
foreach (RoutineParamBase param in _params)
{
builder.Append(param.GetParameter());
if (_params.IndexOf(param) < _params.Count - 1)
builder.Append(",");
}
builder.AppendLine(");");
//after calling the C++ implementation, we may need to convert return parameters
//before calling the C++ implementation, we may need to convert parameters
foreach (RoutineParamBase param in _params)
{
string preExecCode = param.GetPreExecuteCode();
if (!string.IsNullOrEmpty(preExecCode))
builder.AppendLine(preExecCode);
}
//close up the function and return it
builder.AppendLine("}");
return builder.ToString();
}
| override string RoutineAnalyzer::CppWrapperSetRoutine::GetDeclaration | ( | ) | [inline, virtual] |
Implements RoutineAnalyzer::RoutineBase.
Definition at line 15 of file CppWrapperSetRoutine.cs.
References RoutineAnalyzer::RoutineBase::_name, RoutineAnalyzer::RoutineBase::_params, RoutineAnalyzer::ParseHelper::ConvertUnderscoreToCamelCase(), and RoutineAnalyzer::RoutineParamBase::GetDeclaration().
Referenced by GetCode().
{
StringBuilder builder = new StringBuilder();
builder.Append("__declspec(dllexport) void ");
builder.Append(ParseHelper.ConvertUnderscoreToCamelCase(_name));
builder.Append("(");
foreach (RoutineParamBase param in _params)
{
builder.Append(param.GetDeclaration());
if (param != _params.Last<RoutineParamBase>())
builder.Append(", ");
}
builder.Append(")");
return builder.ToString();
}
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.