Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 1 | /** |
Jon Medhurst | b1d0744 | 2015-05-08 12:04:18 +0100 | [diff] [blame] | 2 | * Copyright (C) ARM Limited 2010-2015. All rights reserved. |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #ifndef OLY_UTILITY_H |
| 10 | #define OLY_UTILITY_H |
| 11 | |
| 12 | #include <stddef.h> |
| 13 | |
| 14 | #ifdef WIN32 |
| 15 | #define PATH_SEPARATOR '\\' |
| 16 | #define CAIMAN_PATH_MAX MAX_PATH |
| 17 | #define snprintf _snprintf |
| 18 | #else |
| 19 | #include <limits.h> |
| 20 | #define PATH_SEPARATOR '/' |
| 21 | #define CAIMAN_PATH_MAX PATH_MAX |
| 22 | #endif |
| 23 | |
| 24 | class OlyUtility { |
| 25 | public: |
| 26 | OlyUtility() {}; |
| 27 | ~OlyUtility() {}; |
| 28 | bool stringToBool(const char* string, bool defValue); |
| 29 | void stringToLower(char* string); |
| 30 | int getApplicationFullPath(char* path, int sizeOfPath); |
| 31 | char* readFromDisk(const char* file, unsigned int *size = NULL, bool appendNull = true); |
| 32 | int writeToDisk(const char* path, const char* file); |
| 33 | int appendToDisk(const char* path, const char* file); |
| 34 | int copyFile(const char* srcFile, const char* dstFile); |
| 35 | const char* getFilePart(const char* path); |
| 36 | char* getPathPart(char* path); |
| 37 | private: |
| 38 | }; |
| 39 | |
| 40 | extern OlyUtility* util; |
| 41 | |
| 42 | #endif // OLY_UTILITY_H |