KSquare Utilities
OSservices.h File Reference

General module for functions that interact with a specific operating system. More...

#include "DateTime.h"
#include "KKStr.h"

Go to the source code of this file.

Namespaces

 KKB
 KKB The namespace for KKBase Library supporting general functionality needed by almost any application.
 

Macros

#define DS   "\\"
 
#define DSchar   '\\'
 

Typedefs

typedef long long KKB::osFilePos
 

Functions

void KKB::osAddLastSlash (KKStr &fileSpec)
 Will add the appropriate Directory separator character to the end of fileSpec if one is not there already. More...
 
KKB::KKStr KKB::osAddSlash (const KKStr &fileSpec)
 
void KKB::osChangeDir (const KKStr &dirName, bool &successful)
 
bool KKB::osCopyFile (const KKStr &srcFileName, const KKStr &destFileName)
 
bool KKB::osCopyFileBetweenDirectories (const KKStr &_fileName, const KKStr &_srcDir, const KKStr &_destDir)
 
bool KKB::osCreateDirectory (const KKStr &dirName)
 
bool KKB::osCreateDirectoryPath (KKStr _pathName)
 Will create the whole Directory Path not just the final part of the path. More...
 
KKStr KKB::osCreateUniqueFileName (KKStr fileName)
 Get a unique file name based off file spec 'fileName'. More...
 
bool KKB::osDeleteFile (KKStr _fileName)
 
void KKB::osDisplayWarning (KKStr _message)
 
bool KKB::osFileExists (const KKStr &_fileName)
 
FILE * KKB::osFOPEN (const char *fileName, const char *mode)
 
int KKB::osFSEEK (FILE *f, kkint64 offset, int origin)
 
kkint64 KKB::osFTELL (FILE *f)
 Calls the appropriate 64 bit function for operating system. More...
 
KKStr KKB::osGetCurrentDirectory ()
 
KKStr KKB::osGetDirNameFromPath (KKStr dirPath)
 Extracts the final sub-directory name of the fill directory specification. More...
 
char KKB::osGetDriveLetter (const KKStr &pathName)
 Given a full drive with path and name return the drive letter specified. More...
 
KKStrPtr KKB::osGetEnvVariable (const KKStr &_varName)
 
KKStr KKB::osGetErrorNoDesc (kkint32 errorNo)
 
KKB::DateTime KKB::osGetFileDateTime (const KKStr &fileName)
 
KKStr KKB::osGetFileExtension (KKStr fullFileName)
 
KKStr KKB::osGetFileNamePartOfFile (KKStr fullFileName)
 osGetFileNamePartOfFile, retrieves the file name part of the file spec. More...
 
kkint64 KKB::osGetFileSize (const KKStr &fileName)
 
KKStr KKB::osGetFullPathOfApplication ()
 returns the name and path of the current running application. More...
 
KKStr KKB::osGetHostName ()
 
double KKB::osGetKernalTimeUsed ()
 
KKStrListPtr KKB::osGetListOfDirectories (KKStr fileSpec)
 
KKStrListPtr KKB::osGetListOfFiles (const KKStr &fileSpec)
 Returns a list of files that match the provided file specification. More...
 
void KKB::osGetListOfFilesInDirectoryTree (const KKStr &rootDir, KKStr fileSpec, VectorKKStr &fileNames)
 
KKStrListPtr KKB::osGetListOfImageFiles (KKStr fileSpec)
 
KKB::DateTime KKB::osGetLocalDateTime ()
 Returned the current local date and time. More...
 
kkint32 KKB::osGetNumberOfProcessors ()
 returns the number of CPU's or number of simultaneous threads that you can have. More...
 
KKStr KKB::osGetParentDirectoryOfDirPath (KKStr path)
 
KKStr KKB::osGetParentDirPath (KKStr dirPath)
 Returns the Parent directory path to 'dirPath'. More...
 
KKStr KKB::osGetPathPartOfFile (KKStr fullFileName)
 Get the path part of a full file name specification. More...
 
kkint32 KKB::osGetProcessId ()
 
KKStr KKB::osGetProgName ()
 
KKStr KKB::osGetRootName (const KKStr &fullFileName)
 
KKStr KKB::osGetRootNameOfDirectory (KKStr fullDirName)
 
KKStr KKB::osGetRootNameWithExtension (const KKStr &fullFileName)
 
kkuint64 KKB::osGetSystemTimeInMiliSecs ()
 Returns mili-secs that system (Windows = has been started, Linux time in epoch). More...
 
double KKB::osGetSystemTimeUsed ()
 Returns the number of CPU seconds used by current process. More...
 
kkint32 KKB::osGetThreadId ()
 
KKStr KKB::osGetUserName ()
 
double KKB::osGetUserTimeUsed ()
 
template<class T >
T * KKB::osGrowAllocation (T *src, kkint32 origSize, kkint32 newSize)
 
bool KKB::osIsBackGroundProcess ()
 
kkint32 KKB::osLocateFirstSlashChar (const KKStr &fileSpec)
 
kkint32 KKB::osLocateLastSlashChar (const KKStr &fileSpec)
 
KKStr KKB::osLookForFile (const KKStr &fileName, const KKStr &srcDir)
 Look for a specified file in a sub-directory structure. More...
 
KKStr KKB::osMakeFullFileName (const KKStr &_dirName, const KKStr &_fileName)
 
bool KKB::osMoveFileBetweenDirectories (const KKStr &_fileName, const KKStr &_srcDir, const KKStr &_destDir)
 
void KKB::osParseFileName (KKStr _fileName, KKStr &_dirPath, KKStr &_rootName, KKStr &_extension)
 
void KKB::osParseFileSpec (KKStr fullFileName, KKStr &driveLetter, KKStr &path, KKStr &root, KKStr &extension)
 
KKStrPtr KKB::osReadNextLine (FILE *in)
 Read the next line from the file and return a c-String(NULL terminated). More...
 
KKB::KKStr KKB::osReadNextQuotedStr (FILE *in, const char *whiteSpaceCharacters, bool &eof)
 Read the next Quoted String from the file. More...
 
KKB::KKStr KKB::osReadNextToken (FILE *in, const char *delimiters, bool &eof, bool &eol)
 Read the next logical token from a file using characters in 'delimiters' to separate tokens. More...
 
KKStr KKB::osReadNextToken (FILE *in, const char *delimiters, bool &eof)
 Read the next logical token from a file using characters in 'delimiters' to separate tokens where '
'(end of line) is just another whitespace character. More...
 
KKB::KKStr KKB::osReadNextToken (std::istream &in, const char *delimiters, bool &eof, bool &eol)
 Read the next logical token from a file using characters in 'delimiters' to separate tokens. More...
 
KKB::KKStrPtr KKB::osReadRestOfLine (std::istream &in, bool &eof)
 Extracts text up to and including the next end-of-line character and returns pointer to dynamical allocated str that caller will own. More...
 
KKB::KKStrPtr KKB::osReadRestOfLine (FILE *in, bool &eof)
 
KKB::KKStr KKB::osReadRestOfLine2 (std::istream &in, bool &eof)
 
KKB::KKStr KKB::osReadRestOfLine2 (FILE *in, bool &eof)
 
KKStr KKB::osRemoveExtension (const KKStr &_fullFileName)
 
bool KKB::osRenameFile (const KKStr &oldName, const KKStr &newName)
 
void KKB::osRunAsABackGroundProcess ()
 
void KKB::osSkipRestOfLine (FILE *in, bool &eof)
 Skips rest of the characters in the current line in the file. More...
 
void KKB::osSkipRestOfLine (std::istream &in, bool &eof)
 Skips rest of the characters in the current line in the input stream. More...
 
void KKB::osSleep (float numOfSecs)
 
void KKB::osSleepMiliSecs (kkuint32 numMiliSecs)
 
VectorKKStr KKB::osSplitDirectoryPathIntoParts (const KKStr &path)
 
KKB::KKStr KKB::osSubstituteInEnvironmentVariables (const KKStr &src)
 Substitute in the value of the environment variables into 'src'. More...
 
bool KKB::osValidDirectory (KKStrConstPtr _name)
 
bool KKB::osValidDirectory (const KKStr &_name)
 
bool KKB::osValidFileName (const KKStr &_name)
 
KKStrListPtr KKB::osValidFileNameErrors (const KKStr &_name)
 Returns list of errors in '_name' with respect to it being a valid file name for the O/S. More...
 
void KKB::osWaitForEnter ()
 

Detailed Description

General module for functions that interact with a specific operating system.

Author
Kurt Kramer

The idea is that as long as you use the functions in this module we should be able to work in both Unix and Windows world.

Definition in file OSservices.h.

Macro Definition Documentation

#define DS   "\\"

Definition at line 505 of file OSservices.h.

#define DSchar   '\\'

Definition at line 506 of file OSservices.h.