當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。