GL Studio C++ Runtime API
plugin.h
Go to the documentation of this file.
1/// \file plugin.h
2/// \brief The base class for GL Studio plugin file loaders, disti::Plugin.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2017 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<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
14/// reproduced, in whole or part, in any form, or by any means of electronic,
15/// mechanical, or otherwise, without the written permission of DiSTI. Said
16/// permission may be derived through the purchase of applicable DiSTI product
17/// licenses which detail the distribution rights of this content and any
18/// Derivative Works based on this or other copyrighted DiSTI Software.
19///
20/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26///
27/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34/// EXCEED FIVE DOLLARS (US$5.00).
35///
36/// The aforementioned terms and restrictions are governed by the laws of the
37/// State of Florida and the United States of America.
38
39#ifndef INCLUDED_GLS_RUNTIME_PLUGIN_H
40#define INCLUDED_GLS_RUNTIME_PLUGIN_H
41
42#include "gls_include.h"
43#include <cstring>
44#include <iostream>
45
46namespace disti
47{
48class DistiAttributePluginData;
49
50/** The Plugin class
51 */
52class Plugin
53{
54public:
55 /// For Polymorphic deletion
56 virtual ~Plugin() {} // = default;
57
58 /** \return A description string used for informational display
59 * by the plugin GUI
60 */
61 virtual const char* Description() = 0;
62
63 /** \return A version string used for informational display
64 * by the plugin GUI
65 */
66 virtual const char* Version() = 0;
67
68 /** \return The type of the plugin
69 */
70 virtual const char* PluginType() = 0;
71
72 /// Allows plugin to specify the name of its entry in the PluginData section of the .gls file.
73 /// This may contain spaces but shall not contain a ':' or a newline.
74 /// If this is not overriden, PluginData will not be saved or restored.
75 /// \return The unique identifier this plugin will use to store its data.
76 virtual const char* PluginDataName() { return NULL; }
77
78 /** Allows plugin to write out any persistant data
79 * in the form
80 * SomeAttribute: SomeValue
81 * Data must all be single-line.
82 * PluginDataName() must be overriden for this to be called.
83 */
84 virtual void WritePluginData( DistiAttributePluginData* /*pluginData*/ ) {}
85
86 /** Allows plugin to read in any persistant data
87 * of the form
88 * SomeAttribute: SomeValue
89 * Data will all be single-line.
90 * Data will be terminated by '}' or EOF
91 * PluginDataName() must be overriden for this to be called.
92 */
93 inline virtual void ReadPluginData( DistiAttributePluginData* /*pluginData*/ ) {}
94
95 /** Allows plugin to reset its attributes back to
96 * their default value. This allows for new documents
97 * to use the default attributes rather
98 * than whatever was used last
99 * PluginDataName() must be overriden for this to be called.
100 */
101 inline virtual void ResetPluginData() {}
102
103 /** Indicates if the plugin is of the specified type.
104 * \param str The type of the plugin
105 * \return true if plugin is the type specified
106 * \remarks Used by the plug-in manager as a workaround on systems where RTTI is broken
107 */
108 inline bool IsPluginType( const char* str ) { return 0 == std::strncmp( str, PluginType(), BUFSIZ ); }
109
110 /// Allows plugin to handle destruction of its own data.
111 virtual void Destroy() = 0;
112};
113
114} // namespace disti
115
116#endif
Definition: plugin.h:53
bool IsPluginType(const char *str)
Definition: plugin.h:108
virtual const char * PluginType()=0
virtual void WritePluginData(DistiAttributePluginData *)
Definition: plugin.h:84
virtual void ReadPluginData(DistiAttributePluginData *)
Definition: plugin.h:93
virtual const char * Description()=0
virtual void Destroy()=0
Allows plugin to handle destruction of its own data.
virtual const char * PluginDataName()
Definition: plugin.h:76
virtual ~Plugin()
For Polymorphic deletion.
Definition: plugin.h:56
virtual const char * Version()=0
virtual void ResetPluginData()
Definition: plugin.h:101
A file for all GL Studio files to include.
Definition: bmpimage.h:46