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 _PLUGIN_H
42 #define _PLUGIN_H
43 
44 #include "gls_include.h"
45 #include <iostream>
46 #include <string.h>
47 
48 namespace disti
49 {
50 class DistiAttributePluginData;
51 
52 /** The Plugin class
53  */
54 class Plugin
55 {
56 public:
57  /** \return A description string used for informational display
58  * by the plugin GUI
59  */
60  virtual const char* Description( void ) = 0;
61 
62  /** \return A version string used for informational display
63  * by the plugin GUI
64  */
65  virtual const char* Version( void ) = 0;
66 
67  /** \return The type of the plugin
68  */
69  virtual const char* PluginType( void ) = 0;
70 
71  /** Allows plugin to specify the name of
72  * its entry in the PluginData section
73  * of the .gls file.
74  * This may contain spaces but shall not contain a ':' or a newline.
75  * If this is not overriden, PluginData will
76  * not be saved or restored.
77  */
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  inline bool IsPluginType( const char* str ) { return !strcmp( str, PluginType() ); }
111 
112  /* Allows plugin to handle destruction of its own data.
113  */
114  virtual void Destroy() = 0;
115 };
116 
117 } // namespace disti
118 
119 #endif
virtual const char * PluginType(void)=0
Definition: plugin.h:54
A file for all GL Studio files to include.
virtual const char * Version(void)=0
virtual const char * Description(void)=0
virtual void ResetPluginData()
Definition: plugin.h:103
virtual const char * PluginDataName()
Definition: plugin.h:78
bool IsPluginType(const char *str)
Definition: plugin.h:110
Definition: bmpimage.h:46
virtual void ReadPluginData(DistiAttributePluginData *)
Definition: plugin.h:95
virtual void WritePluginData(DistiAttributePluginData *)
Definition: plugin.h:86