代码拉取完成,页面将自动刷新
//xlang Source, Name:CPlusplusProp.xcsm
//Date: Thu Nov 08:57:52 2018
class CPlusplusProp : ProjectPropInterface{
ProjectPropInterface _bridge = nilptr;
public void setBridge(ProjectPropInterface ppi){
_bridge = ppi;
}
public void makefile(@NotNilptr IBuilder builder, String projectDir){
String [] margs = {"make"};
Process _mprocess = new Process("/usr/bin/make", margs);
_mprocess.setWorkDirectory(projectDir);
String statusoutput = "/usr/bin/make";
builder.OutputText(statusoutput + "\n", 0);
try{
if (_mprocess.create(Process.StdOut | Process.RedirectStdErr)){
Utils.readForProcess(builder, _mprocess);
_mprocess.waitFor(-1);
}else{
builder.OutputText("\nmakefile失败.\n", 0);
}
}catch(Exception e){
String str = e.getMessage();
builder.OutputText("\n错误:" + str + "\n", 0);
}
}
public void onProjectSettingChange(Project object)override{
if (_bridge != nilptr){
_bridge.onProjectSettingChange(object);
}
}
String getFileExtensionFilter(){
if (_bridge != nilptr){
return _bridge.getFileExtensionFilter();
}
return "C/C++ 源文件(*.cpp *.c *.cc *.cxx *.hpp *.h *.mm);;";
}
public IXPlugin getXPlugin()override{
if (_bridge != nilptr){
return _bridge.getXPlugin();
}
return nilptr;
}
public @NotNilptr String map_variable(Project object,@NotNilptr Configure configure,@NotNilptr String text) override{
if (_bridge != nilptr){
return _bridge.map_variable(object, configure, text);
}
return text;
}
public String getDebuggeeDescription()override{
if (_bridge != nilptr){
return _bridge.getDebuggeeDescription();
}
return nilptr;
}
public String generateMake(Project object, Configure configure)override{
if (_bridge != nilptr){
return _bridge.generateMake(object, configure);
}
return nilptr;
}
public void Run(IBuilder builder, Project proj, Configure conf) override {
if (_bridge != nilptr){
_bridge.Run(builder, proj, conf);
}
}
public void customDebug(){
if (_bridge != nilptr){
_bridge.customDebug();
}
}
public JsonArray getExternLibs(Configure cfg){
if (_bridge != nilptr){
return _bridge.getExternLibs(cfg);
}
return nilptr;
}
public bool build(IBuilder builder, Project object, Configure configure, Object param) override {
if (_bridge != nilptr){
return _bridge.build(builder, object, configure, param);
}
return false;
}
public void cleanup(IBuilder builder, Project object, Configure configure) override {
if (_bridge != nilptr){
_bridge.cleanup(builder, object, configure);
}
}
public JsonObject getProperitiesConfigure(){
if (_bridge != nilptr){
return _bridge.getProperitiesConfigure();
}
return nilptr;
}
public IXIntelliSense allocIntelliSense(Project project, Configure cfg){
if (_bridge != nilptr){
return _bridge.allocIntelliSense(project, cfg);
}
return nilptr;
}
public String [] generatorCompArgs(Project object, Configure configure, String sourfile)override{
if (_bridge != nilptr){
return _bridge.generatorCompArgs(object, configure, sourfile);
}
return nilptr;
}
public bool createNormalFileToProject(@NotNilptr WizardLoader loader,@NotNilptr String projectName,@NotNilptr String projectDir,@NotNilptr String uuid, Project ownProject, bool addToProject, String ext){
XPlatform.mkdir(projectDir);
try{
String extsion = projectName.findExtension();
String filename ;
if (extsion.length() != 0){
filename = projectName;
}else{
filename = projectName + ext;
}
String date = String.formatDate("%c", _system_.currentTimeMillis());
String preContent = "";
if (uuid.equals("c480d6ff-10ba-483a-8a76-927ea81a2403")){
preContent = "// " + projectName + ".cpp created by xstudio \n//" + date;
}
if (uuid.equals("1ea14692-4c49-4b95-9cdb-97f49e068497")){
preContent = "// " + projectName + ".c created by xstudio \n//" + date;
}
if (uuid.equals("c4279b52-c866-4c90-bdd1-5780e721dbc7")){
String appdir = String.formatPath(_system_.getAppDirectory().appendPath("xnl"), false);
preContent = ".SUFFIXES:.c .o\n\nCC=gcc\n\n"
+ "CPPFLAGS=-I " + appdir + "\n" +
"SRCS=<add sourcefiles here>\n\nOBJS=$(SRCS:.c=.o)\n\nEXEC=<type target here>\n\n" +
"start: $(OBJS)\n\t$(CC) $(CPPFLAGS) -shared -o $(EXEC) $(OBJS) -fPIC\n\n.c.o:\n\t$(CC) -fPIC -Wall -o $@ -c $<\n\nclean:\n\trm -rf $(EXEC) $(OBJS)\n";
}
String destProj = String.formatPath(projectDir.appendPath(filename), false);
if (XPlatform.existsSystemFile(destProj)){
if (QMessageBox.Question("注意", destProj + " 该文件已经存在, <a style=\"color:#ffff0000\">继续建立新文件将改写原有文件?</a>", QMessageBox.Ok | QMessageBox.No, QMessageBox.Ok) == QMessageBox.No){
return false;
}
}
FileOutputStream fos = new FileOutputStream(destProj);
fos.write(preContent.getBytes());
fos.close();
loader.openTextFile(destProj);
if (addToProject && ownProject != nilptr){
return ownProject.addSource(destProj);
}
return true;
}catch(Exception e){
}
return false;
}
public bool create(@NotNilptr WizardLoader loader,@NotNilptr String projectName,@NotNilptr String projectDir, @NotNilptr String uuid, Project ownProject, bool isAddToProject, String userType) override {
if (uuid.equals("c480d6ff-10ba-483a-8a76-927ea81a2403")){
return createNormalFileToProject(loader, projectName, projectDir, uuid, ownProject, isAddToProject, ".cpp");
}
if (uuid.equals("1ea14692-4c49-4b95-9cdb-97f49e068497")){
return createNormalFileToProject(loader, projectName, projectDir, uuid, ownProject, isAddToProject, ".c");
}
if (uuid.equals("c4279b52-c866-4c90-bdd1-5780e721dbc7")){
return createNormalFileToProject(loader, projectName, projectDir, uuid, ownProject, isAddToProject, "");
}
if (_bridge != nilptr){
return _bridge.create(loader,projectName, projectDir, uuid,ownProject, isAddToProject, userType);
}
return false;
}
public void stopRun() override {
if (_bridge != nilptr){
_bridge.stopRun();
}
}
public ICompileInfo parseOutputLine(@NotNilptr QScintilla sci,int position, int line, String text)override{
if (_bridge != nilptr){
return _bridge.parseOutputLine(sci,position, line, text);
}
return nilptr;
}
public void debugRun(IBuilder builder, Project proj, Configure conf) override {
if (_bridge != nilptr){
_bridge.debugRun(builder, proj, conf);
}
}
public String getValue(Project object, Configure configure, String key) override {
if (_bridge != nilptr){
return _bridge.getValue(object, configure, key);
}
return "";
}
public bool setValue(Project object, Configure configure, String key, String value) override {
if (_bridge != nilptr){
return _bridge.setValue(object, configure, key, value);
}
return false;
}
public Stream createDebugPipe(String host, int ip) override {
if (_bridge != nilptr){
return _bridge.createDebugPipe(host, ip);
}
return nilptr;
}
public Stream getDebugPipe(){
if (_bridge != nilptr){
return _bridge.getDebugPipe();
}
return nilptr;
}
public void stopBuild(IBuilder builder)override{
if (_bridge != nilptr){
_bridge.stopBuild(builder);
}
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。