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


C++ parseMessage函数代码示例

本文整理汇总了C++中parseMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ parseMessage函数的具体用法?C++ parseMessage怎么用?C++ parseMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parseMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseMessage

char* NTServerMessage::RecvFromServer()
{
    if (fCacheData == PR_TRUE)
    {
        fCacheData = PR_FALSE;
        return parseMessage(msgbuff);
    }
    if (fPendingRead_ == PR_TRUE)
    {
        fPendingRead_ = PR_FALSE;
        if (lpOverlapped_ == NULL)
            return 0;           // Error
        DWORD dwBytesRead = 0;
        BOOL fRetVal = GetOverlappedResult(msgFd_,
                                           lpOverlapped_,
                                           &dwBytesRead,
                                           TRUE); // blocking
        if (!fRetVal)
            return 0;           // Error
        if (msgbytesRead == 0)  // ReadFile might have returned 0
            msgbytesRead = dwBytesRead;
        return parseMessage(msgbuff);
    }
    char* buffer = msgbuff;
    int bufferLen = sizeof(msgbuff);
    DWORD dwBytesRead = 0;

    // Blocking Call
    if (ReadFile(msgFd_, buffer, bufferLen, &msgbytesRead, NULL) == TRUE)
    {
        return parseMessage(buffer);
    }
    return 0;
}
开发者ID:OldsSourcesBackups,项目名称:Heliod-Web-Server,代码行数:34,代码来源:ntservermessage.cpp

示例2: buffer

/** read new data from the socket
 *
 * @return
 *
 * History:
 * - 2010/08/03: STEELJ  - Initial Version.
  */
void CAdChannel::readData()
{
  if (m_socket->state() != QAbstractSocket::ConnectedState)
  {
    return;
  }
  if (m_unprocessedData.size() > 0)
  {
    QByteArray data = m_socket->readAll();
    m_unprocessedData.append(data);
    QBuffer buffer(&m_unprocessedData);
    buffer.open(QIODevice::ReadOnly);
    while (fullMessageAvailable(buffer))
    {
      parseMessage(buffer);
    }
  }
  else
  {
    while (m_socket && fullMessageAvailable(*m_socket))
    {
      parseMessage(*m_socket);
    }
    if (m_socket && m_socket->bytesAvailable() > 0)
    {
      QByteArray data = m_socket->readAll();
      m_unprocessedData.append(data);
    }
  }
}
开发者ID:ElJeffe,项目名称:AdServerSimulator,代码行数:37,代码来源:adchannel.cpp

示例3: stream

bool
HeapSnapshot::init(JSContext* cx, const uint8_t* buffer, uint32_t size)
{
  if (!nodes.init() || !frames.init())
    return false;

  ArrayInputStream stream(buffer, size);
  GzipInputStream gzipStream(&stream);

  // First is the metadata.

  protobuf::Metadata metadata;
  if (!parseMessage(gzipStream, metadata))
    return false;
  if (metadata.has_timestamp())
    timestamp.emplace(metadata.timestamp());

  // Next is the root node.

  protobuf::Node root;
  if (!parseMessage(gzipStream, root))
    return false;

  // Although the id is optional in the protobuf format for future proofing, we
  // can't currently do anything without it.
  if (NS_WARN_IF(!root.has_id()))
    return false;
  rootId = root.id();

  // The set of all node ids we've found edges pointing to.
  NodeIdSet edgeReferents(cx);
  if (NS_WARN_IF(!edgeReferents.init()))
    return false;

  if (NS_WARN_IF(!saveNode(root, edgeReferents)))
    return false;

  // Finally, the rest of the nodes in the core dump.

  while (StreamHasData(gzipStream)) {
    protobuf::Node node;
    if (!parseMessage(gzipStream, node))
      return false;
    if (NS_WARN_IF(!saveNode(node, edgeReferents)))
      return false;
  }

  // Check the set of node ids referred to by edges we found and ensure that we
  // have the node corresponding to each id. If we don't have all of them, it is
  // unsafe to perform analyses of this heap snapshot.
  for (auto range = edgeReferents.all(); !range.empty(); range.popFront()) {
    if (NS_WARN_IF(!nodes.has(range.front())))
      return false;
  }

  return true;
}
开发者ID:Klaudit,项目名称:cyberfox,代码行数:57,代码来源:HeapSnapshot.cpp

示例4: newMessage

void QTwitchChat::connect()
{
    if( channelName_ == "" )
        return;

    if( isShowSystemMessages() )
        emit newMessage( new QChatMessage( TWITCH_SERVICE, TWITCH_USER, "Connecting to " + channelName_ + "...", "", this ) );

    if( socket_)
    {
        if( socket_->state() == QAbstractSocket::ConnectedState )
            return;
        /*else
            reconnect();*/
    }

    socket_ = new QTcpSocket();

    QObject::connect( socket_, SIGNAL( connected() ), this, SLOT( onConnected() ) );
    QObject::connect( socket_, SIGNAL( readyRead() ), this, SLOT( parseMessage() ) );
    QObject::connect( socket_, SIGNAL( error( QAbstractSocket::SocketError ) ), this, SLOT( onSocketError() ) );

    //QObject::connect( socket_, SIGNAL( disconnected() ), this, SLOT( reconnect() ) );

    socket_->connectToHost( DEFAULT_TWITCH_CHAT_HOST_NAME, DEFAULT_TWITCH_CHAT_PORT_NUMBER );
}
开发者ID:ChunHungLiu,项目名称:BroChat,代码行数:26,代码来源:qtwitchchat.cpp

示例5: preParse

MessagePattern &
MessagePattern::parse(const UnicodeString &pattern, UParseError *parseError, UErrorCode &errorCode) {
    preParse(pattern, parseError, errorCode);
    parseMessage(0, 0, 0, UMSGPAT_ARG_TYPE_NONE, parseError, errorCode);
    postParse();
    return *this;
}
开发者ID:00zhengfu00,项目名称:third_party,代码行数:7,代码来源:messagepattern.cpp

示例6: sendFileTo

void sendFileTo(char* message, int to, int from){
	char *file_contents;
	long input_file_size;
	//remove \n at end of string
	message[strlen(message)-1]=0;
	FILE* input_file = fopen(message,"r");

	if(input_file != NULL){
		fseek(input_file, 0, SEEK_END);
		input_file_size = ftell(input_file);
		rewind(input_file);
		file_contents = malloc(input_file_size * (sizeof(char)));
		fread(file_contents, sizeof(char), input_file_size, input_file);
		fclose(input_file);

		char* buf;
		int size = input_file_size+sizeof(message)+MAX_USR_LENGTH + 30;
		char tmp[size];
		memset(tmp,0,size);
		strcat(tmp,"ENDOFFILE");
		strcat(tmp," ; ");
		strcat(tmp,file_contents);

		buf = parseMessage(tmp,strlen(tmp));
		printf("N%s\n",buf);
		printf("Envoie au client : %d\n",to);
		if (Writeline(ctx.socketFd[to], buf, strlen(buf)+1) < 0){
			debugTrace("Message issue");
		}
		else {
			debugTrace("Message sent\n");
		}
		free(buf);
	}
}
开发者ID:platonisation,项目名称:server,代码行数:35,代码来源:server.c

示例7: mVersion

LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens):
	mVersion(0.f),
	mMessages()
{
	// the version number should be the first thing in the file
	if (tokens.want("version"))
	{
		// version number
		std::string vers_string = tokens.next();
		mVersion = (F32)atof(vers_string.c_str());
		
		llinfos << "### Message template version " << mVersion << "  ###" << llendl;
	}
	else
	{
		llerrs << "Version must be first in the message template, found "
			   << tokens.next() << llendl;
	}

	while(LLMessageTemplate * templatep = parseMessage(tokens))
	{
		if (templatep->getDeprecation() != MD_DEPRECATED)
		{
			mMessages.push_back(templatep);
		}
	}

	if(!tokens.wantEOF())
	{
		llerrs << "Expected end of template or a message, instead found: "
			   << tokens.next() << " at " << tokens.line() << llendl;
	}
}
开发者ID:OS-Development,项目名称:VW.Meerkat,代码行数:33,代码来源:llmessagetemplateparser.cpp

示例8: elapsedTimeoutReceived

int NetworkedClient::receive(int timeout){
	char buf[NETWORKED_MODULE_RECEIVE_BUFFER_SIZE];
	Address remote;
	int size=socket.recvFrom(remote, buf, NETWORKED_MODULE_RECEIVE_BUFFER_SIZE, timeout);
//	std::cout << __PRETTY_FUNCTION__ << "begin" << std::endl;
	if (remote.getHost()==0xffffffff){
//		std::cout << __PRETTY_FUNCTION__ << " broadcast HOST" << std::endl;
		elapsedTimeoutReceived();
		return 0;
	} else {
		PeerInfoMap::iterator peer=peers.find(remote);
		if (peer==peers.end()){
			PeerInfo pinfo;
			peers.insert(std::make_pair(remote,pinfo));
			peer=peers.find(remote);
			std::cout << "registering supplier HOST= " <<remote.getHost() << " port=" << remote.getPort() <<std::endl;
		}
		gettimeofday(&peer->second.lastPingTime, 0);
		socket.sendTo(remote,"",0);
//		std::cout << "Parsing" << std::endl;
		if (size)
			parseMessage(size, buf);
		return size;
	}
}
开发者ID:francescoriccio,项目名称:r_coordination_ros,代码行数:25,代码来源:networkedmodule.cpp

示例9: printf

void *reader(void *info) {
    int i = 0;
    clientNode *thisClient = (clientNode*) info;
    char recvLine[MAXLINE + 1];
    char **lines = NULL;
    ssize_t  n;

    printf("[Uma conexao aberta]\n");

    //Loop de leitura de mensagens
    while ((n=read(thisClient->socket, recvLine, MAXLINE)) > 0) {
        recvLine[n] = '\0';
        printf("[Cliente %d enviou:] ", thisClient->socket);
        if ((fputs(recvLine, stdout)) == EOF) {
            perror("fputs :( \n");
            exit(6);
        }

        lines = getLines(recvLine); //Quebra a mensagem em linhas
        for(i = 0; lines[i] != NULL; i++) {
            parseMessage(lines[i], thisClient);
        }

        free(lines);
    }

    delNode(thisClient);
    printf("[Uma conexao fechada]\n");

    return NULL;
}
开发者ID:duiliofelix,项目名称:MAC448-EP1,代码行数:31,代码来源:clientList.c

示例10: if

void YSE::SOUND::implementationObject::sync() {
  if (head.load() == nullptr) {
    objectStatus = OBJECT_DONE;
    
    // sound head is destructed, so stop and remove
    if (status_dsp != SS_STOPPED || status_dsp != SS_WANTSTOSTOP) {
      status_dsp = SS_WANTSTOSTOP;
    }
    else if (status_dsp == SS_STOPPED) {
      objectStatus = OBJECT_RELEASE;
    }
    return;
  }

  messageObject message;
  while (messages.try_pop(message)) {
    parseMessage(message);
  }

  // sync dsp values
  currentVolume_upd = currentVolume_dsp;
  head.load()->time = currentFilePos;
  head.load()->volume = currentVolume_dsp;
  status_upd = status_dsp;
  head.load()->status = status_upd;
}
开发者ID:Ajj2,项目名称:yse-soundengine,代码行数:26,代码来源:soundImplementation.cpp

示例11: sendAll

void sendAll(unsigned char* message, int actuel){

	int i = 0;
	char* buf;
	int size = strlen((char*)message)+MAX_USR_LENGTH + 20;
	char tmp[size];
	for(i=0;i<LISTENQ;i++){
		memset(tmp,0,size);
		if(ctx.socketFd[i] != -1  && (i != actuel)){
			strcat(tmp,usrDatas[actuel].name);
			strcat(tmp," : ");
			strcat(tmp,(char*)message);
			buf = parseMessage(tmp,strlen(tmp));
			printf("Envoie au client : %d\n",i);
			if (Writeline(ctx.socketFd[i], buf, strlen(buf)+1) < 0){
				debugTrace("Message issue");
			}
			else {
				debugTrace("Message sent\n");
			}
			free(buf);
		}

	}
}
开发者ID:platonisation,项目名称:server,代码行数:25,代码来源:server.c

示例12: appendToJson

string TgTypeParser::parseMessage(const Message::Ptr& object) const {
	if (!object) {
		return "";
	}
	string result;
	result += '{';
	appendToJson(result, "message_id", object->messageId);
	appendToJson(result, "from", parseUser(object->from));
	appendToJson(result, "date", object->date);
	appendToJson(result, "chat", parseChat(object->chat));
	appendToJson(result, "forward_from", parseUser(object->forwardFrom));
	appendToJson(result, "forward_date", object->forwardDate);
	appendToJson(result, "reply_to_message", parseMessage(object->replyToMessage));
	appendToJson(result, "text", object->text);
	appendToJson(result, "audio", parseAudio(object->audio));
	appendToJson(result, "document", parseDocument(object->document));
	appendToJson(result, "photo", parseArray(&TgTypeParser::parsePhotoSize, object->photo));
	appendToJson(result, "sticker", parseSticker(object->sticker));
	appendToJson(result, "video", parseVideo(object->video));
	appendToJson(result, "contact", parseContact(object->contact));
	appendToJson(result, "location", parseLocation(object->location));
	appendToJson(result, "new_chat_participant", parseUser(object->newChatParticipant));
	appendToJson(result, "left_chat_participant", parseUser(object->leftChatParticipant));
	appendToJson(result, "new_chat_title", object->newChatTitle);
	appendToJson(result, "new_chat_photo", parseArray(&TgTypeParser::parsePhotoSize, object->newChatPhoto));
	appendToJson(result, "delete_chat_photo", object->deleteChatPhoto);
	appendToJson(result, "group_chat_created", object->groupChatCreated);
	appendToJson(result, "caption", object->caption);
	result.erase(result.length() - 1);
	result += '}';
	return result;
}
开发者ID:flode,项目名称:tgbot-cpp,代码行数:32,代码来源:TgTypeParser.cpp

示例13: onSysMsg

DWORD IRCMsgThread::Run() {
	onSysMsg(L"IRCMsgThread Start");
	iStatus=IRC_NORMAL;
	IRCMsgQueue.clear();
	unsigned int bufferlen;
	std::string recvstring,msg,umsg; //TwitchIRC use MultiByte
	while(!bKillThread ) { 	
		//Receive First
		bufferlen=0;		
		memset(buffer, 0, DEFAULT_BUFLEN);
		if(TheSocketPtr->recv_data((char*)buffer, bufferlen)) { //Disconnected
			iStatus=IRC_DISCONNECTED;
			break;
		}
		recvstring=std::string(buffer,bufferlen);
		//onDebugMsg(L"%ls",from_utf8(recvstring).c_str());
		if(recvstring.compare(":tmi.twitch.tv NOTICE * :Login unsuccessful\r\n")==0 || //Twitch
		   recvstring.compare(":tmi.twitch.tv NOTICE * :Error encountered while attempting login\r\n")==0 ){ //Justin
			Sleep(100); //Wait for logging
			onSysMsg(L"Login unsuccessful");
			iStatus=IRC_WRONGLOGIN;
			break;
		}//else if(recvstring.compare(":[email protected] PRIVMSG #append :break\r\n")==0){TheSocketPtr->CloseSocket();}
		//Basic parsing: make it into a string, check for PING, if not-send for further parsing.
		std::stringstream recvstr(recvstring);
		while( recvstr.tellg() < bufferlen ) {
			std::getline(recvstr,msg,'\n');
			//Old Style
			//:[email protected] PRIVMSG #ptken :what song is this ?
			//PING LAG1967655232
			//int colon_pos = (int)msg.find(":");
			//if (msg[0] != ':' && colon_pos > 0) msg=msg.substr(colon_pos); //if an irc message begins with " ", then trim the leading spaces   
			//
			//New Style
			// @color=#FF4500;display-name=Gm470520;emotes=;mod=0;room-id=47281189;subscriber=1;turbo=0;user-id=24255667;user-type= :[email protected] PRIVMSG #tetristhegrandmaster3 :這片到底在沖三小w
			int at_pos = (int)msg.find("@");
			if (msg[0] != '@' && at_pos > 0) msg=msg.substr(at_pos); //if an irc message begins with " ", then trim the leading spaces   
			if (msg[msg.length()-1]=='\r') msg=msg.substr(0,msg.length()-1); //trim the CR: getline only trim the LF		                   
			log(from_utf8(msg), LogType(RECEIVE)); //Although log file is in UTF8....using vswprintf
			//Ping Check
			umsg=msg.substr(0,5);
			ToUpperString(umsg);
            if (!umsg.compare("PING ")) sendRaw( L"PONG " + from_utf8(msg.substr(5)) ); // respond to PINGs //Reply Immediately 
			//Then parse the message
            else parseMessage(from_utf8(msg)); 
		}
		Sleep(100);
	}
	//Determine the reason to break the loop.
	if(!bKillThread) {
		if(iStatus==IRC_DISCONNECTED) onSysMsg(L"IRCMsgThread: Disconnect Unexpectedly");
		if(iStatus==IRC_WRONGLOGIN) onSysMsg(L"IRCMsgThread: Wrong Login Information");
	}
	else iStatus=IRC_CLOSED;
	//onDebugMsg(L"[Last Buffer]%ls",from_utf8(recvstring).c_str());
	onSysMsg(L"IRCMsgThread Close");
	thread=0;
	return 0;
}
开发者ID:Appendko,项目名称:NicoCommentPlugin,代码行数:59,代码来源:IRCMsgThread.cpp

示例14: render

void render(BelaContext *context, void *userData)
{
    // receive OSC messages, parse them, and send back an acknowledgment
    while (oscServer.messageWaiting()){
        parseMessage(oscServer.popMessage());
        oscClient.queueMessage(oscClient.newMessage.to("/osc-acknowledge").add(5).add(4.2f).add(std::string("OSC message received")).end());
    }
}
开发者ID:acarabott,项目名称:Bela,代码行数:8,代码来源:render.cpp

示例15: parseHeader

CRemoteControlMessage::CRemoteControlMessage(alt_u8* pMessage, int iLength)
{
    parseHeader(pMessage, iLength);
    if(m_bValid)
    {
        m_bValid = false;
        parseMessage(pMessage+4, iLength-4);
    }}
开发者ID:fjanssen,项目名称:Car2X,代码行数:8,代码来源:CRemoteControlMessage.cpp


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