mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-03 06:19:37 +00:00
feat[cpp]: compatible field of inside protocol class
This commit is contained in:
@@ -99,6 +99,13 @@ public abstract class GenerateProtocolPath {
|
||||
return protocolPath.replaceAll(StringUtils.PERIOD_REGEX, StringUtils.SLASH);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取协议生成的首字母大写的路径
|
||||
*/
|
||||
public static String getCapitalizeProtocolPath(short protocolId) {
|
||||
return StringUtils.joinWith(StringUtils.SLASH, Arrays.stream(getProtocolPath(protocolId).split(StringUtils.SLASH)).map(it -> StringUtils.capitalize(it)).toArray());
|
||||
}
|
||||
|
||||
public static String getRelativePath(short protocolId, short relativeProtocolId) {
|
||||
// 不是折叠协议的话,protocolPathMap一定是空,这里返回“”,上层会解析为同一个文件下
|
||||
if (CollectionUtils.isEmpty(protocolPathMap)) {
|
||||
@@ -125,13 +132,6 @@ public abstract class GenerateProtocolPath {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取协议生成的首字母大写的路径
|
||||
*/
|
||||
public static String getCapitalizeProtocolPath(short protocolId) {
|
||||
return StringUtils.joinWith(StringUtils.SLASH, Arrays.stream(getProtocolPath(protocolId).split(StringUtils.SLASH)).map(it -> StringUtils.capitalize(it)).toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析协议的路径
|
||||
*
|
||||
|
||||
@@ -143,7 +143,7 @@ public abstract class GenerateCppUtils {
|
||||
|
||||
var protocolOutputPath = StringUtils.format("{}/{}/{}.h"
|
||||
, GenerateCppUtils.protocolOutputPath
|
||||
, GenerateProtocolPath.getCapitalizeProtocolPath(protocolId)
|
||||
, GenerateProtocolPath.getProtocolPath(protocolId)
|
||||
, protocolClazzName);
|
||||
FileUtils.writeStringToFile(new File(protocolOutputPath), protocolTemplate, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user