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
75  * its entry in the PluginData section
76  * of the .gls file.
77  * This may contain spaces but shall not contain a ':' or a newline.
78  * If this is not overriden, PluginData will
79  * not be saved or restored.
80  */
81  virtual const char* PluginDataName() { return NULL; }
82 
83  /** Allows plugin to write out any persistant data
84  * in the form
85  * SomeAttribute: SomeValue
86  * Data must all be single-line.
87  * PluginDataName() must be overriden for this to be called.
88  */
89  virtual void WritePluginData( DistiAttributePluginData* /*pluginData*/ ) {}
90 
91  /** Allows plugin to read in any persistant data
92  * of the form
93  * SomeAttribute: SomeValue
94  * Data will all be single-line.
95  * Data will be terminated by '}' or EOF
96  * PluginDataName() must be overriden for this to be called.
97  */
98  virtual void ReadPluginData( DistiAttributePluginData* /*pluginData*/ ) {}
99 
100  /** Allows plugin to reset its attributes back to
101  * their default value. This allows for new documents
102  * to use the default attributes rather
103  * than whatever was used last
104  * PluginDataName() must be overriden for this to be called.
105  */
106  virtual void ResetPluginData() {}
107 
108  /** Indicates if the plugin is of the specified type.
109  * \param str The type of the plugin
110  * \return true if plugin is the type specified
111  * \remarks Used by the plug-in manager as a workaround on systems where RTTI is broken
112  */
113  bool IsPluginType( const char* str ) { return 0 == std::strncmp( str, PluginType(), BUFSIZ ); }
114 
115  /* Allows plugin to handle destruction of its own data.
116  */
117  virtual void Destroy() = 0;
118 };
119 
120 } // namespace disti
121 
122 #endif
virtual ~Plugin()
For Polymorphic deletion.
Definition: plugin.h:58
virtual const char * PluginType()=0
virtual const char * Description()=0
Definition: plugin.h:54
A file for all GL Studio files to include.
virtual const char * Version()=0
virtual void ResetPluginData()
Definition: plugin.h:106
virtual const char * PluginDataName()
Definition: plugin.h:81
bool IsPluginType(const char *str)
Definition: plugin.h:113
Definition: bmpimage.h:46
virtual void ReadPluginData(DistiAttributePluginData *)
Definition: plugin.h:98
virtual void WritePluginData(DistiAttributePluginData *)
Definition: plugin.h:89