-
Notifications
You must be signed in to change notification settings - Fork 17
/
Utils.h
52 lines (41 loc) · 1.54 KB
/
Utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// --------------------------------------------------------------------------
//
// File
// Name: Utils.h
// Purpose: Utility function
// Created: 2003/07/31
//
// --------------------------------------------------------------------------
#ifndef UTILS__H
#define UTILS__H
#include <string>
#include <vector>
#include "MemLeakFindOn.h"
std::string GetBoxBackupVersion();
void SplitString(std::string String, char SplitOn, std::vector<std::string> &rOutput);
bool StartsWith(const std::string& prefix, const std::string& haystack);
bool EndsWith(const std::string& prefix, const std::string& haystack);
std::string RemovePrefix(const std::string& prefix, const std::string& haystack,
bool force = true);
std::string RemoveSuffix(const std::string& suffix, const std::string& haystack,
bool force = true);
void DumpStackBacktrace(const std::string& filename);
void DumpStackBacktrace(const std::string& filename, size_t size, void * const * array);
std::string GetTempDirPath();
bool FileExists(const std::string& rFilename, int64_t *pFileSize = 0,
bool TreatLinksAsNotExisting = false);
typedef enum
{
ObjectExists_Unknown = -1,
ObjectExists_NoObject = 0,
ObjectExists_File = 1,
ObjectExists_Dir = 2
} object_exists_t;
object_exists_t ObjectExists(const std::string& rFilename);
std::string HumanReadableSize(int64_t Bytes);
std::string FormatUsageBar(int64_t Blocks, int64_t Bytes, int64_t Max,
bool MachineReadable);
std::string FormatUsageLineStart(const std::string& rName,
bool MachineReadable);
#include "MemLeakFindOff.h"
#endif // UTILS__H