-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathUtils.h
48 lines (37 loc) · 1.48 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
//
// Created by Vladimir on 20.06.20.
//
#ifndef AVCLEANER_UTILS_H
#define AVCLEANER_UTILS_H
#include <iostream>
namespace Utils {
/**
* @brief generates a random string of size Length.
* @param Length desired length of the generated string.
* @return a random string of size Length.
*/
extern std::string randomString(unsigned long Length);
/**
* used to replace a string literal by a variable's identifier
* must not collide with existing identifiers.
* Format: 12-first characters, letters only + random part
* TODO: remember allocated identifiers for collision prevention
* TODO: extract constants into readable identifiers.
* @param StrLiteral the string literal
*/
extern std::string translateStringToIdentifier(const std::string &StrLiteral);
/**
* strip metacharacters decorating a string.
* For instance, L"ntdll" -> ntdll
* @param Argument the string to be cleaned.
*/
extern void cleanParameter(std::string &Argument);
/**
* @brief declares and instantiate a variable holding a string that was moved out from a function's arguments.
* @param StringIdentifier the new variable identifier.
* @param StringValue the actual value of the string literal.
* @return the generated code snippet.
*/
extern std::string generateVariableDeclaration(const std::string &StringIdentifier, const std::string &StringValue, std::string StringType="");
};
#endif //AVCLEANER_UTILS_H