![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Text; 00005 00006 namespace RoutineAnalyzer 00007 { 00008 class CppWrapperGetRoutine : GetRoutineBase 00009 { 00016 public CppWrapperGetRoutine(string sql) 00017 : base(sql) 00018 { 00019 } 00020 00025 public override string GetDeclaration() 00026 { 00027 StringBuilder builder = new StringBuilder(); 00028 builder.Append("__declspec(dllexport) void "); 00029 builder.Append(ParseHelper.ConvertUnderscoreToCamelCase(_name)); 00030 builder.Append("("); 00031 foreach (RoutineParamBase param in _params) 00032 { 00033 builder.Append(param.GetDeclaration()); 00034 builder.Append(", "); 00035 } 00036 00037 builder.Append("int* queryId"); 00038 00039 builder.Append(")"); 00040 return builder.ToString(); 00041 } 00042 00043 public override string GetCode() 00044 { 00045 //build the start of the function 00046 StringBuilder builder = new StringBuilder(); 00047 builder.AppendLine(GetDeclaration()); 00048 builder.AppendLine("{"); 00049 00050 //build a call to the C++ implementation, including each parameter 00051 builder.Append(ParseHelper.ConvertUnderscoreToCamelCase(_name)); 00052 builder.Append("("); 00053 foreach (RoutineParamBase param in _params) 00054 { 00055 builder.Append(param.GetPreExecuteCode()); 00056 builder.Append(","); 00057 } 00058 builder.AppendLine(" queryId);"); 00059 00060 //close up the function and return it 00061 builder.AppendLine("}"); 00062 return builder.ToString(); 00063 } 00064 00065 protected override RoutineParamBase CreateRoutineParam(string sql, int index) 00066 { 00067 return new CppGetRoutineParam(sql, index); 00068 } 00069 } 00070 }
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.