Merge pull request #122 from westonli/master

在resetDefautlt函数中增加枚举值的初始化
This commit is contained in:
ruanshudong 2020-09-13 14:25:41 +08:00 committed by GitHub
commit 69a330d361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -844,6 +844,19 @@ string Tars2Cpp::generateH(const StructPtr& pPtr, const string& namespaceId) con
s << TAB << member[j]->getId() << " = " << member[j]->def() << ";" << endl;
}
}
else
{ //没有提供初始值才会走到这里,提供枚举类型初始化值
EnumPtr ePtr = EnumPtr::dynamicCast(member[j]->getTypePtr());
if (ePtr)
{
vector<TypeIdPtr>& eMember = ePtr->getAllMemberPtr();
if (eMember.size() > 0)
{
string sid = ePtr->getSid();
s << TAB << member[j]->getId() << " = " << sid.substr(0, sid.find_first_of("::")) << "::" << eMember[0]->getId() << ";" << endl;
}
}
}
}
DEL_TAB;

View File

@ -401,6 +401,8 @@ int TC_TCPClient::recv(char *sRecvBuffer, size_t &iRecvLen)
{
return iRet;
}
_epoller->mod(_socket.getfd(), 0, EPOLLIN);
int iRetCode = _epoller->wait(_timeout);
@ -456,6 +458,8 @@ int TC_TCPClient::recvBySep(string &sRecvBuffer, const string &sSep)
return iRet;
}
_epoller->mod(_socket.getfd(), 0, EPOLLIN);
while(true)
{
int iRetCode = _epoller->wait(_timeout);
@ -518,6 +522,8 @@ int TC_TCPClient::recvAll(string &sRecvBuffer)
{
return iRet;
}
_epoller->mod(_socket.getfd(), 0, EPOLLIN);
while(true)
{