project_item.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 
30 #pragma once
31 
32 namespace clan
33 {
36 
37 class Project;
38 
40 {
41 public:
42  ProjectItem();
43  virtual ~ProjectItem();
44  virtual std::string get_name() const;
45  virtual Project *get_project() const { return parent()->get_project(); }
46 
47  std::string get_filename();
48  std::string get_project_relative_filename();
49  std::string get_location();
50 
51  ProjectItem *parent() const;
52  const std::vector<ProjectItem *> &children() const;
53 
54  void add(ProjectItem *item);
55  ProjectItem *remove(int index);
56  void clear();
57 
58 protected:
59  virtual std::string parent_path_combine(bool project_relative);
60  std::string get_parent_path(bool project_relative);
61 
62 private:
63  ProjectItem *_parent;
64  std::vector<ProjectItem *> _children;
65 };
66 
68 {
69 public:
71  std::string get_name() const;
72  Project *get_project() const { return project; }
73 
75 
76 protected:
77  std::string parent_path_combine(bool project_relative);
78 };
79 
81 {
82 public:
83  ProjectFolderItem(std::string path);
84  std::string get_name() const;
85 
86  std::string path;
87 
88 protected:
89  std::string parent_path_combine(bool project_relative);
90 };
91 
93 {
94 public:
95  ProjectFilterItem(std::string name);
96  std::string get_name() const;
97 
98  std::string name;
99 
100 protected:
101  std::string parent_path_combine(bool project_relative);
102 };
103 
105 {
106 public:
107  ProjectFileItem(std::string filename);
108  std::string get_name() const;
109 
110  std::string filename;
111 
112 protected:
113  std::string parent_path_combine(bool project_relative);
114 };
115 
116 }
117 
std::string get_parent_path(bool project_relative)
void add(ProjectItem *item)
Definition: project_item.h:104
std::string get_name() const
Definition: project_item.h:80
const std::vector< ProjectItem * > & children() const
ProjectItem * parent() const
std::string parent_path_combine(bool project_relative)
std::string name
Definition: project_item.h:98
Definition: project_item.h:39
Project * get_project() const
Definition: project_item.h:72
ProjectFolderItem(std::string path)
std::string parent_path_combine(bool project_relative)
virtual Project * get_project() const
Definition: project_item.h:45
virtual ~ProjectItem()
std::string get_location()
Definition: project_item.h:67
virtual std::string get_name() const
ProjectFileItem(std::string filename)
std::string get_name() const
std::string get_filename()
virtual std::string parent_path_combine(bool project_relative)
Project * project
Definition: project_item.h:74
std::string get_name() const
Definition: project_item.h:92
ProjectFilterItem(std::string name)
std::string parent_path_combine(bool project_relative)
std::string filename
Definition: project_item.h:110
std::string get_name() const
Definition: project.h:39
std::string get_project_relative_filename()
std::string path
Definition: project_item.h:86
std::string parent_path_combine(bool project_relative)