-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcollisions.h
114 lines (94 loc) · 2.25 KB
/
collisions.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* collisions.h - Proof of concept for a Delphi Obfuscator
*
* Copyright (c) 2005 - 2007 Sebastian Porst ([email protected])
* All rights reserved.
*
* This software is licensed under the zlib/libpng License.
* For more details see http://www.opensource.org/licenses/zlib-license.php
*/
#ifndef COLLISIONS_H
#define COLLISIONS_H
#include "VMTDir.h"
#include "DFMParser.h"
void checkStringCollisions(DFMData& dfmres, const VMTDir& vmtdir);
// TODO: Add some way to stop traversal of directories.
/**
* This class is used to search for components with a given name.
**/
class ComponentFinder : public DFMVisitor
{
private:
/**
* The name of the component to search.
**/
std::string searchString;
/**
* Flag that indicates whether the search was successful.
**/
bool foundString;
/**
* The found resource (or 0).
**/
const DFMResource* res;
protected:
/**
* Called for each DFMResource in the DFM directory.
**/
virtual void resourceCallback(DFMResource* res);
/**
* Called for each DFMProperty in the DFM directory;
**/
virtual void propertyCallback(DFMProperty& property);
public:
/**
* Creates a new ComponentFinder object.
**/
ComponentFinder(const std::string& searchString);
/**
* Flag that indicates whether the search was succesful.
**/
bool found() const;
/**
* Found resource or 0.
**/
const DFMResource* foundResource() const;
};
/**
* This class is used to find string collisions (see checkStringCollisions for
* a description).
**/
class CollisionVisitor : public DFMVisitor
{
private:
/**
* The DFM directory to traverse.
**/
DFMData& dfmData;
/**
* The VMT Directory that's synchronized with the DFMDirectory.
**/
const VMTDir& vmtDir;
/**
* The last traversed resource.
**/
const DFMResource* lastResource;
protected:
/**
* Called for each DFMResource in the DFM directory.
**/
virtual void resourceCallback(DFMResource* res);
/**
* Called for each DFMProperty in the DFM directory;
**/
virtual void propertyCallback(DFMProperty& property);
public:
/**
* Creates a new CollisionVisitor object.
*
* @param dfmData A DFM directory.
* @param vmtDir A VMT directory.
**/
CollisionVisitor(DFMData& dfmData, const VMTDir& vmtDir);
};
#endif