Beispiel #1
0
bool RecogScenario::LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool)
{
	const apr_xml_attr* pAttr;
	for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) 
	{
		if(strcasecmp(pAttr->name,"enable") == 0)
		{
			m_Recognize = atoi(pAttr->value) > 0;
		}
		else if(strcasecmp(pAttr->name,"content-type") == 0)
		{
			m_ContentType = pAttr->value;
		}
		else if(strcasecmp(pAttr->name,"content-location") == 0)
		{
			m_Content = LoadFileContent(pAttr->value,pool);
		}
		else if(strcasecmp(pAttr->name,"audio-source") == 0)
		{
			m_AudioSource = pAttr->value;
		}
	}

	return true;
}
Beispiel #2
0
bool LoadDescriptorFile(const char* filename, google::protobuf::FileDescriptorSet& fds)
{
	unsigned int size = 0;
	auto content = LoadFileContent(filename, size);


	if (!fds.ParseFromArray(content, size))
	{
		delete content;
		return false;
	}

	delete content;
	return true;

}
Beispiel #3
0
bool RecogScenario::LoadDefineGrammar(const apr_xml_elem* pElem, apr_pool_t* pool)
{
	const apr_xml_attr* pAttr;
	for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) 
	{
		if(strcasecmp(pAttr->name,"enable") == 0)
		{
			m_DefineGrammar = atoi(pAttr->value) > 0;
		}
		else if(strcasecmp(pAttr->name,"content-type") == 0)
		{
			m_ContentType = pAttr->value;
		}
		else if(strcasecmp(pAttr->name,"content-location") == 0)
		{
			m_Content = LoadFileContent(pAttr->value,m_ContentLength,pool);
		}
	}
	return true;
}
bool SynthScenario::LoadSpeak(const apr_xml_elem* pElem, apr_pool_t* pool)
{
	const apr_xml_attr* pAttr;
	for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) 
	{
		if(strcasecmp(pAttr->name,"enable") == 0)
		{
			m_Speak = atoi(pAttr->value) > 0;
		}
		else if(strcasecmp(pAttr->name,"content-type") == 0)
		{
			m_ContentType = pAttr->value;
		}
		else if(strcasecmp(pAttr->name,"content-location") == 0)
		{
			m_Content = LoadFileContent(pAttr->value,pool);
		}
	}

	return true;
}