Example #1
0
PositionParser::PositionParser(const wxString & src)
{
    parsedOk = false;
    if( FindSeparator( src ) ) {
        latitude = fromDMM( latitudeString );
        longitude = fromDMM( longitudeString );
        if( (latitude != 0.0) && (longitude != 0.0) ) parsedOk = true;
    }
}
Example #2
0
void Vpath::SetPath (std::string const & strPath)
{
    _segments.clear ();
    unsigned idx = 0;
    unsigned len = strPath.size ();
    while (idx < len)
    {
        unsigned idxEnd = FindSeparator(strPath, idx);
        unsigned count = (idxEnd != std::string::npos)? idxEnd - idx: std::string::npos;
        _segments.push_back (strPath.substr (idx, count));
        if (count == std::string::npos)
            break;
        idx = SkipSeparator(strPath, idxEnd);
    }
}
Example #3
0
/* ------------------- D R E A M  -  D O C -------------------------------
** Nom        : 
** Entree(s)  : 
** Sortie(s)  : 
** Val de ret : 
** Sujet      : 
** Dependance : 
** Auteur     : Olivier Juan
** Version    : 
------------------------------------------------------------------------*/
int FindDirectory(unsigned char *tname,FileDescriptor **FD)
{
  unsigned char *Buffer,*dname,*tempname;
  LittlePathTableDescriptor *LPTD;
  unsigned long PosInPathTable,TableSectorLength,TableLength;
  unsigned char BoolName,i,DirectoryNbr,PosInTree=0;
  short DirectoryLength;
  int readres;
  i=FindLastSeparator(tname);
  dname=(i==0?NULL:(unsigned char *)malloc(i+1));
  for (BoolName=1;BoolName<=i;BoolName++)dname[BoolName-1]=tname[BoolName];
  if (dname!=NULL)dname[i]=0;
  for (;BoolName<strlen(tname);BoolName++)tname[BoolName-i-1]=tname[BoolName];
  if (tname!=NULL)tname[BoolName-i-1]=0;
  TableLength=IsoPrimaryVolume.PathTableLength;
  TableSectorLength=((unsigned long)(TableLength/IsoPrimaryVolume.SectorSize))+(TableLength%IsoPrimaryVolume.SectorSize>0?1:0);
  Buffer=(unsigned char *)malloc(TableSectorLength*IsoPrimaryVolume.SectorSize);
  if ((readres = read(1,TableSectorLength,IsoPrimaryVolume.FirstSectorNumInFirstLittleEndianPathTable,Buffer)) != 0)
    {
      printf("read a renvoye: %d\n", readres);
      return ISO_READ_ERR;
    }
  LPTD=(LittlePathTableDescriptor *)Buffer;
  if (LPTD->NameLength!=1)
    {
      printf("Erreur je ne trouve pas le ROOT\n");
      return 2;
    }
  if (dname==NULL)
    {
      PosInPathTable=LPTD->FirstSectorNumber;
      LPTD=NULL;
      free(Buffer);
      return FindFileInDirectory(tname,PosInPathTable,FD);
    }
  tempname=dname;
  PosInPathTable=sizeof(LittlePathTableDescriptor)+LPTD->NameLength;
  PosInTree=1;DirectoryNbr=1;
  while((DirectoryLength=FindSeparator(tempname))!=-1)
    {
      BoolName=0;
      while (PosInPathTable<TableLength)
	{
	  LPTD=(LittlePathTableDescriptor *)(Buffer+PosInPathTable);DirectoryNbr++;
	  PosInPathTable+=sizeof(LittlePathTableDescriptor)+LPTD->NameLength;
	  if (LPTD->ParentDirectortDescriptorNumber==PosInTree)
	    {
	      if (LPTD->NameLength==DirectoryLength)
		{
		  i=0;
		  do {BoolName=(tempname[i]==(LPTD->Name)[i]);i++;} while ((BoolName)&&(i<DirectoryLength));
		  if (BoolName) break;
		}
	    }
	  else if (LPTD->ParentDirectortDescriptorNumber>PosInTree) return 4;
	}
      if (BoolName==0) return 4;
      tempname+=DirectoryLength+1;
      PosInTree=DirectoryNbr;
    }
  PosInPathTable=LPTD->FirstSectorNumber;
  LPTD=NULL;tempname=NULL;
  free(Buffer);free(dname);
  return FindFileInDirectory(tname,PosInPathTable,FD);
}