Some fiddling to keep the CPP bits in sync as well.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6397 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -10,11 +10,6 @@ import com.threerings.presents.tools.InvocationTask.ServiceMethod;
|
||||
|
||||
public class CPPArgBuilder
|
||||
{
|
||||
public CPPArgBuilder(boolean ignoreFirst)
|
||||
{
|
||||
_ignoreFirst = ignoreFirst;
|
||||
}
|
||||
|
||||
public String getArguments (ServiceMethod meth)
|
||||
{
|
||||
return getArguments(meth, "");
|
||||
@@ -24,11 +19,11 @@ public class CPPArgBuilder
|
||||
{
|
||||
StringBuilder buf = new StringBuilder(prefix);
|
||||
Type[] ptypes = meth.method.getGenericParameterTypes();
|
||||
for (int ii = _ignoreFirst ? 1 : 0; ii < ptypes.length; ii++) {
|
||||
for (int ii = 0; ii < ptypes.length; ii++) {
|
||||
if (buf.length() > 0) {
|
||||
buf.append(", ");
|
||||
}
|
||||
buf.append(CPPUtil.getCPPType(ptypes[ii])).append(" arg").append(ii);
|
||||
buf.append(CPPUtil.getCPPType(ptypes[ii])).append(" arg").append(ii+1);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
@@ -36,9 +31,9 @@ public class CPPArgBuilder
|
||||
public List<String> getArgumentNames (ServiceMethod meth)
|
||||
{
|
||||
Type[] ptypes = meth.method.getGenericParameterTypes();
|
||||
List<String> args = Lists.newArrayListWithCapacity(ptypes.length - 1);
|
||||
for (int ii = 1; ii < ptypes.length; ii++) {
|
||||
args.add("arg" + ii);
|
||||
List<String> args = Lists.newArrayListWithCapacity(ptypes.length);
|
||||
for (int ii = 0; ii < ptypes.length; ii++) {
|
||||
args.add("arg" + (ii+1));
|
||||
}
|
||||
return args;
|
||||
}
|
||||
@@ -47,7 +42,7 @@ public class CPPArgBuilder
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Type[] ptypes = meth.method.getGenericParameterTypes();
|
||||
for (int ii = _ignoreFirst ? 1 : 0; ii < ptypes.length; ii++) {
|
||||
for (int ii = 0; ii < ptypes.length; ii++) {
|
||||
if (buf.length() > 0) {
|
||||
buf.append(", ");
|
||||
}
|
||||
@@ -61,11 +56,9 @@ public class CPPArgBuilder
|
||||
{
|
||||
Type[] ptypes = meth.method.getGenericParameterTypes();
|
||||
List<String> args = Lists.newArrayListWithCapacity(ptypes.length);
|
||||
for (int ii = _ignoreFirst ? 1 : 0; ii < ptypes.length; ii++) {
|
||||
args.add(new CPPType(ptypes[ii]).getAsStreamable("arg" + ii));
|
||||
for (int ii = 0; ii < ptypes.length; ii++) {
|
||||
args.add(new CPPType(ptypes[ii]).getAsStreamable("arg" + (ii+1)));
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
protected final boolean _ignoreFirst;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GenCPPServiceTask extends GenServiceTask
|
||||
ctx.put("namespace", Joiner.on("::").join(namespaces));
|
||||
ctx.put("methods", MethodDescriptor.from(sdesc.methods));
|
||||
ctx.put("listeners", sdesc.listeners);
|
||||
ctx.put("argbuilder", new CPPArgBuilder(true));
|
||||
ctx.put("argbuilder", new CPPArgBuilder());
|
||||
|
||||
Set<String> includes = Sets.newTreeSet();
|
||||
Set<String> implIncludes = Sets.newTreeSet();
|
||||
|
||||
@@ -24,9 +24,10 @@ public class MethodDescriptor
|
||||
|
||||
public MethodDescriptor(ServiceMethod methodSource) {
|
||||
methodName = methodSource.method.getName();
|
||||
vectorArguments = new CPPArgBuilder(false).getArgumentsFromVector(methodSource);
|
||||
arguments = new CPPArgBuilder(false).getArguments(methodSource);
|
||||
clientArguments = new CPPArgBuilder(true).getArguments(methodSource, "Shared<presents::PresentsClient> client");
|
||||
serviceArguments = new CPPArgBuilder(true).getServiceArguments(methodSource);
|
||||
vectorArguments = new CPPArgBuilder().getArgumentsFromVector(methodSource);
|
||||
arguments = new CPPArgBuilder().getArguments(methodSource);
|
||||
clientArguments = new CPPArgBuilder().getArguments(
|
||||
methodSource, "Shared<presents::PresentsClient> client");
|
||||
serviceArguments = new CPPArgBuilder().getServiceArguments(methodSource);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user