Example #1
0
bool CTemplateParserApp::EvaluateKeywords(SgmlElement *pKeywords)
{
   bool success = true;

   SgmlElement *pKeyword = pKeywords->Find("keyword");

   while (pKeyword && success)
   {
      const char *szName = pKeyword->GetValue("name");
      const char *szEval = pKeyword->GetValue("evaluate");
      const char *szContent = pKeyword->GetParameter();
      
      if (szName)
      {
         bool bEvaluate = false;
         if (szEval)
            bEvaluate = (stricmp("true", szEval) == 0);
         if (!bEvaluate)
         {
            ///AddKeyword(szName, szContent);
            /// replaced by

            CString csContent;
            csContent = szContent;
            // The content may contain keywords
            LTextBuffer ltbContent(csContent);
            ReplaceAllKeywords(ltbContent);
            csContent = ltbContent.GetString();
            AddKeyword(szName, csContent);
         }
         else
         {
            LTextBuffer lText(szContent);
            ReplaceAllKeywords(lText);
            LExpressionParser lExp(lText.GetString());
            int value = 0;
            success = lExp.EvaluateInt(&value);
            if (!success)
            {
               // TPERR_EVAL_ERROR
               // config.xml: Beim Evaluieren des Schlüsselwortes '%s' ist ein Fehler aufgetreten.
               // config.xml: An error occurred while evaluating the keyword '%s'.
               CString csKeyword(szName);
               MakeErrorMessage(TPERR_EVAL_ERROR, csKeyword);
            }
            if (success)
            {
               CString csReplace;
               csReplace.Format(_T("%d"), value);
               AddKeyword(szName, csReplace);
            }
         }
      }
      
      pKeyword = pKeyword->GetNext();
   }

   return success;
}
Example #2
0
HRESULT 
recChannel_t::set_window_title(char * newTitle)
{
     __CONTEXT("recChannel_t::set_window_title");
	int hr = 0;
	
	memset(title,0,100);
	strcpy(title,newTitle);
	IVideoWindow * pWindow = NULL;
	pGraph->QueryInterface(IID_IVideoWindow,(void **) &pWindow);
	wchar_t wtext[100];
	lText(wtext,title);
	pWindow->put_Caption(wtext);
	pWindow->Release();

	return hr;

}