本文整理汇总了C++中CreateError函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateError函数的具体用法?C++ CreateError怎么用?C++ CreateError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateError函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateError
void Extension::SendBinaryToClient(int Subchannel)
{
if (Subchannel > 255 || Subchannel < 0)
CreateError("Error: Subchannel invalid; it must be between 0 and 255.");
else if (!ThreadData.Client)
CreateError("Error: Send Binary to Client was called without a Client being selected.");
else if (ThreadData.Client->IsClosed)
CreateError("Error: Send Binary to Client was called with a closed Client.");
else
ThreadData.Client->Send(Subchannel, SendMsg, SendMsgSize, 2);
if (AutomaticallyClearBinary)
ClearBinaryToSend();
}
示例2: CreateError
unsigned int Extension::UnsignedByte(int Index)
{
if (Index < 0)
{
CreateError("Could not read from received binary, index less than 0.");
return 0;
}
else if (ThreadData.ReceivedMsg.Size - Index < sizeof(unsigned char))
{
CreateError("Could not read from received binary, message is smaller than variable to be read. Check your index.");
return 0;
}
else
return (unsigned int)(*(unsigned char *)(ThreadData.ReceivedMsg.Content+Index));
}
示例3: ParseMacro
/* Parse a macro */
VyObject ParseMacro(VyParseTree* code){
/* Parse the function arguments */
VyParseTree* args = GetListData(code, 1);
int numArguments = 0;
char* error = NULL;
Argument** arguments = ParseFunctionArguments(args, &numArguments, &error);
if(error != NULL){
return ToObject(CreateError(error, code));
}
/* Take the rest of the expressions in the lambda as code */
VyParseTree* exprList = MakeListTree();
int i;
for(i = 2; i < ListTreeSize(code); i++){
AddToList(exprList, GetListData(code, i));
}
/* Take variables from the current function scope and the local scope */
Scope* funcScope = GetCurrentFunctionScope();
Scope* localScope = GetLocalScope();
/* Make sure the local scope isn't the global scope */
if(localScope == GetGlobalScope()) {
localScope = NULL;
}
/* Merge the two scopes to get the current function scope */
Scope* closureScope = MergeScopes(funcScope, localScope);
/* Create the function from the data gathered */
VyMacro** mac = CreateMacro(arguments, numArguments, exprList, closureScope);
return ToObject(mac);
}
示例4: SecureZeroMemory
int TCPSocket::Connect(const char *ip, unsigned port)
{
if (connected || !bound)
return -1;
NetAddress remote;
SecureZeroMemory(&remote, sizeof(remote));
remote.sin_family = AF_INET;
remote.sin_port = htons(port);
remote.sin_addr.s_addr = inet_addr(ip);
int ret = connect(socket, (sockaddr*)&remote, sizeof(remote));
if (ret == SOCKET_ERROR) {
if ( !blocking && WSAGetLastError() == WSAEWOULDBLOCK )
{
struct timeval time;
time.tv_sec = 0;
time.tv_usec = 0;
//if ( select( 0, socket, socket, NULL, &time ) )
return ret; // would have blocked
}
Error er = CreateError(Error::E_SocketError);
throw er;
}
connected = true;
return 0;
}
示例5: AddToSend
void Extension::AddString(char * String)
{
if (String)
AddToSend(String, strlen(String) + 1);
else
CreateError("Adding string failed: pointer was null.");
}
示例6: WSAStartup
// Returns 0 for success, WSAGetLastError() otherwise.
int NetAPI_::Init()
{
if (init)
return 0;
// initialze winsock
int ret = WSAStartup(MAKEWORD(2,2), &wsData);
if (ret) {
Error er = CreateError(Error::E_NetworkInit);
throw er;
}
// Save local IP address for later convience.
localIP = inet_ntoa(*(in_addr*)*gethostbyname("")->h_addr_list);
init = true;
Config config( "..\\Data\\Config.txt" );\
unsigned low = config.range_.low_;
unsigned high = config.range_.high_;
while (low <= high)
udp_ports.push_back(udp_port(low++,false));
return 0;
}
示例7: CreateError
ICCItem *CCodeChain::CreateParseError (int iLine, const CString &sError)
// CreateParseError
//
// Utility for creating a parse error
{
return CreateError(strPatternSubst(CONSTLIT("Line %d: %s"), iLine, sError));
}
示例8: CreateError
bool Extension::YouAreChannelMaster()
{
if (!ThreadData.Channel)
{
CreateError("Error, You Are Channel Master condition called without valid channel being selected.");
return false;
}
return ThreadData.Channel->IsChannelMaster();
}
示例9: main
int main(int argc,char **argv)
{
PetscErrorCode ierr;
PetscInitialize(&argc,&argv,(char*)0,help);
ierr = PetscPrintf(PETSC_COMM_SELF,"This is a contrived example to test floating pointing\n");CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_SELF,"It is not a true error.\n");CHKERRQ(ierr);
ierr = PetscPrintf(PETSC_COMM_SELF,"Run with -fp_trap to catch the floating point error\n");CHKERRQ(ierr);
ierr = CreateError(0.0);CHKERRQ(ierr);
return 0;
}