#include <Utils.h>
 | 
| static Utils &  | instance () | 
|   | 
| static int  | versionToInt (char major, char minor, char revision) | 
|   | Combines a version number into one int. Version numbers thus converted can be queried (v1 < v2). Version numbers are assumed to be VERSION.MAJOR.MINOR (e.g. 3.4.1).  More...
  | 
|   | 
| static double  | rand () | 
|   | Returns a random number within [0 1].  More...
  | 
|   | 
| static bool  | hasGui () | 
|   | 
| static bool  | loadToBuffer (const QString &filePath, QByteArray &ba) | 
|   | Loads file to buffer. The file is either loaded from a local resource or from a network resource (blocking!).  More...
  | 
|   | 
| static QString  | appDataPath () | 
|   | Returns the path for writing persistant application data. The path refers to GenericDataLocation/organizationName. On Windows e.g. C: Wien  More...
  | 
|   | 
| static QString  | createFilePath (const QString &filePath, const QString &attribute, const QString &newSuffix=QString()) | 
|   | Creates a new file path from filePath. Hence, C:.png can be turned into C:-something.xml  More...
  | 
|   | 
| static QString  | timeStampFileName (const QString &attribute="", const QString &suffix=".txt") | 
|   | Returns a 'unique' filename named "ATTRIBUTE YYYY-MM-dd HH-mm.SUFFIX".  More...
  | 
|   | 
| static QString  | baseName (const QString &filePath) | 
|   | Returns the filePath without suffix. C:/temp/something.png -> C:/temp/something This fixes an issue of Qt QFileInfo::baseName which returns wrong basenames if the filename contains dots Qt baseName: Best. 901 Nr. 112 00147.jpg -> Best. This method: Best. 901 Nr. 112 00147.jpg -> Best. 901 Nr. 112 00147  More...
  | 
|   | 
| static QJsonObject  | readJson (const QString &filePath) | 
|   | 
| static int64  | writeJson (const QString &filePath, const QJsonObject &jo) | 
|   | 
| static void  | initDefaultFramework () | 
|   | 
| template<typename num >  | 
| static num  | clamp (num val, num min, num max) | 
|   | 
  
  
      
        
          | QString rdf::Utils::appDataPath  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns the path for writing persistant application data. The path refers to GenericDataLocation/organizationName. On Windows e.g. C: Wien 
- Returns
 - The app path.
 
 
 
  
  
      
        
          | QString rdf::Utils::baseName  | 
          ( | 
          const QString &  | 
          filePath | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns the filePath without suffix. C:/temp/something.png -> C:/temp/something This fixes an issue of Qt QFileInfo::baseName which returns wrong basenames if the filename contains dots Qt baseName: Best. 901 Nr. 112 00147.jpg -> Best. This method: Best. 901 Nr. 112 00147.jpg -> Best. 901 Nr. 112 00147 
- Parameters
 - 
  
  
 
- Returns
 - The file path without suffix.
 
 
 
template<typename num > 
  
  
      
        
          | static num rdf::Utils::clamp  | 
          ( | 
          num  | 
          val,  | 
         
        
           | 
           | 
          num  | 
          min,  | 
         
        
           | 
           | 
          num  | 
          max  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
 
  
  
      
        
          | QString rdf::Utils::createFilePath  | 
          ( | 
          const QString &  | 
          filePath,  | 
         
        
           | 
           | 
          const QString &  | 
          attribute,  | 
         
        
           | 
           | 
          const QString &  | 
          newSuffix = QString()  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Creates a new file path from filePath. Hence, C:.png can be turned into C:-something.xml 
- Parameters
 - 
  
    | filePath | The old file path. | 
    | attribute | An attribute string which is appended to the filename. | 
    | newSuffix | A new suffix, the old suffix is used if empty. | 
  
   
- Returns
 - The new file path.
 
 
 
  
  
      
        
          | bool rdf::Utils::hasGui  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
  
  
      
        
          | void rdf::Utils::initDefaultFramework  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
      
        
          | void rdf::Utils::initFramework  | 
          ( | 
           | ) | 
           const | 
        
      
 
 
  
  
      
        
          | Utils & rdf::Utils::instance  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
  
  
      
        
          | bool rdf::Utils::loadToBuffer  | 
          ( | 
          const QString &  | 
          filePath,  | 
         
        
           | 
           | 
          QByteArray &  | 
          ba  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Loads file to buffer. The file is either loaded from a local resource or from a network resource (blocking!). 
- Parameters
 - 
  
    | filePath | The file path or url. | 
    | ba | The buffer. | 
  
   
- Returns
 - true if the resource was loaded.
 
 
 
  
  
      
        
          | double rdf::Utils::rand  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns a random number within [0 1]. 
- Returns
 
 
 
  
  
      
        
          | QJsonObject rdf::Utils::readJson  | 
          ( | 
          const QString &  | 
          filePath | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
      
        
          | void rdf::Utils::registerVersion  | 
          ( | 
           | ) | 
           const | 
        
      
 
 
  
  
      
        
          | QString rdf::Utils::timeStampFileName  | 
          ( | 
          const QString &  | 
          attribute = "",  | 
         
        
           | 
           | 
          const QString &  | 
          suffix = ".txt"  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Returns a 'unique' filename named "ATTRIBUTE YYYY-MM-dd HH-mm.SUFFIX". 
- Parameters
 - 
  
    | attribute | An optional string to specify the file. | 
    | suffix | The file suffix. | 
  
   
- Returns
 
 
 
  
  
      
        
          | int rdf::Utils::versionToInt  | 
          ( | 
          char  | 
          major,  | 
         
        
           | 
           | 
          char  | 
          minor,  | 
         
        
           | 
           | 
          char  | 
          revision  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Combines a version number into one int. Version numbers thus converted can be queried (v1 < v2). Version numbers are assumed to be VERSION.MAJOR.MINOR (e.g. 3.4.1). 
- Parameters
 - 
  
    | major | The major version. | 
    | minor | The minor version. | 
    | revision | The revision. | 
  
   
- Returns
 
 
 
  
  
      
        
          | int64 rdf::Utils::writeJson  | 
          ( | 
          const QString &  | 
          filePath,  | 
         
        
           | 
           | 
          const QJsonObject &  | 
          jo  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
 
The documentation for this class was generated from the following files: