//-------------------- Implementation ------------------------- ReactorEndpoint::ReactorEndpoint (const char* szAddress, EndpointType epType) { m_nMaxConnections = 32; int rc = ParseAddress (szAddress, epType); OS_Abort_If ((rc<0)); m_type = epType; m_bAutoReconnect = (m_type == ReactorEndpoint::EPTYPE_CLIENT); }
int ParseConfigWrite(TCHAR *pszLine, CONFIG *pConfig) { int iStart; int iLen; OPTIONS sO; TCHAR *pszAddress; TCHAR *pszData; struct CommandWrite *pCW; DWORD dwAddress; unsigned char *pucBytes; int iBytes; int iTokenArgument; iStart = GetToken(0, pszLine, &iLen, NULL); if (-1 == iStart) return -1; ZeroMemory(&sO, sizeof(OPTIONS)); sO.bVersion = TRUE; iStart = ParseOptions(pszLine+iStart, &sO); if (-1 == iStart) return -1; if (!TwoRemainingTokens(pszLine+iStart, &pszAddress, &pszData)) return -1; dwAddress = ParseAddress(pszAddress); free(pszAddress); iTokenArgument = ParseArgument(pszData, &pucBytes, &iBytes); free(pszData); if (0 == dwAddress || 0 == iBytes || (TOK_HEX != iTokenArgument && TOK_ASCII != iTokenArgument && TOK_UNICODE != iTokenArgument)) return -1; pCW = malloc(sizeof(struct CommandWrite)); if (NULL == pCW) return -1; pCW->address = dwAddress; pCW->len = iBytes; pCW->bytes = pucBytes; pCW->pszVersion = sO.pszVersion; return AddStatement(pConfig, COMMAND_WRITE, pCW); }
Person *ParsePerson(TXMLNode *node, Int_t id) { TString firstName, lastName; char gender = ' '; Date *date; Address *address; for ( ; node; node = node->GetNextNode()) { if (node->GetNodeType() == TXMLNode::kXMLElementNode) { // Element Node if (strcmp(node->GetNodeName(), "FirstName") == 0) firstName = node->GetText(); if (strcmp(node->GetNodeName(), "LastName") == 0) lastName = node->GetText(); if (strcmp(node->GetNodeName(), "Gender") == 0) gender = node->GetText()[0]; if (strcmp(node->GetNodeName(), "DateOfBirth") == 0) date = ParseDate(node->GetChildren()); if (strcmp(node->GetNodeName(), "Address") == 0) address = ParseAddress(node->GetChildren()); } } return new Person(id, firstName, lastName, gender, date, address); }
Configuration::Configuration() : arguments() { ParseAddress(DefaultValue::address, endPoint); }