forked from sarnold/cccc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDevStudioFileStore.h
72 lines (55 loc) · 2.63 KB
/
DevStudioFileStore.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
// DevStudioFileStore.h: interface for the DevStudioFileStore class.
//
// This file defines a class DevStudioFileStore which exists to encapsulate
// the operations required to parse the .dsp and .dsw files used by
// MS Developer studio and get the names of the files in any or all of the
// projects in the workspace.
#if !defined(AFX_DEVSTUDIOFILESTORE_H__76B7B6C2_AA85_11D3_AFED_444553540000__INCLUDED_)
#define AFX_DEVSTUDIOFILESTORE_H__76B7B6C2_AA85_11D3_AFED_444553540000__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <string>
#include <set>
#include <map>
// The answers to queries on the class below will be
// a collection of names.
// For the moment, I can't see why we would not want to have
// an automatically sorted list with duplicates eliminated.
typedef std::set<std::string> FilenameList;
class DevStudioFileStore
{
public:
DevStudioFileStore(IApplication *pApp, const std::string& wsDir, const std::string& wsName);
virtual ~DevStudioFileStore();
void listWorkspaceFiles(FilenameList& fileList);
void listProjectFiles(std::string projectName, FilenameList& fileList);
// A diagnostic function to list the files in each project
void dumpProjectFileList();
// a function to propose a working directory for the run.
// If the IApplication object allowed access to the
// path to the .dsw file, this would be an excellent
// choice, but as it is there is no way of getting this,
// so we propose either the directory containing the active
// project (if one exists), or the directory containing
// the active document (if one exists), or the current directory.
std::string suggestedWorkingDirectory();
private:
IApplication* m_pApplication;
std::string m_WorkspaceName;
std::string m_WorkspaceDirectory;
typedef std::map<std::string,FilenameList> ProjectFileStore;
ProjectFileStore m_ProjectFileStore;
// A utility function to accept a base directory and a relative file name,
// and translate to the canonical name of the file they specify.
std::string composeFilename(const std::string& baseDir, const std::string& relname);
// A utility function to open a .dsp or .dsw file, search for lines with a
// given prefix, and translate the remainder of those lines to filenames
// using the location of the opened file as the base directory.
void collectFilenames(const std::string& dsFile, const std::string& pfx,
FilenameList& fileList);
// A utility function to copy a std::string (or by implicit conversion
// a const char*) to the Macro output tab.
void dump(const std::string& str);
};
#endif // !defined(AFX_DEVSTUDIOFILESTORE_H__76B7B6C2_AA85_11D3_AFED_444553540000__INCLUDED_)