Beispiel #1
0
void CGUIList::Remove(CStdString aListItemLabel)
{
  EnterCriticalSection(&m_critical);

  if (m_listitems.size() > 0)
  {
    GUILISTITERATOR iterator = m_listitems.begin();
    while (iterator != m_listitems.end())
    {
      if (aListItemLabel.Compare((*iterator)->GetName()) == 0)
      {
        try
        {
          delete *iterator;
        }
        catch (...)
        {
          // OutputDebugString("Unable to free stuff\r\n");
        }

        m_listitems.erase(iterator);
        break;
      }

      iterator++;
    }
  }

  LeaveCriticalSection(&m_critical);
}
Beispiel #2
0
void TestLogger::TestLoggerPassesFilePathToILogger()
{
	CStdString sExpectedFilePath = L"asdf";
	Workshare::Logging::Configuration::SetLogFilePath(sExpectedFilePath.c_str());
	
	MockLogger mock;
	MockILogger* mockILogger = static_cast<MockILogger*>(mock.GetFileLogger());
	assertMessage( sExpectedFilePath.Compare( mockILogger->m_ConfigData.FileLogPath) == 0, _T("Logger should advise ILogger of FileLog path"));
}
Beispiel #3
0
bool IsListnumWithListText(const RTFObject* pObj, RTFfile* pFile, CStdString sListText)
{
	if (pObj->GetType() != rotField)
		return false;

	RTFfield* pField = (RTFfield*) pObj;   
	CStdString sResult = pField->GetResultText().GetData();

	return 0 == sResult.Compare(sListText);
}
Beispiel #4
0
BOOL CObjectEntry::SetDataTypeLongStr(CStdString strDataType)
{
    BOOL oResult(TRUE);

    if(strDataType.Compare("Unknown") == 0) m_DataType = ODT_UNKNOWN;
    else if(strDataType.Compare("Boolean") == 0) m_DataType = ODT_BOOLEAN;
    else if(strDataType.Compare("Signed 8-Bit Integer") == 0) m_DataType = ODT_INT8;
    else if(strDataType.Compare("Signed 16-Bit Integer") == 0) m_DataType = ODT_INT16;
    else if(strDataType.Compare("Signed 32-Bit Integer") == 0) m_DataType = ODT_INT32;
    else if(strDataType.Compare("Signed 64-Bit Integer") == 0) m_DataType = ODT_INT64;
    else if(strDataType.Compare("Unsigned 8-Bit Integer") == 0) m_DataType = ODT_UINT8;
    else if(strDataType.Compare("Unsigned 16-Bit Integer") == 0) m_DataType = ODT_UINT16;
    else if(strDataType.Compare("Unsigned 32-Bit Integer") == 0) m_DataType = ODT_UINT32;
    else if(strDataType.Compare("Unsigned 64-Bit Integer") == 0) m_DataType = ODT_UINT64;
    else if(strDataType.Compare("32-Bit Floating Point") == 0) m_DataType = ODT_FLOAT;
    else if(strDataType.Compare("String") == 0) m_DataType = ODT_STRING;
    else if(strDataType.Compare("Domain") == 0) m_DataType = ODT_DOMAIN;
    else m_DataType = ODT_UNKNOWN;

    return oResult;
}
Beispiel #5
0
BOOL CObjectEntry::SetDataType(CStdString strDataType)
{
    BOOL oResult(TRUE);

    if(strDataType.Compare("Unknown") == 0) m_DataType = ODT_UNKNOWN;
    else if(strDataType.Compare("Boolean") == 0) m_DataType = ODT_BOOLEAN;
    else if(strDataType.Compare("Int8") == 0) m_DataType = ODT_INT8;
    else if(strDataType.Compare("Int16") == 0) m_DataType = ODT_INT16;
    else if(strDataType.Compare("Int32") == 0) m_DataType = ODT_INT32;
    else if(strDataType.Compare("Int64") == 0) m_DataType = ODT_INT64;
    else if(strDataType.Compare("UInt8") == 0) m_DataType = ODT_UINT8;
    else if(strDataType.Compare("UInt16") == 0) m_DataType = ODT_UINT16;
    else if(strDataType.Compare("UInt32") == 0) m_DataType = ODT_UINT32;
    else if(strDataType.Compare("UInt64") == 0) m_DataType = ODT_UINT64;
    else if(strDataType.Compare("Float") == 0) m_DataType = ODT_FLOAT;
    else if(strDataType.Compare("String") == 0) m_DataType = ODT_STRING;
    else if(strDataType.Compare("Domain") == 0) m_DataType = ODT_DOMAIN;
    else m_DataType = ODT_UNKNOWN;

    return oResult;
}
Beispiel #6
0
BOOL CObjectEntry::SetPDOMapping(CStdString strPDOMapping)
{
    BOOL oResult(FALSE);

    if(strPDOMapping.Compare("1") == 0)
    {
        m_oPDOMapping = TRUE;
        oResult = TRUE;
    }
    else
    {
        m_oPDOMapping = FALSE;
        oResult = TRUE;
    }

    return oResult;
}
Beispiel #7
0
void CMainFrame::OnUpdateRenderingSet(CCmdUI* pCmdUI)
{
	CStdString selectedRenderingSet = RenderingSet::GetCurrentRenderingSet();
	// TODO STASH THESE ?? unless updated :)
	std::vector<std::wstring> vecRenderingSets;
	RenderingSet::GetRenderingSetList(vecRenderingSets);

	Ribbon::PopulateRenderingSetList(GetRibbonBar());

	CStdString sItem = Ribbon::GetRenderingSetNameByID(pCmdUI->m_nID);
	if (sItem.IsEmpty() || std::find(vecRenderingSets.begin(), vecRenderingSets.end(), sItem) == vecRenderingSets.end())
	{
		pCmdUI->Enable(FALSE);
	}
	else
	{
		pCmdUI->Enable();
		pCmdUI->SetCheck(sItem.Compare(selectedRenderingSet) == 0);
	}
}
Beispiel #8
0
void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* line, int len, const char* lang)
{
  CStdStringA strUTF8;
  strUTF8.assign(line, len);
  strUTF8.Trim();

  int pos = 0;
  int del_start = 0;
  while ((pos=m_tags->RegFind(strUTF8.c_str(), pos)) >= 0)
  {
    // Parse Tags
    CStdString fullTag = m_tags->GetMatch(0);
    fullTag.ToLower();
    strUTF8.erase(pos, fullTag.length());
    if (fullTag == "<b>")
    {
      m_flag[FLAG_BOLD] = true;
      strUTF8.insert(pos, "[B]");
      pos += 3;
    }
    else if (fullTag == "</b>" && m_flag[FLAG_BOLD])
    {
      m_flag[FLAG_BOLD] = false;
      strUTF8.insert(pos, "[/B]");
      pos += 4;
    }
    else if (fullTag == "<i>")
    {
      m_flag[FLAG_ITALIC] = true;
      strUTF8.insert(pos, "[I]");
      pos += 3;
    }
    else if (fullTag == "</i>" && m_flag[FLAG_ITALIC])
    {
      m_flag[FLAG_ITALIC] = false;
      strUTF8.insert(pos, "[/I]");
      pos += 4;
    }
    else if (fullTag == "</font>" && m_flag[FLAG_COLOR])
    {
      m_flag[FLAG_COLOR] = false;
      strUTF8.insert(pos, "[/COLOR]");
      pos += 8;
    }
    else if (fullTag.Left(5) == "<font")
    {
      int pos2 = 5;
      while ((pos2 = m_tagOptions->RegFind(fullTag.c_str(), pos2)) >= 0)
      {
        CStdString tagOptionName = m_tagOptions->GetMatch(1);
        CStdString tagOptionValue = m_tagOptions->GetMatch(2);
        pos2 += tagOptionName.length() + tagOptionValue.length();
        if (tagOptionName == "color")
        {
          m_flag[FLAG_COLOR] = true;
          CStdString tempColorTag = "[COLOR ";
          if (tagOptionValue[0] == '#')
          {
            tagOptionValue.erase(0, 1);
            tempColorTag += "FF";
          }
          else if( tagOptionValue.size() == 6 )
          {
            bool bHex = true;
            for( int i=0 ; i<6 ; i++ )
            {
              char temp = tagOptionValue[i];
              if( !(('0' <= temp && temp <= '9') ||
                ('a' <= temp && temp <= 'f') ||
                ('A' <= temp && temp <= 'F') ))
              {
                bHex = false;
                break;
              }
            }
            if( bHex ) tempColorTag += "FF";
          }
          tempColorTag += tagOptionValue;
          tempColorTag += "]";
          strUTF8.insert(pos, tempColorTag);
          pos += tempColorTag.length();
        }
      }
    }
    else if (lang && (fullTag.Left(3) == "<p "))
    {
      int pos2 = 3;
      while ((pos2 = m_tagOptions->RegFind(fullTag.c_str(), pos2)) >= 0)
      {
        CStdString tagOptionName = m_tagOptions->GetMatch(1);
        CStdString tagOptionValue = m_tagOptions->GetMatch(2);
        pos2 += tagOptionName.length() + tagOptionValue.length();
        if (tagOptionName == "class")
        {
          if (m_flag[FLAG_LANGUAGE])
          {
            strUTF8.erase(del_start, pos - del_start);
            pos = del_start;
          }
          if (!tagOptionValue.Compare(lang))
          {
            m_flag[FLAG_LANGUAGE] = false;
          }
          else
          {
            m_flag[FLAG_LANGUAGE] = true;
            del_start = pos;
          }
          break;
        }
      }
    }
    else if (fullTag == "</p>" && m_flag[FLAG_LANGUAGE])
    {
      strUTF8.erase(del_start, pos - del_start);
      pos = del_start;
      m_flag[FLAG_LANGUAGE] = false;
    }
    else if (fullTag == "<br>" && !strUTF8.IsEmpty())
    {
      strUTF8.Insert(pos, "\n");
      pos += 1;
    }
  }

  if(m_flag[FLAG_LANGUAGE])
    strUTF8.erase(del_start);

  if (strUTF8.IsEmpty())
    return;

  if( strUTF8[strUTF8.size()-1] == '\n' )
    strUTF8.Delete(strUTF8.size()-1);

  // add a new text element to our container
  pOverlay->AddElement(new CDVDOverlayText::CElementText(strUTF8.c_str()));
}