示例#1
0
///////////////////////////////////////////////////////////////
// 读StringList结点
bool ScanParamXML::ReadStringListNode( IXMLDOMNode *const pTheNode, VectorOfString &vStr )
{
	if( NULL == pTheNode )
	{
		return false;
	}
	try
	{
		vStr.clear();		// 初始化输出参数

		_variant_t varVal = 0;
		IXMLDOMNode *pIpSeedNode;
		for( pTheNode->get_firstChild( &pIpSeedNode ); pIpSeedNode != NULL; 
			pIpSeedNode->get_nextSibling( &pIpSeedNode  ) )
		{			
			varVal = ReadNodeText( pIpSeedNode );
			
			//cout << "Seed IP: " << _bstr_t( varVal.bstrVal ).operator char *() << endl;
			
			vStr.push_back( _bstr_t( varVal.bstrVal ).operator char *() );
		}
	}
	catch( ... )
	{
		return false;
	}
	return true;
}
void XPosixEnvironmentVariables::GetKeys(VectorOfString& outKeys, VError& outError)
{
    outError = VE_OK;
    
	for (sLONG i = 0; environ[i] != NULL; ++i)
	{
		const char* var = environ[i];

		const char* s = strchr(var, '=');

		const sLONG varLength = s ? s - var : strlen(var);

		VString key(var, varLength, VTC_UTF_8);

		outKeys.push_back(key);
	}
}