10 #ifndef __MQSDKPlugIn0x_11_h__
11 #define __MQSDKPlugIn0x_11_h__
21 #define WIN32_LEAN_AND_MEAN
23 #include <MQSetting.h>
24 #include <MQBasePlugin.h>
27 #include "impl/MQ0x_11.hpp"
30 #ifdef MQPLUGIN_VERSION
31 #if MQPLUGIN_VERSION < 0x0300
32 "MQx" need newer than mqsdk300
35 "MQx" need newer than mqsdk300
81 if ( pSrc != NULL )
for (
size_t i = 0; i < ct; i++ ) m_val = (m_val * (T_OUT)(
sizeof(T_IN) * 8 - 1)) ^ pSrc[i];
100 if ( pSrc != NULL )
while ( (*pSrc) != trailCode ) ret.m_val = (ret.m_val * (T_OUT)(
sizeof(T_IN) * 8 - 1)) ^ (*(pSrc++));
104 operator T_OUT() {
return m_val; }
127 template <
typename T_MQPLUGIN>
friend class PluginBase;
130 Handle( MQBasePlugin* plugin ) { this->plugin = plugin; }
131 MQBasePlugin* plugin;
136 bool Load(
const char *name,
bool& value,
bool default_value=
false);
137 bool Load(
const char *name,
int& value,
int default_value=0);
138 bool Load(
const char *name,
unsigned int& value,
unsigned int default_value=0);
139 bool Load(
const char *name,
float& value,
float default_value=0.0f);
140 bool Load(
const char *name, std::string& value, std::string default_value=
"");
141 bool Save(
const char *name,
const bool& value);
142 bool Save(
const char *name,
const int& value);
143 bool Save(
const char *name,
const unsigned int& value);
144 bool Save(
const char *name,
const float& value);
145 bool Save(
const char *name,
const char* value);
146 bool Save(
const char *name,
const std::string& value);
150 MQBasePlugin* m_plugin;
151 MQSetting* m_setting;
189 template <
typename T_MQPLUGIN>
class PluginBase :
public T_MQPLUGIN {
191 PluginBase(
const char* productName,
const char* pluginFullName,
const char* pluginString ) :
192 m_productName( productName ),
193 m_pluginFullName( pluginFullName ),
194 m_pluginString( pluginString ),
200 PluginBase(
const char* productName,
const char* pluginFullName,
const char* pluginString,
201 const DWORD idProduct,
const DWORD idPlugin ) :
202 m_productName( productName ),
203 m_pluginFullName( pluginFullName ),
204 m_pluginString( pluginString ),
205 m_idProduct( idProduct ),
206 m_idPlugin( idPlugin )
212 *Product = m_idProduct;
218 virtual const char *
EnumString() {
return m_pluginString.c_str(); }
230 const std::string m_productName;
231 const std::string m_pluginFullName;
232 const std::string m_pluginString;
233 const DWORD m_idProduct;
234 const DWORD m_idPlugin;
250 int index = prv_impl::GetIdentifiedIndex(doc, mat);
251 if ( index < 0 )
return false;
252 doc->DeleteMaterial(index);
return true;
257 int index = prv_impl::GetIdentifiedIndex(doc, obj);
258 if ( index < 0 )
return false;
259 doc->DeleteObject(index);
return true;
293 inline MQMaterial
GetMaterial(
const MQDocument doc,
const char* name ) {
return prv_impl::GetNamed<MQMaterial>( doc, name ); }
298 inline MQMaterial
GetMaterial(
const MQDocument doc,
const UINT
id ) {
307 return prv_impl::GetIdentified<MQMaterial>( doc, id );
320 inline int GetMaterialIndex(
const MQDocument doc,
const char* name ) {
return prv_impl::GetNamedIndex<MQMaterial>( doc, name ); }
323 inline int GetMaterialIndex(
const MQDocument doc,
const UINT
id ) {
return prv_impl::GetIdentifiedIndex<MQMaterial>( doc, id ); }
336 std::vector<char> buf;
338 return std::string(&buf[0]);
350 inline MQObject
GetObject(
const MQDocument doc,
const char* name ) {
return prv_impl::GetNamed<MQObject>( doc, name ); }
355 inline MQObject
GetObject(
const MQDocument doc,
const UINT
id ) {
356 #if 0x0310 <= MQPLUGIN_VERSION
357 if ( doc != NULL )
return doc->GetObjectFromUniqueID(
id);
360 return prv_impl::GetIdentified<MQObject>(doc, id );
365 inline int GetObjectIndex(
const MQDocument doc,
const char* name ) {
return prv_impl::GetNamedIndex<MQObject>( doc, name ); }
368 inline int GetObjectIndex(
const MQDocument doc,
const UINT
id ) {
return prv_impl::GetIdentifiedIndex<MQObject>(doc, id ); }
370 #if 0x0310 <= MQPLUGIN_VERSION
376 return prv_impl::GetUnusedNameString<MQMaterial>( doc, base_name );
383 if ( base_name_material == NULL )
return prv_impl::GetUnusedNameString<MQMaterial>( doc );
384 return prv_impl::GetUnusedNameString<MQMaterial>( doc,
GetName( base_name_material ).c_str() );
390 return prv_impl::GetUnusedNameString<MQObject>( doc, base_name );
397 if ( base_name_object == NULL )
return prv_impl::GetUnusedNameString<MQMaterial>( doc );
398 return prv_impl::GetUnusedNameString<MQMaterial>( doc,
GetName( base_name_object ).c_str() );
407 namespace prv_impl {};