luna-sysmgr-common
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Utils.h File Reference
#include "Common.h"
#include <time.h>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <regex.h>
#include <QByteArray>
#include <QUrl>
#include <QGraphicsItem>
#include <glib.h>
Include dependency graph for Utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void setPosTopLeft (QGraphicsItem *item, int x, int y)
 
char * readFile (const char *filePath)
 
bool writeFile (const std::string &filePath, const std::string &buffer)
 
bool writeFile (const std::string &filePath, QByteArray buffer)
 
bool writeToTempFile (const std::string &data, const std::string &tempDir, std::string &r_outputFile)
 
bool deleteFile (const char *filePath)
 
time_t localTime ()
 
unsigned long currentTimeMs ()
 
template<class T >
std::string toSTLString (const T &arg)
 
std::string getResourceNameFromUrl (const QUrl &url)
 
std::string trimWhitespace (const std::string &s, const std::string &drop="\r\n\t ")
 
bool getNthSubstring (unsigned int n, std::string &target, const std::string &str, const std::string &delims=" \t\n\r")
 
int splitFileAndPath (const std::string &srcPathAndFile, std::string &pathPart, std::string &filePart)
 
int splitFileAndExtension (const std::string &srcFileAndExt, std::string &filePart, std::string &extensionPart)
 
int splitStringOnKey (std::vector< std::string > &returnSplitSubstrings, const std::string &baseStr, const std::string &delims)
 
int remap_stdx_pipes (int readPipe, int writePipe)
 
bool isNonErrorProcExit (int ecode, int normalCode=0)
 
std::string windowIdentifierFromAppAndProcessId (const std::string &appId, const std::string &processId)
 
bool splitWindowIdentifierToAppAndProcessId (const std::string &id, std::string &appId, std::string &processId)
 
std::string getHtml5DatabaseFolderNameForApp (const std::string &appId, std::string appFolderPath)
 
void threadCleanup ()
 
bool extractFromJson (const std::string &jsonString, const std::string &key, std::string &r_value)
 
bool extractFromJson (struct json_object *root, const std::string &key, std::string &r_value)
 
bool extractFromJson (struct json_object *root, const std::string &key, int &r_value)
 
bool extractFromJson (struct json_object *root, const std::string &key, bool &r_value)
 
struct json_object * JsonGetObject (struct json_object *root, const std::string &key)
 
std::string base64_encode (unsigned char const *, unsigned int len)
 
std::string base64_decode (std::string const &s)
 
bool doesExistOnFilesystem (const char *pathAndFile)
 
int fileCopy (const char *srcFileAndPath, const char *dstFileAndPath)
 
gboolean compare_regex (const gchar *regex, const gchar *string)
 
int determineEnclosingDir (const std::string &fileNameAndPath, std::string &r_enclosingDir)
 
std::string string_printf (const char *format,...) G_GNUC_PRINTF(1
 
std::string std::string & append_format (std::string &str, const char *format,...) G_GNUC_PRINTF(2
 

Function Documentation

std::string std::string& append_format ( std::string &  str,
const char *  format,
  ... 
)
std::string base64_decode ( std::string const &  s)
std::string base64_encode ( unsigned char const *  ,
unsigned int  len 
)
gboolean compare_regex ( const gchar *  regex,
const gchar *  string 
)
unsigned long currentTimeMs ( )
bool deleteFile ( const char *  filePath)
int determineEnclosingDir ( const std::string &  fileNameAndPath,
std::string &  r_enclosingDir 
)
bool doesExistOnFilesystem ( const char *  pathAndFile)
bool extractFromJson ( const std::string &  jsonString,
const std::string &  key,
std::string &  r_value 
)
bool extractFromJson ( struct json_object *  root,
const std::string &  key,
std::string &  r_value 
)
bool extractFromJson ( struct json_object *  root,
const std::string &  key,
int &  r_value 
)
bool extractFromJson ( struct json_object *  root,
const std::string &  key,
bool &  r_value 
)
int fileCopy ( const char *  srcFileAndPath,
const char *  dstFileAndPath 
)
std::string getHtml5DatabaseFolderNameForApp ( const std::string &  appId,
std::string  appFolderPath 
)
bool getNthSubstring ( unsigned int  n,
std::string &  target,
const std::string &  str,
const std::string &  delims = " \t\n\r" 
)
std::string getResourceNameFromUrl ( const QUrl &  url)
bool isNonErrorProcExit ( int  ecode,
int  normalCode = 0 
)
struct json_object* JsonGetObject ( struct json_object *  root,
const std::string &  key 
)
read
time_t localTime ( )
char* readFile ( const char *  filePath)
int remap_stdx_pipes ( int  readPipe,
int  writePipe 
)
void setPosTopLeft ( QGraphicsItem *  item,
int  x,
int  y 
)
int splitFileAndExtension ( const std::string &  srcFileAndExt,
std::string &  filePart,
std::string &  extensionPart 
)
int splitFileAndPath ( const std::string &  srcPathAndFile,
std::string &  pathPart,
std::string &  filePart 
)
int splitStringOnKey ( std::vector< std::string > &  returnSplitSubstrings,
const std::string &  baseStr,
const std::string &  delims 
)
bool splitWindowIdentifierToAppAndProcessId ( const std::string &  id,
std::string &  appId,
std::string &  processId 
)
std::string string_printf ( const char *  format,
  ... 
)
void threadCleanup ( )
template<class T >
std::string toSTLString ( const T &  arg)
std::string trimWhitespace ( const std::string &  s,
const std::string &  drop = "\r\n\t " 
)
std::string windowIdentifierFromAppAndProcessId ( const std::string &  appId,
const std::string &  processId 
)
bool writeFile ( const std::string &  filePath,
const std::string &  buffer 
)
bool writeFile ( const std::string &  filePath,
QByteArray  buffer 
)
bool writeToTempFile ( const std::string &  data,
const std::string &  tempDir,
std::string &  r_outputFile 
)