Exemplo n.º 1
0
/*!

\brief Serializes the states in a RuntimeContext and stores the result in a Config
object.
\ingroup Runtime
\details Format of the returned Config object:
\code
<runtime>
   <state name="String"/>
</runtime>
\endcode

- \b state.name String containing the name of the state.

\param[in] context Pointer to the RuntimeContext to serialize.
\return Returns a Config object containing the serialized states in the
RuntimeContext.

*/
dmz::Config
dmz::runtime_states_to_config (RuntimeContext *context) {

   RuntimeContextDefinitions *defs = (context ? context->get_definitions_context () : 0);

   Config result (RuntimeName);

   if (defs) {

      defs->ref ();

      StringContainer list;

      Definitions (context).get_state_names (list);

      StringContainerIterator it;
      String name;

      while (list.get_next (it, name)) {

         Config data ("state");
         data.store_attribute ("name", name);
         result.add_config (data);
      }

      defs->unref ();
   }

   return result;
}
Exemplo n.º 2
0
void
dmz::QtPluginIconPalletTool::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   _showMsg = config_create_message (
      "show.name",
      local,
      "DMZ_Show_Icon_Pallet_Tool",
      context);

   subscribe_to_message (_showMsg);

   _useSession = config_to_boolean ("use-session.value", local, _useSession);

   if (_useSession && context) {

      Config session (get_session_config (get_plugin_name (), context));

      QByteArray geometry (config_to_qbytearray ("geometry", session, saveGeometry ()));
      restoreGeometry (geometry);

      if (config_to_boolean ("window.visible", session, False)) { show (); }
   }

   _ui.iconView->setModel (&_model);

   _add_type (Definitions (context).get_root_object_type ());
}
Exemplo n.º 3
0
 State (
       const String &TheName,
       const PluginDeleteModeEnum TheDeleteMode,
       RuntimeContext *theContext) :
       _handlePtr (TheName ? 0 : new RuntimeHandle ("Plugin", theContext)),
       Name (TheName),
       PluginHandle (_handlePtr ?
          _handlePtr->get_runtime_handle () :
          Definitions (theContext).create_named_handle (TheName)),
       deleteMode (TheDeleteMode),
       context (0),
       lib (0) {;}
Exemplo n.º 4
0
/*!

\brief Serializes the EventType definitions in a RuntimeContext and stores the result
in a Config object.
\ingroup Runtime
\details Format of the returned Config object:
\code
<runtime>
   <event-type name="String" parent="String"/>
</runtime>
\endcode

- \b event-type.name String containing the name of the EventType.
- \b event-type.parent String containing the name of the parent EventType.
- \b event-type.* Config data of the EventType.

\param[in] context Pointer to the RuntimeContext to serialize.
\return Returns a Config object containing the serialized EventType definitions in the
RuntimeContext.

*/
dmz::Config
dmz::runtime_event_types_to_config (RuntimeContext *context) {

   RuntimeContextDefinitions *defs = (context ? context->get_definitions_context () : 0);

   Config result (RuntimeName);

   if (defs) {

      defs->ref ();

      const EventType RootEventType = Definitions (context).get_root_event_type ();

      HashTableHandleIterator it;
      ObjectType *otype (0);
      EventType *etype (0);

      while (defs->eventHandleTable.get_next (it, etype)) {

         if (RootEventType != *etype) {

            Config data ("event-type");
            data.store_attribute ("name", etype->get_name ());
            EventType parent = etype->get_parent ();

            if (parent != RootEventType) {

               data.store_attribute ("parent", parent.get_name ());
            }

            data.add_children (etype->get_config ());

            result.add_config (data);
         }
      }

      defs->unref ();
   }

   return result;
}
Exemplo n.º 5
0
   State (
         const String &TheName,
         const String &TheClassName,
         const String &TheFactoryName,
         const String &TheScopeName,
         const PluginDeleteModeEnum TheDeleteMode,
         RuntimeContext *theContext,
         DynamicLibrary *theLib) :
         _handlePtr (TheName ? 0 : new RuntimeHandle ("Plugin", theContext)),
         Name (TheName ? TheName : "Unnamed Component"),
         ClassName (TheClassName),
         FactoryName (TheFactoryName),
         ScopeName (TheScopeName),
         PluginHandle (_handlePtr ?
            _handlePtr->get_runtime_handle () :
            Definitions (theContext).create_named_handle (TheName)),
         deleteMode (TheDeleteMode),
         context (theContext),
         lib (theLib) {

      if (context) { context->ref (); }
   }
Exemplo n.º 6
0
/*!

\brief Serializes the Message definitions in a RuntimeContext and stores the result in a
Config object.
\ingroup Runtime
\details Format of the returned Config object:
\code
<runtime>
   <message name="String" monostate="Boolean"/>
</runtime>
\endcode

- \b message.name String containing the name of the Message.
- \b message.monostate Boolean indicating if the message has a monostate.

\param[in] context Pointer to the RuntimeContext to serialize.
\return Returns a Config object containing the serialized Message definitions in the
RuntimeContext.

*/
dmz::Config
dmz::runtime_messages_to_config (RuntimeContext *context) {

   RuntimeContextDefinitions *defs = (context ? context->get_definitions_context () : 0);

   Config result (RuntimeName);

   if (defs) {

      defs->ref ();

      const Message GlobalMessage = Definitions (context).get_global_message ();

      HashTableHandleIterator it;
      Message *msg (0);

      while (defs->messageHandleTable.get_next (it, msg)) {

         if (GlobalMessage != *msg) {

            Config data ("message");
            data.store_attribute ("name", msg->get_name ());

            if (msg->get_monostate_mode () == MessageMonostateOn) {

               data.store_attribute ("monostate", "true");
            }

            result.add_config (data);
         }
      }

      defs->unref ();
   }

   return result;
}