libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AlgAudio::Utilities Class Reference

#include <Utilities.hpp>

Classes

struct  LocaleDecPoint
 

Static Public Member Functions

static Point2D Align (HorizAlignment, VertAlignment, Size2D inner, Size2D outer)
 
static std::string ConvertOSpathToUniPath (const std::string &ospath)
 
static std::string ConvertUnipathToOSPath (const std::string &unipath)
 
static void CopyToClipboard (std::string)
 
static std::string FindSCLang ()
 
static std::string GetCurrentDir ()
 
static std::string GetDir (std::string)
 
static bool GetFileExists (std::string path)
 
static std::string GetFilename (std::string)
 
static std::string JoinString (std::vector< std::string > str, std::string c)
 
static float mtof (float m)
 
static void NumericLocaleRestoreUserCustom ()
 
static void NumericLocaleSetUniversal ()
 
static std::string PrettyFloat (float val)
 
static void Replace (std::string &str, const std::string &from, const std::string &to)
 
static std::vector< std::string > SplitString (std::string str, std::string delimiter)
 
static std::string Trim (std::string)
 
static std::string TrimAllLines (std::string)
 
static void Wait (int ms)
 
static void WaitOS (int ms)
 

Static Public Attributes

static const char OSDirSeparator
 
static const std::string OSLibSuffix
 
static const std::string OSSCLangBinName
 

Detailed Description

A static class encapsulating a number of useful helper functions that are widely used thorough the rest of the source code.

Member Function Documentation

static Point2D AlgAudio::Utilities::Align ( HorizAlignment  ,
VertAlignment  ,
Size2D  inner,
Size2D  outer 
)
static

For a given horizontal and vertical alignment, this function calculates as what offset a rectangle (represented by a Size2D) should be placed to match that alighments in another (usually larger) rectangle, and returns that offset as a Point2D.

static std::string AlgAudio::Utilities::ConvertOSpathToUniPath ( const std::string &  ospath)
static

Replaces all platform native path separators to '/'.

static std::string AlgAudio::Utilities::ConvertUnipathToOSPath ( const std::string &  unipath)
static

Replaces all '/' path separators to platform native separators.

static void AlgAudio::Utilities::CopyToClipboard ( std::string  )
static

Pushes the string to sytem clipboard.

static std::string AlgAudio::Utilities::FindSCLang ( )
static

Searches for SuperCollider interpreter executable in the system. That includes searching in windows registry, $PATH, and a list of common locations.

Returns
The path to sclang.exe binary, or an empty string on failure.
static std::string AlgAudio::Utilities::GetCurrentDir ( )
static

Returns the path to the current working directory.

static std::string AlgAudio::Utilities::GetDir ( std::string  )
static

Trims a file path to the directory, stripping the filename.

static bool AlgAudio::Utilities::GetFileExists ( std::string  path)
static

Returns if a file at the given path exists.

static std::string AlgAudio::Utilities::GetFilename ( std::string  )
static

Trims a file path to the filename, stripping the directory path.

static std::string AlgAudio::Utilities::JoinString ( std::vector< std::string >  str,
std::string  c 
)
static

Joins a vector of strings into a single string placing string c between each consequent pair.

static float AlgAudio::Utilities::mtof ( float  m)
static

Converts a midi node to the corresponding frequency.

static void AlgAudio::Utilities::NumericLocaleRestoreUserCustom ( )
static

Restores locale settings to user defined.

static void AlgAudio::Utilities::NumericLocaleSetUniversal ( )
static

Sets the numeric locale to universal "C"

static std::string AlgAudio::Utilities::PrettyFloat ( float  val)
static

Returns a float formatted to a string in a way that uses only a few digits at each magnitude level.

static void AlgAudio::Utilities::Replace ( std::string &  str,
const std::string &  from,
const std::string &  to 
)
static

This function replaces all ocurences of string from to string to in string str.

static std::vector<std::string> AlgAudio::Utilities::SplitString ( std::string  str,
std::string  delimiter 
)
static

Splits an std::string into a vector of strings, using the provided delimiter.

static std::string AlgAudio::Utilities::Trim ( std::string  )
static

Returns a string trimmed from heading and tailing whitespaces.

static std::string AlgAudio::Utilities::TrimAllLines ( std::string  )
static

Returns a string trimmed from heading and tailing whitespaces on each line.

static void AlgAudio::Utilities::Wait ( int  ms)
static

Sleeps for a given interval using SDL's functions.

static void AlgAudio::Utilities::WaitOS ( int  ms)
static

Sleeps for a given interval using platform native functions.

Member Data Documentation

const char AlgAudio::Utilities::OSDirSeparator
static

The platform-specific file path separator. This is '\' on Windows, and '/' on *nixes.

const std::string AlgAudio::Utilities::OSLibSuffix
static

The platform-specific shared library file extension. This is '.dll' on Windows, and '.so' on Linux.

const std::string AlgAudio::Utilities::OSSCLangBinName
static

Platform specific sclang binary name (sclang or sclang.exe)


The documentation for this class was generated from the following file: