| GL Studio C++ Runtime API

plugin.h
Go to the documentation of this file.
1/*! \file
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 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
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*/
40
41#ifndef INCLUDED_GLS_RUNTIME_PLUGIN_H
42#define INCLUDED_GLS_RUNTIME_PLUGIN_H
43
44#include "gls_include.h"
45#include <cstring>
46#include <iostream>
47
48 namespace disti
49{
50 class DistiAttributePluginData;
51
52/** The Plugin class
53 */
54 class Plugin
55{
56 public:
57 /// For Polymorphic deletion
58 virtual ~Plugin() {} // = default;
59
60 /** \return A description string used for informational display
61 * by the plugin GUI
62 */
63 virtual const char* Description() = 0;
64
65 /** \return A version string used for informational display
66 * by the plugin GUI
67 */
68 virtual const char* Version() = 0;
69
70 /** \return The type of the plugin
71 */
72 virtual const char* PluginType() = 0;
73
74 /// Allows plugin to specify the name of its entry in the PluginData section of the .gls file.
75 /// This may contain spaces but shall not contain a ':' or a newline.
76 /// If this is not overriden, PluginData will not be saved or restored.
77 /// \return The unique identifier this plugin will use to store its data.
78 virtual const char* PluginDataName() { return NULL; }
79
80 /** Allows plugin to write out any persistant data
81 * in the form
82 * SomeAttribute: SomeValue
83 * Data must all be single-line.
84 * PluginDataName() must be overriden for this to be called.
85 */
86 virtual void WritePluginData( DistiAttributePluginData* /*pluginData*/ ) {}
87
88 /** Allows plugin to read in any persistant data
89 * of the form
90 * SomeAttribute: SomeValue
91 * Data will all be single-line.
92 * Data will be terminated by '}' or EOF
93 * PluginDataName() must be overriden for this to be called.
94 */
95 virtual void ReadPluginData( DistiAttributePluginData* /*pluginData*/ ) {}
96
97 /** Allows plugin to reset its attributes back to
98 * their default value. This allows for new documents
99 * to use the default attributes rather
100 * than whatever was used last
101 * PluginDataName() must be overriden for this to be called.
102 */
103 virtual void ResetPluginData() {}
104
105 /** Indicates if the plugin is of the specified type.
106 * \param str The type of the plugin
107 * \return true if plugin is the type specified
108 * \remarks Used by the plug-in manager as a workaround on systems where RTTI is broken
109 */
110 bool IsPluginType( const char* str ) { return 0 == std::strncmp( str, PluginType(), BUFSIZ ); }
111
112 /// Allows plugin to handle destruction of its own data.
113 virtual void Destroy() = 0;
114};
115
116} // namespace disti
117
118#endif
disti::Plugin
Definition: plugin.h:55
disti::Plugin::IsPluginType
bool IsPluginType(const char *str)
Definition: plugin.h:110
disti::Plugin::PluginType
virtual const char * PluginType()=0
disti::Plugin::WritePluginData
virtual void WritePluginData(DistiAttributePluginData *)
Definition: plugin.h:86
disti::Plugin::ReadPluginData
virtual void ReadPluginData(DistiAttributePluginData *)
Definition: plugin.h:95
disti::Plugin::Description
virtual const char * Description()=0
disti::Plugin::Destroy
virtual void Destroy()=0
Allows plugin to handle destruction of its own data.
disti::Plugin::PluginDataName
virtual const char * PluginDataName()
Definition: plugin.h:78
disti::Plugin::~Plugin
virtual ~Plugin()
For Polymorphic deletion.
Definition: plugin.h:58
disti::Plugin::Version
virtual const char * Version()=0
disti::Plugin::ResetPluginData
virtual void ResetPluginData()
Definition: plugin.h:103
gls_include.h
A file for all GL Studio files to include.
disti
Definition: bmpimage.h:47