Example #1
0
int VAISNAVADAY::GetFestivalClass(TString &str)
{
	int i, j, val;

	i = str.Find("[c");

	if (i >= 0)
	{
//		i += 2;
		if ((i + 2) < str.GetLength())
		{
			val = int(str.GetAt(i+2) - '0');
			j = str.Find("]", i);
			if (j >= str.GetLength())
				j = str.GetLength();
			if (j > i)
			{
				str.Delete(i, j - i + 1);
			}
			if (val < 0 || val > 6)
				return -1;
			return val;
		}
		else
			return -1;
	}
	else
	{
		return -1;
	}

}
Example #2
0
void ReplaceHexFormWithOrdinals( TString& astring )
{
  int sl = astring.Length();
  for( int i=1; i<=sl; i++  )
  {
    if( astring[i]=='\\' )
      if( i<sl )
        if( astring[i+1]=='\\' )
        {
          astring.Delete( i, 1 );
          sl--;
        }
        else
        {
          if( astring[i+1]!='x' || i+3>sl )
            throw TException( "String '"+astring+"' not in CSV format." );

          char c = HexToInt( astring.c_str() + (i+1), 2 );
          astring[i] = c;
          astring.Delete( i+1, 3 );
          sl -= 3;
        }
  }
}
Example #3
0
void VAISNAVADAY::GetFastingSubject(TString &strFest, int &nFast, TString &strFastSubj)
{
	int nf, nf2;

	// default values
	nFast = 0;
	strFastSubj.Empty();

	// finding fast subject
	nf = strFest.Find("[f:");
	if (nf >= 0 && nf < strFest.GetLength())
	{
		// ziskava typ postu
		nFast = strFest.GetAt(nf+3) - '0';
		nf2 = strFest.Find("]", nf);
		if (nf2 >= 0)
		{
			strFest.Mid(nf + 5, nf2 - nf - 5, strFastSubj);
		}
		strFest.Delete(nf, strFest.GetLength() - nf);
	}
}
Example #4
0
void ReplaceSub32OrdinalsWithHexForm( TString& astring )
{
  int sl = astring.Length();
  for( int i=1; i<=sl; i++ )
  {
    if( astring[i] == '\\' )
    {
      astring.Insert( "\\", i );
      i++;
      sl++;
    }
    else
    {
      if( ((unsigned char)astring[i]) < 32 )
      {
        astring.Insert( "\\x" + utils::IntToHex((unsigned char)astring[i],2), i );
        astring.Delete( i+4,1 );
        sl += 3;
        i += 3;
      }
    }
  }
}