Beispiel #1
0
festring::sizetype festring::IgnoreCaseFind(cfestring& Where,
					    cfestring& What,
					    sizetype Begin)
{
  if(What.IsEmpty())
    return Begin;

  for(; Where.GetSize() >= What.GetSize() + Begin; ++Begin)
    if(::Capitalize(Where[Begin]) == ::Capitalize(What[0]))
    {
      truth Equal = true;

      for(sizetype c = 1; c < What.GetSize(); ++c)
	if(::Capitalize(Where[Begin + c]) != ::Capitalize(What[c]))
	{
	  Equal = false;
	  break;
	}

      if(Equal)
	return Begin;
    }

  return NPos;
}
Beispiel #2
0
festring::sizetype festring::IgnoreCaseFind(cfestring& Where,
                                            cfestring& What,
                                            sizetype Begin)
{
  if(What.IsEmpty())
    return Begin;

  for(sizetype i = Begin; Where.GetSize() >= What.GetSize() + i; ++i)
    if(::Capitalize(Where[i]) == ::Capitalize(What[0]))
    {
      truth Equal = true;

      for(sizetype j = 1; j < What.GetSize(); ++j)
        if(::Capitalize(Where[i + j]) != ::Capitalize(What[j]))
        {
          Equal = false;
          break;
        }

      if(Equal)
        return i;
    }

  return NPos;
}
Beispiel #3
0
bool festring::IgnoreCaseCompare(cfestring& First,
                                 cfestring& Second)
{
  for(sizetype Pos = 0; Pos < First.GetSize() && Pos < Second.GetSize(); ++Pos)
  {
    char Char1 = ::Capitalize(First[Pos]);
    char Char2 = ::Capitalize(Second[Pos]);

    if(Char1 != Char2)
      return Char1 < Char2;
  }

  return First.GetSize() < Second.GetSize();
}
Beispiel #4
0
void festring::SearchAndReplace(festring& Where, cfestring& What,
                                cfestring& With, sizetype Begin)
{
  if(What.IsEmpty())
    ABORT("Infinite loops in SearchAndReplace detected!");

  for(sizetype Pos = Where.Find(What, Begin);
      Pos != NPos; Pos = Where.Find(What, Pos))
  {
    Where.Erase(Pos, What.GetSize());
    Where.Insert(Pos, With);
    Pos += With.GetSize();
  }
}
Beispiel #5
0
void festring::SearchAndReplace(festring& Where, cfestring& What,
				cfestring& With, sizetype Begin)
{
  for(sizetype Pos = Where.Find(What, Begin);
      Pos != NPos; Pos = Where.Find(What, Pos))
  {
    Where.Erase(Pos, What.GetSize());
    Where.Insert(Pos, With);
  }
}
Beispiel #6
0
void ivanconfig::SelectedBkgColorChanger(stringoption* O, cfestring& What)
{
  if(!What.IsEmpty()){
    int RGB[3]={1,1,1}, j=0;
    std::string sC;
    for(int i=0;i<What.GetSize();i++){
      if(j==3)return; //wrong usage detected

      if(What[i]>=0x30 && What[i]<=0x39) //0-9
        sC+=What[i];
      else{
        if(What[i]!=',') //wrong usage detected
          return;
      }

      if(What[i]==',' || i==What.GetSize()-1){
        RGB[j]=std::stol(sC);
        if(RGB[j]<8)return; //0,0,0 makes xBRZ not work well. 8,8,8 is min to have col16 not 0,0,0 (it is less bits than col24 per component)
        if(RGB[j]>200)return; //if all too high will prevent reading white text
        j++;
        sC="";
      }
    }

    if(j!=3)return; //wrong usage detected

    felist::SetSelectedBkgColor(MakeRGB16(RGB[0],RGB[1],RGB[2]));
  }else{
    felist::SetSelectedBkgColor(TRANSPARENT_COLOR);
  }

  if(O!=NULL){
    O->Value.Empty();
    O->Value<<What;
  }
}