Back to index

salome-kernel  6.5.0
Functions
SALOMEDSImpl_Tool.cxx File Reference
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string.h>
#include <iterator>
#include <sstream>
#include "SALOMEDSImpl_Tool.hxx"
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>

Go to the source code of this file.

Functions

bool Exists (const std::string thePath)
std::vector< std::string > treatRepetation (const std::string &theValue)

Function Documentation

bool Exists ( const std::string  thePath)

Definition at line 53 of file SALOMEDSImpl_Tool.cxx.

{
#ifdef WIN32 
  if (  GetFileAttributes (  thePath.c_str()  ) == 0xFFFFFFFF  ) { 
    if (  GetLastError () == ERROR_FILE_NOT_FOUND  ) {
      return false;
    }
  }
#else 
  int status = access ( thePath.c_str() , F_OK ); 
  if (status != 0) return false;
#endif
  return true;
}
std::vector< std::string > treatRepetation ( const std::string &  theValue)

Definition at line 249 of file SALOMEDSImpl_Tool.cxx.

{
  std::vector<std::string> aResult;
  int pos = theValue.find(";*=");
  if(pos < 0 )
    {
      aResult.push_back(theValue);
      return aResult;
    }
  std::string val(theValue.substr(0, pos));
  std::string suffix(theValue.substr(pos+3));
  int nb;
  std::istringstream tmp(suffix);
  tmp >> nb;
  for(int i=0; i<nb; i++)
    aResult.push_back(val);
  return aResult;
}