mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
fix Chinese comment encoding error
This commit is contained in:
parent
01c00acd3e
commit
a41082bc7e
@ -83,7 +83,7 @@ int main(int argc, char* argv[])
|
||||
j2c.setCheckDefault(tars::TC_Common::lower(option.getValue("check-default")) == "false"?false:true);
|
||||
try
|
||||
{
|
||||
//<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tars<EFBFBD><EFBFBD>ͷ
|
||||
// 是否可以以tars开头
|
||||
g_parse->setTars(option.hasParam("with-tars"));
|
||||
g_parse->setHeader(option.getValue("header"));
|
||||
|
||||
|
@ -343,7 +343,7 @@ string Tars2C::generateH(const StructPtr &pPtr, const string& namespaceId) const
|
||||
s << TAB << "Int32 (*writeTo)( const "<<sStructName<<"*, TarsOutputStream *);" << endl;
|
||||
s << TAB << "Int32 (*readFrom)( "<<sStructName<<"*, TarsInputStream *);" << endl;
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 定义成员变量
|
||||
vector<TypeIdPtr>& member = pPtr->getAllMemberPtr();
|
||||
for (size_t j = 0; j < member.size(); j++)
|
||||
{
|
||||
@ -374,7 +374,7 @@ string Tars2C::generateC(const StructPtr &pPtr, const string& namespaceId) const
|
||||
ostringstream s;
|
||||
string sStructName = namespaceId + "_" + pPtr->getId();
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 定义成员变量
|
||||
vector<TypeIdPtr>& member = pPtr->getAllMemberPtr();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -463,7 +463,7 @@ string Tars2C::generateC(const StructPtr &pPtr, const string& namespaceId) const
|
||||
for (size_t j = 0; j < member.size(); j++)
|
||||
{
|
||||
BuiltinPtr bPtr = BuiltinPtr::dynamicCast(member[j]->getTypePtr());
|
||||
//stringֵҪת<EFBFBD><EFBFBD>
|
||||
// stringֵ 值要转义
|
||||
if (bPtr && bPtr->kind() == Builtin::KindString)
|
||||
{
|
||||
s << TAB << "this->" << member[j]->getId() << " = JString_new();" << endl;
|
||||
@ -537,7 +537,7 @@ string Tars2C::generateC(const StructPtr &pPtr, const string& namespaceId) const
|
||||
for (size_t j = 0; j < member.size(); j++)
|
||||
{
|
||||
BuiltinPtr bPtr = BuiltinPtr::dynamicCast(member[j]->getTypePtr());
|
||||
//stringֵҪת<EFBFBD><EFBFBD>
|
||||
// string 值要转义
|
||||
if (bPtr && bPtr->kind() == Builtin::KindString)
|
||||
{
|
||||
if (member[j]->hasDefault())
|
||||
@ -758,7 +758,7 @@ StructPtr Tars2C::findStruct(const ContextPtr &pPtr,const string &id)
|
||||
{
|
||||
string sid = id;
|
||||
|
||||
//<EFBFBD>ڵ<EFBFBD>ǰnamespace<EFBFBD>в<EFBFBD><EFBFBD><EFBFBD>
|
||||
// 在当前namespace中查找
|
||||
vector<NamespacePtr> namespaces = pPtr->getNamespaces();
|
||||
for (size_t i = 0; i < namespaces.size(); i++)
|
||||
{
|
||||
|
@ -24,29 +24,29 @@
|
||||
using namespace tars;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>tars<EFBFBD><EFBFBD><EFBFBD><EFBFBD>c<EFBFBD>ļ<EFBFBD>
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Proxy<EFBFBD><EFBFBD>Servant
|
||||
* 根据tars生成c文件
|
||||
* 包括结构的编解码以及生成Proxy和Servant
|
||||
*/
|
||||
class Tars2C
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成
|
||||
* @param file
|
||||
*/
|
||||
void createFile(const string &file);
|
||||
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Ŀ¼
|
||||
* 设置生成文件的目录
|
||||
*
|
||||
*/
|
||||
void setBaseDir(const std::string & sPath) { m_sBaseDir = sPath; }
|
||||
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵ
|
||||
* 设置是否检查默认值
|
||||
*
|
||||
* @author kevintian (2010-10-8)
|
||||
*
|
||||
@ -54,11 +54,11 @@ public:
|
||||
*/
|
||||
void setCheckDefault(const bool bCheck) { m_bCheckDefault = bCheck; }
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//下面是编解码的源码生成
|
||||
protected:
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>͵Ľ<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成某类型的解码源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -66,7 +66,7 @@ protected:
|
||||
string writeTo(const TypeIdPtr &pPtr,const string& namespaceId = "") const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>͵ı<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成某类型的编码源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -89,10 +89,10 @@ protected:
|
||||
*/
|
||||
string displaySimple(const TypeIdPtr &pPtr, bool bSep) const;
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 下面是类型描述的源码生成
|
||||
protected:
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成某类型的字符串描述源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -100,14 +100,14 @@ protected:
|
||||
string tostr(const TypePtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成内建类型的字符串源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
string tostrBuiltin(const BuiltinPtr &pPtr) const;
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>vector<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成vector的字符串描述
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -115,7 +115,7 @@ protected:
|
||||
string tostrVector(const VectorPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>map<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成map的字符串描述
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -123,7 +123,7 @@ protected:
|
||||
string tostrMap(const MapPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ֽṹ<EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成某种结构的符串描述
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -132,7 +132,7 @@ protected:
|
||||
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD>ö<EFBFBD>ٵķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成某种枚举的符串描述
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -140,7 +140,7 @@ protected:
|
||||
string tostrEnum(const EnumPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɽӿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成接口名称
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -150,7 +150,7 @@ protected:
|
||||
|
||||
string toClassName(const TypePtr &pPtr) const;
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成类型变量的解码源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -158,17 +158,17 @@ protected:
|
||||
string decode(const TypeIdPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成类型变量的编码源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
string encode(const TypeIdPtr &pPtr) const;
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>h<EFBFBD><EFBFBD>c<EFBFBD>ļ<EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 以下是h和c文件的具体生成
|
||||
protected:
|
||||
/**
|
||||
* <EFBFBD>ṹ<EFBFBD><EFBFBD>md5
|
||||
* 结构的md5
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -176,7 +176,7 @@ protected:
|
||||
string MD5(const StructPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɽṹ<EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成结构的头文件内容
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -184,7 +184,7 @@ protected:
|
||||
string generateH(const StructPtr &pPtr, const string& namespaceId) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɽṹ<EFBFBD><EFBFBD>cpp<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成结构的cpp文件内容
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -192,7 +192,7 @@ protected:
|
||||
string generateC(const StructPtr &pPtr, const string& namespaceId) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成容器的头文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -200,7 +200,7 @@ protected:
|
||||
string generateH(const ContainerPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cԴ<EFBFBD><EFBFBD>
|
||||
* 生成容器的c源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -208,7 +208,7 @@ protected:
|
||||
string generateCpp(const ContainerPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成参数声明的头文件内容
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -233,7 +233,7 @@ protected:
|
||||
//string generateAsyncResponseCpp(const OperationPtr &pPtr, const string &cn) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cpp<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成参数声明的cpp文件内容
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -241,7 +241,7 @@ protected:
|
||||
string generateCpp(const ParamDeclPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>proxy<EFBFBD><EFBFBD>cpp<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* 生成作操作的proxy的cpp文件内容
|
||||
* @param pPtr
|
||||
* @param cn
|
||||
*
|
||||
@ -250,7 +250,7 @@ protected:
|
||||
string generateCpp(const OperationPtr &pPtr, const string &cn) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>servant<EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成操作的servant的头文件源码
|
||||
* @param pPtr
|
||||
* @param bVirtual
|
||||
*
|
||||
@ -259,7 +259,7 @@ protected:
|
||||
string generateH(const OperationPtr &pPtr, bool bVirtual, const string& interfaceId) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɽӿڵ<EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成接口的头文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -267,7 +267,7 @@ protected:
|
||||
string generateH(const InterfacePtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>Ľӿڵ<EFBFBD>cpp<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生的接口的cpp文件的源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -275,7 +275,7 @@ protected:
|
||||
string generateCpp(const InterfacePtr &pPtr, const NamespacePtr &nPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>ٵ<EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成枚举的头文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -283,7 +283,7 @@ protected:
|
||||
string generateH(const EnumPtr &pPtr, const string& namespaceId) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成常量头文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -291,7 +291,7 @@ protected:
|
||||
string generateH(const ConstPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿռ<EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成名字空间的头文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -299,7 +299,7 @@ protected:
|
||||
string generateH(const NamespacePtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿռ<EFBFBD>cpp<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成名字空间cpp文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -307,7 +307,7 @@ protected:
|
||||
string generateC(const NamespacePtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿռ<EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成名字空间的头文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -315,7 +315,7 @@ protected:
|
||||
void generateH(const ContextPtr &pPtr) const;
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿռ<EFBFBD>cpp<EFBFBD>ļ<EFBFBD>Դ<EFBFBD><EFBFBD>
|
||||
* 生成名字空间cpp文件源码
|
||||
* @param pPtr
|
||||
*
|
||||
* @return string
|
||||
@ -324,7 +324,7 @@ protected:
|
||||
|
||||
/**
|
||||
*
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><EFBFBD>ҽṹ
|
||||
* 根据名字查找结构
|
||||
* @param pPtr
|
||||
* @param id
|
||||
*
|
||||
@ -336,7 +336,7 @@ protected:
|
||||
|
||||
|
||||
/**
|
||||
* <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵ
|
||||
* 是否检查默认值
|
||||
*
|
||||
* @author kevintian (2010-10-8)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user