当前位置: 首页>>代码示例>>C++>>正文


C++ CreateError函数代码示例

本文整理汇总了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();
}
开发者ID:SortaCore,项目名称:MMF2Exts,代码行数:14,代码来源:Actions.cpp

示例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));
}
开发者ID:SortaCore,项目名称:MMF2Exts,代码行数:15,代码来源:Expressions.cpp

示例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);	
}
开发者ID:BillyBuggy,项目名称:experiments,代码行数:34,代码来源:Macro.c

示例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;
}
开发者ID:WestleyArgentum,项目名称:cs260-last2,代码行数:29,代码来源:NetAPI.cpp

示例5: AddToSend

void Extension::AddString(char * String)
{
    if (String)
        AddToSend(String, strlen(String) + 1);
    else
        CreateError("Adding string failed: pointer was null.");
}
开发者ID:SortaCore,项目名称:MMF2Exts,代码行数:7,代码来源:Actions.cpp

示例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;
}
开发者ID:WestleyArgentum,项目名称:cs260-last2,代码行数:26,代码来源:NetAPI.cpp

示例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));
	}
开发者ID:gmoromisato,项目名称:Dev,代码行数:9,代码来源:Link.cpp

示例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();
}
开发者ID:ksunwen,项目名称:MMF2Exts,代码行数:10,代码来源:Conditions.cpp

示例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;
}
开发者ID:00liujj,项目名称:petsc,代码行数:10,代码来源:ex3.c


注:本文中的CreateError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。