-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwxcHelper.h
67 lines (56 loc) · 1.91 KB
/
wxcHelper.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
#ifndef WXCHELPER_H
#define WXCHELPER_H
#include <vector>
#include <wx/filename.h>
#include <cbproject.h>
class cbProject;
struct StrToFileNameVecFunctor {
std::vector<wxFileName>& m_outoutVec;
StrToFileNameVecFunctor(std::vector<wxFileName>& outputVec) : m_outoutVec( outputVec) {}
void operator()(const wxString &str) {
m_outoutVec.push_back( wxFileName(str) );
}
};
typedef std::vector<wxFileName> wxFileNameVec_t;
class wxcHelper
{
public:
/**
* @brief create an empty file. Prompt the user incase of an error
*/
static bool CreateEmptyFile( const wxFileName& fn );
/**
* @brief add files to project
*/
static void AddFilesToProject(cbProject* proj, const std::vector<wxFileName>& files, bool compile);
/**
* @brief add file to project
*/
static void AddFileToProject(cbProject* proj, const wxFileName& file, bool compile);
/**
* @brief find a project by name
*/
static cbProject* GetProject( const wxString &name );
/**
* @brief return all workspace files
* @param files [output]
*/
static void GetAllFiles( FilesList &files, const wxString &filterExt = wxEmptyString );
/**
* @brief extract a file from Zip archive
* @param zipPath zip file path
* @param filename the file that we want to extract
* @param targetDir destination folder for the extracted file
* @param targetFileName [output]
*/
static bool ExtractFileFromZip(const wxString& zipPath, const wxString& filename, const wxString& targetDir, wxString &targetFileName);
/**
* @brief read a file content
*/
static bool ReadFileContent( const wxString& filepath, wxString &content );
/**
* @brief write file content (replacing any existing content)
*/
static bool WriteFileContent( const wxString& filepath, const wxString &content );
};
#endif // WXCHELPER_H