GL Studio C++ Runtime API
gls_resources.h
Go to the documentation of this file.
1/*! \file
2 \brief disti::GlsResourceFilter classes and methods.
3
4 \par Copyright Information
5
6 Copyright (c) 2017 by The DiSTI Corporation.<br>
7 11301 Corporate Blvd; Suite 100<br>
8 Orlando, Florida 32817<br>
9 USA<br>
10 <br>
11 All rights reserved.<br>
12
13 This Software contains proprietary trade secrets of DiSTI and may not be
14reproduced, in whole or part, in any form, or by any means of electronic,
15mechanical, or otherwise, without the written permission of DiSTI. Said
16permission may be derived through the purchase of applicable DiSTI product
17licenses which detail the distribution rights of this content and any
18Derivative Works based on this or other copyrighted DiSTI Software.
19
20 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26
27 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34EXCEED FIVE DOLLARS (US$5.00).
35
36 The aforementioned terms and restrictions are governed by the laws of the
37State of Florida and the United States of America.
38
39*/
40
41#ifndef _GLS_RESOURCES_H
42#define _GLS_RESOURCES_H
43
44#include "display_frame.h"
45
46namespace disti
47{
48/** Used for specifiying a filter for accessing resources
49 */
51{
52public:
53 int _levelsUp; ///< Levels of qualification to show in names, -1 is fully qualified.
54 int _groupLevelsDown; ///< How many levels to recurse through groups, -1 is fully recursive.
55 DynamicArray<char*> _excludeList; ///< List of names to exclude from the filter, takes precedence over includes.
56 DynamicArray<char*> _includeList; ///< List of names to include, if empty all names are acceptable.
57 bool _namesOnly; ///< If true, will return names only, and not names and values.
58 DynamicArray<const char*> _parentNameStack; ///< List of parent names, used to append to the name during traversal.
59
60public:
62
63 /// Copy constructor
64 /// \param source The object to copy from.
66
67 /// Copy constructor
68 /// \param source The object to copy from.
70
72
73 /// How many levels of qualification above the starting point to show in the attribute names.
74 /// This is based on the component heirarchy, not the draw hierarchy.
75 /// For example if you call Altimeter->GetResources() with:
76 /// LevelsUp = 0, expect:
77 /// Altitude: 1000
78 /// LevelsUp = 1, expect:
79 /// Altimeter.Altitude:
80 /// LevelsUp = 2, expect:
81 /// Cockpit.Altimeter.Altitude:
82 /// -1 means full qualification.
83 /// \param value The new qualification level value to set.
84 inline void LevelsUp( int value ) { _levelsUp = value; }
85
86 /// \return Te number of levels of qualification.
87 inline int LevelsUp() { return _levelsUp; }
88
89 /// How many levels of children to show.
90 /// This is different from LevelsUp because this is based on the draw
91 /// heirarchy (Groups rather than components).
92 /// For example with:
93 /// GroupLevelsDown = 0, only the specified object's resources will be shown.
94 /// GroupLevelsDown = 1, only the immeadiate children of the object's resources will be shown.
95 /// GroupLevelsDown = -1, means all children will be shown.
96 /// Note that the name stays fully qualified for the children. For example:
97 /// if GroupLevelsDown == 1 the results would include:
98 /// Altimeter.Visible: 1
99 /// Altimeter.Group1.Visible: 1
100 /// but NOT:
101 /// Altimeter.Group1.Poly.Visible: 1
102 /// \param value The new group traversal level to set.
103 inline void GroupLevelsDown( int value ) { _groupLevelsDown = value; }
104
105 /// \return The number of group levels to traverse.
106 inline int GroupLevelsDown() { return _groupLevelsDown; }
107
108 /// If true, only a list of names will be returned.
109 /// Values will not be returned.
110 /// The format changes to not include the ":".
111 /// \param value The new names only flag to set.
112 inline void NamesOnly( bool value ) { _namesOnly = value; }
113
114 /// \return Whether names only, or names and values will be returned.
115 inline bool NamesOnly() { return _namesOnly; }
116
117 /// Add a resource name to the exclude filter
118 /// Resources on the exclude list will not pass the filter.
119 /// Excludes take precedence over includes.
120 /// \param name The new name to add to the exclude list.
121 void GLS_EXPORT AddExclude( const char* name );
122
123 /// \return The number of exclude entries in the filter.
124 GLS_EXPORT unsigned int ExcludeCount() const;
125
126 /// \return The resource name for the given exclude list entry.
127 /// \param index < ExcludeCount()
128 GLS_EXPORT const char* GetExclude( unsigned int index ) const;
129
130 /// Removes a entry from the exclude list
131 /// This will reduce the ExcludeCount()
132 /// \param index < ExcludeCount()
133 GLS_EXPORT void RemoveExclude( unsigned int index );
134
135 /// Removes all entries from the exclude list
137
138 /// Add a resource name to the include filter
139 /// If there are no includes specified, all resources
140 /// will pass the filter by default.
141 /// If IncludeCount() > 0, then only resources that
142 /// are included will pass the filter.
143 /// \param name The new name to add to the include list.
144 void GLS_EXPORT AddInclude( const char* name );
145
146 /// \return The number of includes in the filter.
147 GLS_EXPORT unsigned int IncludeCount() const;
148
149 /// \return The resource name for the given include list entry.
150 /// \param index < IncludeCount()
151 GLS_EXPORT const char* GetInclude( unsigned int index ) const;
152
153 /// Removes a entry from the include list.
154 /// This will reduce the IncludeCount().
155 /// \param index < IncludeCount()
156 GLS_EXPORT void RemoveInclude( unsigned int index );
157
158 /// Removes all entries from the include list
160
161 /// \return The qualified name for a DisplayFrame.
162 /// \param frame The object to build the name for.
163 /// \param filter The filter currently in use (as this is a static function).
164 static GLS_EXPORT std::string BuildHierarchyName( DisplayFrame* frame, GlsResourceFilter* filter );
165
166 /// \return The qualified name for a DisplayObject.
167 /// \param obj The object to build the name for.
168 /// \param filter The filter currently in use (as this is a static function).
170
171 /// Test a resource name against the filter.
172 /// \param name The name to test against the filter.
173 /// \return True if the name passes.
174 virtual GLS_EXPORT bool PassFilter( const char* name );
175
176 /// Pushes a parent name onto the filter's parent stack. This is a list of names of objects
177 /// that represents the hierarchy above this object; this should be used by the
178 /// BuildHierarchyName to prepend the parent names when in the editor, as we don't have the
179 /// ComponentBase's Parent frame pointers available.
180 /// \param parent The new parent name to push onto the stack.
181 GLS_EXPORT void PushParentName( const char* parent );
182
183 /// \return The size of the parent name stack.
184 GLS_EXPORT unsigned int ParentNameCount() const;
185
186 /// \return The parent name for the given position on the stack.
187 /// \param index The index of the parent name to return.
188 GLS_EXPORT const char* GetParentName( unsigned int index ) const;
189
190 /// Removes the top entry on the parent name stack.
192
193 /// Removes all entries on the parent name stack.
195
196 /// Assignment operator
197 /// \param rhs The object to copy from.
198 /// \return The resulting object (this).
200};
201
202} // namespace disti
203
204#endif
Definition: display_frame.h:87
Definition: display.h:96
Definition: gls_resources.h:51
void LevelsUp(int value)
Definition: gls_resources.h:84
unsigned int IncludeCount() const
void PopParentName()
Removes the top entry on the parent name stack.
const char * GetInclude(unsigned int index) const
int _groupLevelsDown
How many levels to recurse through groups, -1 is fully recursive.
Definition: gls_resources.h:54
int LevelsUp()
Definition: gls_resources.h:87
DynamicArray< char * > _excludeList
List of names to exclude from the filter, takes precedence over includes.
Definition: gls_resources.h:55
GlsResourceFilter & operator=(const GlsResourceFilter &rhs)
void ClearParentNames()
Removes all entries on the parent name stack.
void PushParentName(const char *parent)
void ClearExcludes()
Removes all entries from the exclude list.
void RemoveExclude(unsigned int index)
unsigned int ExcludeCount() const
GlsResourceFilter(GlsResourceFilter &source)
static std::string BuildHierarchyName(DisplayObject *obj, GlsResourceFilter *filter)
DynamicArray< char * > _includeList
List of names to include, if empty all names are acceptable.
Definition: gls_resources.h:56
void ClearIncludes()
Removes all entries from the include list.
static std::string BuildHierarchyName(DisplayFrame *frame, GlsResourceFilter *filter)
bool NamesOnly()
Definition: gls_resources.h:115
GlsResourceFilter(GlsResourceFilter *source)
const char * GetExclude(unsigned int index) const
void NamesOnly(bool value)
Definition: gls_resources.h:112
int _levelsUp
Levels of qualification to show in names, -1 is fully qualified.
Definition: gls_resources.h:53
bool _namesOnly
If true, will return names only, and not names and values.
Definition: gls_resources.h:57
DynamicArray< const char * > _parentNameStack
List of parent names, used to append to the name during traversal.
Definition: gls_resources.h:58
void AddInclude(const char *name)
unsigned int ParentNameCount() const
virtual bool PassFilter(const char *name)
const char * GetParentName(unsigned int index) const
void AddExclude(const char *name)
void RemoveInclude(unsigned int index)
void GroupLevelsDown(int value)
Definition: gls_resources.h:103
int GroupLevelsDown()
Definition: gls_resources.h:106
The disti::DisplayFrame class.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47