All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Typedefs | Functions
openfluid::tools Namespace Reference

Classes

class  ChronFileInterpolator
class  ChronFileLinearInterpolator
class  ChronologicalSerie
class  ColumnTextParser
class  ReaderNextValue
class  DistributionBindings
class  DistributionTables
class  ExternalProgram
class  FileDownloader
struct  GDALDriverInfos_t
class  ProgressiveChronFileReader
class  ProgressiveColumnFileReader

Typedefs

typedef std::pair
< openfluid::core::DateTime,
double > 
ChronItem_t
typedef std::map< std::string,
GDALDriverInfos_t
GDALDriversFilesExts_t

Functions

const GDALDriversFilesExts_t
DLLEXPORT 
getOGRFilesDriversForOpenFLUID ()
const GDALDriversFilesExts_t
DLLEXPORT 
getGDALFilesDriversForOpenFLUID ()
const std::set< std::string >
DLLEXPORT 
getOGRFilesExtensionsForOpenFLUID ()
QString DLLEXPORT toIniCompatible (const std::string &Str)
std::string DLLEXPORT fromIniCompatible (const QVariant &Var)
std::list< std::string > DLLEXPORT toStdStringList (const QStringList &StrList)
QString DLLEXPORT getOGRGDALFormatsForQFileDialogs (const GDALDriversFilesExts_t &Drivers, const QString &AllFormatsLabel)
QString DLLEXPORT escapeXMLEntities (const QString &Str)
template<typename T >
bool ConvertString (const std::string &StrToConvert, T *Converted)
template<typename T >
bool ConvertValue (const T ValueToConvert, std::string *StrConverted)
void DLLEXPORT TokenizeString (const std::string &StrToTokenize, std::vector< std::string > &Tokens, const std::string &Delimiters)
bool IsCloseEnough (double A, double B, double Epsilon=0.00001)
bool IsVeryClose (double A, double B, double Epsilon=0.00001)
bool DLLEXPORT WildcardMatching (const std::string &Pattern, const std::string &Str)
std::vector< std::string >
DLLEXPORT 
GetFilesByExt (const std::string DirToExplore, const std::string Ext, bool WithPath=false, bool ExtIncludeDot=false)
std::vector< std::string >
DLLEXPORT 
GetFilesBySuffixAndExt (const std::string &DirToExplore, const std::string &Suffix, const std::string &Ext, bool WithPath=false, bool ExtIncludeDot=false)
std::vector< std::string >
DLLEXPORT 
SplitString (const std::string &StrToSplit, const std::string &Separators, bool ReturnsEmpty=false)
bool DLLEXPORT EmptyDirectoryRecursively (const std::string &DirPath)
std::vector< std::string >
DLLEXPORT 
GetFilesRecursively (const std::string &DirPath)
std::string DLLEXPORT ReplaceEmptyString (std::string SourceStr, const std::string &ReplaceStr)
std::string DLLEXPORT RemoveTrailingSlashes (std::string Str)
void DLLEXPORT printSTDOUT (std::vector< std::string > Strings, std::string Sep)
void DLLEXPORT CopyDirectoryRecursively (const std::string &SourcePath, const std::string &IntoPath, const bool DontCopyDotDirs=false)
void DLLEXPORT CopyDirectoryContentsRecursively (const std::string &SourcePath, const std::string &IntoPath, const bool DontCopyDotDirs=false)
int DLLEXPORT CompareVersions (const std::string &VersionA, const std::string &VersionB, bool Strict=true)
void DLLEXPORT Sleep (const unsigned int MSec)

Typedef Documentation


Function Documentation

int DLLEXPORT openfluid::tools::CompareVersions ( const std::string &  VersionA,
const std::string &  VersionB,
bool  Strict = true 
)

Compares two OpenFLUID software versions. Version number must be formed as major.minor.patch[~status]

Parameters:
[in]VersionAthe first version number
[in]VersionBthe second version number
[in]StrictIf true, the comparison include the status part of the version (it ignores it otherwise)
Returns:
1 if VersionA is greater than VersionB, -1 if VersionB is greater than VersionA, 0 if versions are equals, -2 if a version format is not well-formed
template<typename T >
bool openfluid::tools::ConvertString ( const std::string &  StrToConvert,
T *  Converted 
) [inline]

Converts a string to another type

Parameters:
[in]StrToConvertthe string to convert
[out]Convertedthe result of the conversion
Returns:
true if the conversion is correct
template<typename T >
bool openfluid::tools::ConvertValue ( const T  ValueToConvert,
std::string *  StrConverted 
) [inline]

Converts a value to a string

Parameters:
[in]ValueToConvertthe value to convert
[out]StrConvertedthe result of the conversion
Returns:
true if the conversion is correct
void DLLEXPORT openfluid::tools::CopyDirectoryContentsRecursively ( const std::string &  SourcePath,
const std::string &  IntoPath,
const bool  DontCopyDotDirs = false 
)

Copies a source directory to destination path, not including the root of the source directory. If the destination path does not exists, it is created.

Parameters:
[in]SourcePaththe source directory to copy
[in]IntoPaththe destination directory
[in]DontCopyDotDirsflag for copying dot ('.*') directories. Default is false.
void DLLEXPORT openfluid::tools::CopyDirectoryRecursively ( const std::string &  SourcePath,
const std::string &  IntoPath,
const bool  DontCopyDotDirs = false 
)

Copies a source directory to destination path, including the root of the source directory. If the destination path does not exists, it is created.

Parameters:
[in]SourcePaththe source directory to copy
[in]IntoPaththe destination directory
[in]DontCopyDotDirsflag for copying dot ('.*') directories. Default is false.
bool DLLEXPORT openfluid::tools::EmptyDirectoryRecursively ( const std::string &  DirPath)

Recursively removes all files and directories contained in the given directory. It deletes the directory and recreates it.

Parameters:
[in]DirPaththe directory to empty
Returns:
true if successful
QString DLLEXPORT openfluid::tools::escapeXMLEntities ( const QString &  Str)

Escapes characters in the given string to be compatible with the XML format.

Parameters:
[in]Strthe string to escape
Returns:
The escaped string
std::string DLLEXPORT openfluid::tools::fromIniCompatible ( const QVariant &  Var)

Transforms the given variable from an INI file managed with QSettings to a string

Parameters:
[in]Varthe variable to transform
Returns:
The variable transformed into a string
std::vector<std::string> DLLEXPORT openfluid::tools::GetFilesByExt ( const std::string  DirToExplore,
const std::string  Ext,
bool  WithPath = false,
bool  ExtIncludeDot = false 
)

Gets the list of files with specified extension contained in the specified directory

Parameters:
[in]DirToExplorethe directory to explore
[in]Extthe file extension
[in]WithPathreturn full path with file name if true, file name only otherwise
[in]ExtIncludeDotif true, the given extension through Ext parameter is suffixed by a dot
std::vector<std::string> DLLEXPORT openfluid::tools::GetFilesBySuffixAndExt ( const std::string &  DirToExplore,
const std::string &  Suffix,
const std::string &  Ext,
bool  WithPath = false,
bool  ExtIncludeDot = false 
)

Get list of files with specified extension contained in the specified dir

Parameters:
[in]DirToExplorethe directory to explore
[in]Extthe file extension
[in]Suffixthe file suffix
[in]WithPathreturn full path with file name if true, file name only otherwise
[in]ExtIncludeDotif true, the given extension through Ext parameter is suffixed by a dot
std::vector<std::string> DLLEXPORT openfluid::tools::GetFilesRecursively ( const std::string &  DirPath)

Recursively finds all the paths of the files that exist exist in the given directory and subdirectories

Parameters:
[in]DirPaththe directory to explore
Returns:
a vector containing all files paths

Returns a list of GDAL drivers available in OpenFLUID for GIS vector files

Returns:
an openfluid::tools::GDALDriversFilesExts_t

Returns a list of OGR drivers available in OpenFLUID for GIS vector files

Returns:
an openfluid::tools::GDALDriversFilesExts_t

Returns a set of GIS vector files extensions available in OpenFLUID

Returns:
a set of files extensions
QString DLLEXPORT openfluid::tools::getOGRGDALFormatsForQFileDialogs ( const GDALDriversFilesExts_t &  Drivers,
const QString &  AllFormatsLabel 
)

Returns the available GDAL/OGR formats as a QFileDialog formats string. The string is built according to GDAL/OGR available drivers. The OGRRegisterAll() and/or GDALAllRegister() instruction must be called before using this function.

Parameters:
[in]DriversThe available extensions list
[in]AllFormatsLabelthe label displayed for all formats
Returns:
the format string (e.g. "All vector files (*.shp *.mif *.tab);;ESRI Shapefiles (*.shp);;Mapinfo (*.mif *.tab)")
bool openfluid::tools::IsCloseEnough ( double  A,
double  B,
double  Epsilon = 0.00001 
) [inline]

Function for testing equality between two double precision floats, using the "close enough" method.

Parameters:
[in]Athe firts term of the equality
[in]Bthe firts term of the equality
[in]Epsilonthe comparison tolerance factor
See also:
http://www.parashift.com/c++-faq-lite/floating-point-arith.html
http://www.boost.org/doc/libs/1_38_0/libs/test/doc/html/utf/testing-tools/floating_point_comparison.html
bool openfluid::tools::IsVeryClose ( double  A,
double  B,
double  Epsilon = 0.00001 
) [inline]

Function for testing equality between two double precision floats, using the "very close" method.

Parameters:
[in]Athe firts term of the equality
[in]Bthe firts term of the equality
[in]Epsilonthe comparison tolerance factor
See also:
http://www.parashift.com/c++-faq-lite/floating-point-arith.html
http://www.boost.org/doc/libs/1_38_0/libs/test/doc/html/utf/testing-tools/floating_point_comparison.html
void DLLEXPORT openfluid::tools::printSTDOUT ( std::vector< std::string >  Strings,
std::string  Sep 
)
std::string DLLEXPORT openfluid::tools::RemoveTrailingSlashes ( std::string  Str)

Removes trailing slashes if any, useful for cleaning paths

Parameters:
[in]Strthe string to process
Returns:
the processed string
std::string DLLEXPORT openfluid::tools::ReplaceEmptyString ( std::string  SourceStr,
const std::string &  ReplaceStr 
)

Replaces a string by another string if it is empty

Parameters:
[in]SourceStrthe source string to process
[in]ReplaceStrthe replacement string to use
Returns:
the processed string
void DLLEXPORT openfluid::tools::Sleep ( const unsigned int  MSec)
std::vector<std::string> DLLEXPORT openfluid::tools::SplitString ( const std::string &  StrToSplit,
const std::string &  Separators,
bool  ReturnsEmpty = false 
)

Splits the passed string into a std::string array, split using the given SepString

Parameters:
[in]StrToSplitthe string to split
[in]Separatorsthe string of separators used to split the string
[in]ReturnsEmptyif true, the empty strings are returned
Returns:
a vector of strings
QString DLLEXPORT openfluid::tools::toIniCompatible ( const std::string &  Str)

Transforms the given string to a string compatible with the INI files managed with QSettings.

Parameters:
[in]Strthe string to transform
Returns:
The transformed string
void DLLEXPORT openfluid::tools::TokenizeString ( const std::string &  StrToTokenize,
std::vector< std::string > &  Tokens,
const std::string &  Delimiters 
)

Function for tokenizing string into a vector of tokens

Parameters:
[in]StrToTokenizethe string to tokenize
[out]Tokensthe resulting tokens
[in]Delimitersthe string delimiter
std::list<std::string> DLLEXPORT openfluid::tools::toStdStringList ( const QStringList &  StrList)

Transforms a QStringList into a std::list of std::string

Parameters:
[in]StrListthe QStringList to transform
Returns:
The QStringList transformed into a std::list of std::string
bool DLLEXPORT openfluid::tools::WildcardMatching ( const std::string &  Pattern,
const std::string &  Str 
)

Checks if the given string matches the given pattern, including * and ? wildcards

Parameters:
[in]PatternThe pattern to match
[in]StrThe string to test
Returns:
true if the given string matches the given pattern
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines