本文整理汇总了C++中config_to_string函数的典型用法代码示例。如果您正苦于以下问题:C++ config_to_string函数的具体用法?C++ config_to_string怎么用?C++ config_to_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_to_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: config_to_string
void
dmz::QtPluginCanvasObjectBasic::_init (Config &local) {
_canvasModuleName = config_to_string ("module.canvas.name", local);
_defaultAttributeHandle = activate_default_object_attribute (
ObjectCreateMask | ObjectDestroyMask);
const String StateAttrName (
config_to_string ("attribute.state.name", local, ObjectAttributeDefaultName));
_stateAttributeHandle = activate_object_attribute (StateAttrName, ObjectStateMask);
_zValue = config_to_int32 ("defaults.zValue", local, _zValue);
_itemIgnoresTransformations = config_to_boolean (
"defaults.itemIgnoresTransformations",
local,
_itemIgnoresTransformations);
Config templ;
if (local.lookup_all_config ("template", templ)) {
ConfigIterator it;
Config objTemplate;
while (templ.get_next_config (it, objTemplate)) {
String templateName = config_to_string ("name", objTemplate, "");
Config *config = new Config (objTemplate);
if (templateName != "" && config && *config &&
_templateConfigTable.store (templateName, config)) {}
else { delete config; config = 0; }
}
}
}
示例2: config_to_string
void
dmz::RenderModuleCoreOSGBasic::_init (Config &local, Config &global) {
const String UpStr = config_to_string ("osg-up.value", local, "y").to_lower ();
if (UpStr == "y") { set_osg_y_up (); _log.info << "OSG render Y is up." << endl; }
else if (UpStr == "z") { set_osg_z_up (); _log.info << "OSG render Z is up" << endl; }
else {
_log.warn << "Unknown osg up type: " << UpStr << ". Defaulting to Y up." << endl;
}
Config pluginList;
if (local.lookup_all_config ("plugin-list.plugin", pluginList)) {
RuntimeContext *context (get_plugin_runtime_context ());
if (dmz::load_plugins (context, pluginList, local, global, _extensions, &_log)) {
_extensions.discover_plugins ();
_extensions.discover_external_plugin (this);
}
}
osgDB::Registry *reg = osgDB::Registry::instance ();
Config pathList;
if (reg && local.lookup_all_config ("loader.path", pathList)) {
osgDB::FilePathList &fpl = reg->getLibraryFilePathList ();
ConfigIterator it;
Config path;
while (pathList.get_next_config (it, path)) {
String pathStr = config_to_string ("value", path);
if (get_absolute_path (pathStr, pathStr)) {
fpl.push_back (pathStr.get_buffer ());
}
}
}
if(reg) {
reg->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
}
_defaultHandle = activate_default_object_attribute (
ObjectDestroyMask | ObjectPositionMask | ObjectScaleMask | ObjectOrientationMask);
_bvrHandle = config_to_named_handle (
"bounding-volume-radius-attribute.name",
local,
ObjectAttributeBoundingVolumeRaidusName,
get_plugin_runtime_context ());
}
示例3: config_to_string
/*!
\brief Find resource.
\param[in] ResourceName String containing the name of the resource file.
\return Returns a String containing the found resource file. Will return an empty
string if the resource is not found.
*/
dmz::String
dmz::Resources::find_file (const String &ResourceName) const {
String result;
if (_context) {
Config *rc = _context->rcTable.lookup (ResourceName);
if (rc) {
StringContainer searchPath;
const String FileName = config_to_string ("file", *rc);
const String PathName = config_to_string ("path", *rc);
StringContainer *path = _context->pathTable.lookup (PathName);
if (path) { searchPath = *path; }
if (!dmz::find_file (searchPath, FileName, result) && _log) {
_log->error << "Unable to find file: " << FileName << " for resource: "
<< ResourceName << endl;
}
}
else if (_log) {
_log->error << "Unable to find resource: " << ResourceName << endl;
}
}
return result;
}
示例4: while
void
dmz::QtPluginCanvasObjectBasic::_process_item_text (
ObjectStruct &os,
const Config &TextList) {
ConfigIterator it;
Config cd;
while (TextList.get_next_config (it, cd)) {
const String Name (config_to_string ("name", cd));
const String AttrName (config_to_string ("attribute", cd));
const Handle AttrHandle (activate_object_attribute (AttrName, ObjectTextMask));
QGraphicsItem *item (os.itemTable.lookup (Name));
if (AttrHandle && item) {
QtCanvasObjectTextTable *textTable (os.textTable.lookup (AttrHandle));
if (!textTable) {
textTable = new QtCanvasObjectTextTable ();
os.textTable.store (AttrHandle, textTable);
}
QtCanvasObjectText *text (qgraphicsitem_cast<QtCanvasObjectText *>(item));
if (textTable && text) {
textTable->store (Name, text);
}
}
}
}
示例5: handle_stuff_list_selection
void handle_stuff_list_selection()
{
int selected = model_.stuff_list->get_selected_row();
if(selected == -1) {
model_.set_inspect_window_text("");
return;
}
int i = 0; ///@todo replace with precached data
const config& vars = resources::gamedata
? resources::gamedata->get_variables()
: config();
FOREACH(const AUTO & a, vars.attribute_range())
{
if(selected == i) {
model_.set_inspect_window_text(a.second);
return;
}
i++;
}
FOREACH(const AUTO & c, vars.all_children_range())
{
for (unsigned int j = 0; j < model_.get_num_page(config_to_string(c.cfg)); ++j) {
if (selected == i) {
model_.set_inspect_window_text(config_to_string(c.cfg), j);
return;
}
i++;
}
}
}
示例6: config_to_string
void
dmz::QtPluginCanvasObject::_init (Config &local, Config &global) {
_canvasModuleName = config_to_string ("module.canvas.name", local);
Config pluginList;
if (local.lookup_all_config ("plugins.plugin", pluginList)) {
RuntimeContext *context (get_plugin_runtime_context ());
if (dmz::load_plugins (context, pluginList, local, global, _extensions, &_log)) {
_extensions.discover_plugins ();
}
}
_defaultAttributeHandle = activate_default_object_attribute (
ObjectCreateMask |
ObjectDestroyMask |
ObjectPositionMask |
ObjectOrientationMask);
_linkAttributeHandle = activate_object_attribute (
ObjectAttributeLayerLinkName,
ObjectLinkMask | ObjectUnlinkMask);
#if 0
Config preLoadList;
if (local.lookup_all_config ("preload", preLoadList)) {
Config data;
ConfigIterator it;
Boolean done (!preLoadList.get_first_config (it, data));
while (!done) {
ObjectType objType;
Mask objState;
if (_defs.lookup_object_type (config_to_string ("type", data), objType)) {
_defs.lookup_state (config_to_string ("state", data), objState);
_log.info << "Pre-Loading object of type: " << objType.get_name () << endl;
_get_model_struct (objType, objState);
}
done = !preLoadList.get_next_config (it, data);
}
}
#endif
}
示例7: setObjectName
void
dmz::QtPluginPreferences::_init (Config &local) {
RuntimeContext *context (get_plugin_runtime_context ());
setObjectName (get_plugin_name ().get_buffer ());
qframe_config_read ("frame", local, this);
_mainWindowModuleName = config_to_string (
"module.mainWindow.name",
local,
"dmzQtModuleMainWindowBasic");
_preferencesAction = new QAction (this),
_preferencesAction->setMenuRole (QAction::PreferencesRole);
_preferencesAction->setText (
config_to_string ("preferences-menu.text", local, "&Preferences...").get_buffer ());
connect (
_preferencesAction, SIGNAL (triggered ()),
this, SLOT (show ()));
_menuName = config_to_string ("edit-menu.text", local, _menuName);
_ui.tabWidget->removeTab (0);
Config widgetList;
if (local.lookup_all_config ("widget", widgetList)) {
ConfigIterator it;
Config widget;
while (widgetList.get_next_config (it, widget)) {
const String WidgetName (config_to_string ("name", widget));
if (WidgetName && !_widgetTable.lookup (WidgetName)) {
WidgetStruct *ws (new WidgetStruct);
if (ws) {
ws->title = config_to_string ("title", widget);
}
if (!_widgetTable.store (WidgetName, ws)) { delete ws; ws = 0; }
}
}
}
}
示例8: activate_object_attribute
// ObjectPluginHighlight Interface
void
dmz::ObjectPluginHighlight::_init (Config &local) {
_highlightAttr = activate_object_attribute (
ObjectAttributeHighlightName,
ObjectFlagMask);
_convert.set_handle (
config_to_string ("data-convert-handle.name", local, "handle"),
get_plugin_runtime_context ());
_mouseMoveMsg = config_create_message (
"mouse-move-message.name",
local,
"Mouse_Move_Message",
get_plugin_runtime_context ());
_deactivateMsg = config_create_message (
"deactivate-message.name",
local,
"Object_Highlight_Deactivate_Message",
get_plugin_runtime_context ());
subscribe_to_message (_mouseMoveMsg);
subscribe_to_message (_deactivateMsg);
}
示例9: config_to_string
void
dmz::RenderModulePortalOSG::_init (const Config &Local) {
_portalName = config_to_string ("portal.name", Local, _portalName);
Config cullRangeData;
if (Local.lookup_all_config ("visibility", cullRangeData)) {
ConfigIterator it;
Config cd;
Boolean found (cullRangeData.get_first_config (it, cd));
if (found) {
_fov = config_to_float32 ("fov", cd);
_nearClip = config_to_float32 ("near", cd);
_farClip = config_to_float32 ("far", cd);
}
}
else {
_fov = 60.0;
_nearClip = 1.0f;
_farClip = 10000.0f;
}
_log.info << "FOV: " << _fov << endl;
_log.info << "Clip Planes: " << _nearClip << " / " << _farClip << endl;
}
示例10: save_config
int save_config(struct config *config) {
FILE *fd;
fd = fopen(config->config_path_new, "w");
if(NULL == fd) {
log_error("Can't write to config file \"%s\".", config->config_path_new);
return(-1);
}
char *buf = (char*)malloc(MAX_CONFIG_SIZE);
int r = config_to_string(config, buf, MAX_CONFIG_SIZE);
if(r < 0)
goto error;
buf[MAX_CONFIG_SIZE-1] = '\0';
fputs(buf, fd);
free(buf);
fclose(fd);
if(0 != rename(config->config_path_new, config->config_path)) {
log_perror("rename(%s, %s)", config->config_path_new, config->config_path);
}
return(0);
error:;
free(buf);
fclose(fd);
log_error("Can't write to config file \"%s\".", config->config_path_new);
return(-1);
}
示例11: dc
void team_mode_controller::show_list(tree_view_node& node, int side)
{
config&& cfg = dc().get_team(side).to_config();
cfg.clear_children("ai");
model().set_data(config_to_string(cfg));
if(node.count_children() > 0) {
return;
}
c.set_node_callback(
view().stuff_list_entry(&node, "basic")
.widget("name", "ai")
.add(),
&team_mode_controller::show_ai,
side);
c.set_node_callback(
view().stuff_list_entry(&node, "basic")
.widget("name", "recall list")
.add(),
&team_mode_controller::show_recall,
side);
c.set_node_callback(
view().stuff_list_entry(&node, "basic")
.widget("name", "units")
.add(),
&team_mode_controller::show_units,
side);
}
示例12: get_plugin_runtime_context
void
dmz::BorderWebInterface::_init (Config &local) {
RuntimeContext *context = get_plugin_runtime_context ();
_uiV8Name = config_to_string ("module.js.name", local, "dmzJsModuleUiV8QtBasic");
_jsWindowObjectName = config_to_string ("module.js.windowObject.name", local, "dmz");
_mainWindowName = config_to_string ("module.main-window.name", local, "dmzQtModuleMainWindowBasic");
_frameName = config_to_string ("webframe.name", local, "DystopiaWebFrame");
_pinIDHandle = config_to_string ("pin-handles.id.name", local);
_pinPositionHandle = config_to_string ("pin-handles.position.name", local);
_pinTitleHandle = config_to_string ("pin-handles.title.name", local);
_pinDescHandle = config_to_string ("pin-handles.description.name", local);
_addPinMessage = config_create_message (
"message-names.add",
local,
"AddPinMessage",
context,
&_log);
_pinAddedMessage = config_create_message (
"message-names.add-confirm",
local,
"PinAddedMessage",
context,
&_log);
_removePinMessage = config_create_message (
"message-names.remove",
local,
"RemovePinMessage",
context,
&_log);
_pinRemovedMessage = config_create_message (
"message-names.remove-confirm",
local,
"PinRemovedMessage",
context,
&_log);
_pinMovedMessage = config_create_message (
"message-names.moved",
local,
"PinMovedMessage",
context,
&_log);
_setFrameMessage = config_create_message (
"message-names.set-interface",
local,
"SetInterfaceWebFrameMessage",
context,
&_log);
}
示例13: model
void team_mode_controller::show_ai_components(tree_view_node& node, int side)
{
widget* w = node.find("name", false);
if(label* lbl = dynamic_cast<label*>(w)) {
std::string tag = lbl->get_label();
tag.pop_back();
model().set_data(config_to_string(ai::manager::to_config(side), tag));
}
}
示例14: StateGroupStruct
void
dmz::QtPluginCanvasObjectBasic::_process_item_state (
ObjectStruct &os,
const Mask &State,
const String &GroupName,
const Config &ItemList) {
StateGroupStruct *group (os.groupTable.lookup (GroupName));
if (!group) {
if (!GroupName) {
group = &(os.defaultGroup);
}
else {
group = new StateGroupStruct (GroupName);
if (os.groupTable.store (GroupName, group)) {
group->next = os.groupList;
os.groupList = group;
}
else { delete group; group = 0; }
}
}
if (group) {
StateStruct *ss (new StateStruct (State));
ss->next = group->stateList;
group->stateList = ss;
group->groupState |= ss->State;
if (!(group->defaultState) && !(ss->State)) {
group->defaultState = ss;
}
ConfigIterator it;
Config cd;
while (ItemList.get_next_config (it, cd)) {
const String Name (config_to_string ("name", cd));
QGraphicsItem *item (os.itemTable.lookup (Name));
if (item) {
item->setVisible (False);
ss->itemTable.store (ss->itemTable.get_count (), item);
}
}
}
}
示例15: config_to_string
void
dmz::CyclesPluginGridOSG::_init (Config &local) {
_imageResource = config_to_string ("image.resource", local, "grid");
_tileSize = config_to_float64 ("tile.size", local, _tileSize);
_minGrid = config_to_float64 ("tile.min", local, _minGrid);
_maxGrid = config_to_float64 ("tile.max", local, _maxGrid);
}