Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #43 from xBlackCat/master
Browse files Browse the repository at this point in the history
Support Thrift v0.9.2 compiller
  • Loading branch information
fkorotkov committed Mar 15, 2016
2 parents 1d847a8 + ad27747 commit adc593c
Show file tree
Hide file tree
Showing 31 changed files with 389 additions and 24 deletions.
4 changes: 0 additions & 4 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions intellij-thrift.iml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/grammar" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="plugin-jps" />
<orderEntry type="library" scope="RUNTIME" name="thrift-jps" level="project" />
</component>
</module>
</module>

15 changes: 15 additions & 0 deletions plugin-jps/src/com/intellij/plugins/thrift/config/target/Cpp.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,19 @@ public class Cpp extends Generator {
* Use full include paths in generated files.
*/
private boolean includePrefix;
/**
* Omits generation of default operators ==, != and <
*/
private boolean noDefaultOperators;

protected Cpp() {
super(GeneratorType.Cpp);
}

public void setNoDefaultOperators(boolean noDefaultOperators) {
this.noDefaultOperators = noDefaultOperators;
}

public void setCobStyle(boolean cobStyle) {
this.cobStyle = cobStyle;
}
Expand Down Expand Up @@ -86,6 +94,10 @@ public boolean isIncludePrefix() {
return includePrefix;
}

public boolean isNoDefaultOperators() {
return noDefaultOperators;
}

@Override
protected Collection<String> getOptions() {
Collection<String> line = new ArrayList<String>();
Expand All @@ -107,6 +119,9 @@ protected Collection<String> getOptions() {
if (includePrefix) {
line.add("include_prefix");
}
if (noDefaultOperators) {
line.add("no_default_operators");
}
return line;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ public class Delphi extends Generator {
* Enable TypeRegistry, allows for creation of struct, union and container instances by interface or TypeInfo()
*/
private boolean registerTypes;
/**
* Name TConstants classes after IDL to reduce ambiguities
*/
private boolean constprefix;
/**
* Enable and use processing events in the generated code.
*/
private boolean events;
/**
* Enable XMLDoc comments for Help Insight etc.
*/
private boolean xmldoc;

protected Delphi() {
super(GeneratorType.Delphi);
Expand All @@ -30,6 +42,18 @@ public boolean isRegisterTypes() {
return registerTypes;
}

public boolean isConstprefix() {
return constprefix;
}

public boolean isEvents() {
return events;
}

public boolean isXmldoc() {
return xmldoc;
}

public void setAnsiStrBinary(boolean ansiStrBinary) {
this.ansiStrBinary = ansiStrBinary;
}
Expand All @@ -38,6 +62,18 @@ public void setRegisterTypes(boolean registerTypes) {
this.registerTypes = registerTypes;
}

public void setConstprefix(boolean constprefix) {
this.constprefix = constprefix;
}

public void setEvents(boolean events) {
this.events = events;
}

public void setXmldoc(boolean xmldoc) {
this.xmldoc = xmldoc;
}

@Override
protected Collection<String> getOptions() {
ArrayList<String> line = new ArrayList<String>();
Expand All @@ -47,6 +83,15 @@ protected Collection<String> getOptions() {
if (registerTypes) {
line.add("register_types");
}
if (constprefix) {
line.add("constprefix");
}
if (events) {
line.add("events");
}
if (xmldoc) {
line.add("xmldoc");
}
return line;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.intellij.plugins.thrift.config.target;

import java.util.ArrayList;
import java.util.Collection;

/**
* 17.07.2015 16:32
*
* @author xBlackCat
*/
public class Erlang extends Generator {
protected Erlang() {
super(GeneratorType.Erlang);
}

/**
* Output files retain naming conventions of Thrift 0.9.1 and earlier.
*/
private boolean legacynames;

public void setLegacynames(boolean legacynames) {
this.legacynames = legacynames;
}

public boolean isLegacynames() {
return legacynames;
}

@Override
protected Collection<String> getOptions() {
ArrayList<String> line = new ArrayList<String>();
if (legacynames) {
line.add("legacynames");
}
return line;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public Delphi create() {
return new Delphi();
}
},
Erlang("erl", "/icons/types/erlang.png"),
Erlang("erl", "/icons/types/erlang.png") {
@Override
public Generator create() {
return new Erlang();
}
},
Go("go", "/icons/types/go.png") {
@Override
public Go create() {
Expand Down Expand Up @@ -75,6 +80,8 @@ public Javascript create() {
return new Javascript();
}
},
JSON("json", "/fileTypes/json.png"),
LUA("lua", "/icons/types/lua.png"),
OCaml("ocaml", "/icons/types/ocaml.png"),
Perl("perl", "/icons/types/perl.png"),
PHP("php", "/icons/types/php-icon.png") {
Expand Down
15 changes: 15 additions & 0 deletions plugin-jps/src/com/intellij/plugins/thrift/config/target/Go.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public class Go extends Generator {
* Override thrift package import path (default:git.apache.org/thrift.git/lib/go/thrift)
*/
private String thriftImport;
/**
* Package name (default: inferred from thrift file name)
*/
private String packageName;

protected Go() {
super(GeneratorType.Go);
Expand All @@ -30,6 +34,10 @@ public void setThriftImport(String thriftImport) {
this.thriftImport = thriftImport;
}

public void setPackage(String packageName) {
this.packageName = packageName;
}

public String getPackagePrefix() {
return packagePrefix;
}
Expand All @@ -38,6 +46,10 @@ public String getThriftImport() {
return thriftImport;
}

public String getPackageName() {
return packageName;
}

@Override
protected Collection<String> getOptions() {
ArrayList<String> line = new ArrayList<String>();
Expand All @@ -47,6 +59,9 @@ protected Collection<String> getOptions() {
if (thriftImport != null) {
line.add("thrift_import=" + thriftImport);
}
if (packageName != null) {
line.add("package=" + packageName);
}
return line;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public void setExceptions(boolean exceptions) {
this.exceptions = exceptions;
}

public boolean isExceptions() {
return exceptions;
}

@Override
protected Collection<String> getOptions() {
if (exceptions) {
Expand Down
45 changes: 45 additions & 0 deletions plugin-jps/src/com/intellij/plugins/thrift/config/target/Java.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ public class Java extends Generator {
* Use TreeSet/TreeMap instead of HashSet/HashMap as a implementation of set/map.
*/
private boolean sortedContainers;
/**
* Convert underscored_accessor_or_service_names to camelCase.
*/
private boolean fullcamel;
/**
* Generated structures are Parcelable.
*/
private boolean android;
/**
* Data objects will not be allocated, but existing instances will be used (read and write).
*/
private boolean reuseObjects;

protected Java() {
super(GeneratorType.Java);
Expand Down Expand Up @@ -70,6 +82,18 @@ public void setSortedContainers(boolean sortedContainers) {
this.sortedContainers = sortedContainers;
}

public void setFullcamel(boolean fullcamel) {
this.fullcamel = fullcamel;
}

public void setAndroid(boolean android) {
this.android = android;
}

public void setReuseObjects(boolean reuseObjects) {
this.reuseObjects = reuseObjects;
}

public boolean isBeans() {
return beans;
}
Expand Down Expand Up @@ -98,6 +122,18 @@ public boolean isSortedContainers() {
return sortedContainers;
}

public boolean isFullcamel() {
return fullcamel;
}

public boolean isAndroid() {
return android;
}

public boolean isReuseObjects() {
return reuseObjects;
}

@Override
protected Collection<String> getOptions() {
ArrayList<String> line = new ArrayList<String>();
Expand All @@ -122,6 +158,15 @@ protected Collection<String> getOptions() {
if (sortedContainers) {
line.add("sorted_containers");
}
if (fullcamel) {
line.add("fullcamel");
}
if (android) {
line.add("android");
}
if (reuseObjects) {
line.add("reuse-objects");
}
return line;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public class Javascript extends Generator {
* Generate node.js compatible code.
*/
private boolean node;
/**
* Generate TypeScript definition files
*/
private boolean ts;

protected Javascript() {
super(GeneratorType.JavaScript);
Expand All @@ -30,6 +34,10 @@ public void setNode(boolean node) {
this.node = node;
}

public void setTs(boolean ts) {
this.ts = ts;
}

public boolean isJquery() {
return jquery;
}
Expand All @@ -38,6 +46,10 @@ public boolean isNode() {
return node;
}

public boolean isTs() {
return ts;
}

@Override
protected Collection<String> getOptions() {
ArrayList<String> line = new ArrayList<String>();
Expand All @@ -48,6 +60,9 @@ protected Collection<String> getOptions() {
if (node) {
line.add("node");
}
if (ts) {
line.add("ts");
}

return line;
}
Expand Down
Loading

0 comments on commit adc593c

Please sign in to comment.