本文整理汇总了C++中config_to_string函数的典型用法代码示例。如果您正苦于以下问题:C++ config_to_string函数的具体用法?C++ config_to_string怎么用?C++ config_to_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_to_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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; }
}
}
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:34,代码来源:dmzQtPluginCanvasObjectBasic.cpp
示例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 ());
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:60,代码来源:dmzRenderModuleCoreOSGBasic.cpp
示例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;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:39,代码来源:dmzRuntimeResources.cpp
示例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);
}
}
}
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:35,代码来源:dmzQtPluginCanvasObjectBasic.cpp
示例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++;
}
}
}
开发者ID:Kevin-Xi,项目名称:wesnoth,代码行数:33,代码来源:gamestate_inspector.cpp
示例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
}
开发者ID:Andais,项目名称:dmz,代码行数:55,代码来源:dmzQtPluginCanvasObject.cpp
示例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; }
}
}
}
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:54,代码来源:dmzQtPluginPreferences.cpp
示例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);
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:27,代码来源:dmzObjectPluginHighlight.cpp
示例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;
}
开发者ID:Andais,项目名称:dmz,代码行数:28,代码来源:dmzRenderModulePortalOSG.cpp
示例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);
}
开发者ID:Zabrane,项目名称:smalltable,代码行数:27,代码来源:proxy_config.c
示例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);
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:29,代码来源:gamestate_inspector.cpp
示例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);
}
开发者ID:ben-sangster,项目名称:border,代码行数:57,代码来源:dmzBorderWebInterface.cpp
示例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));
}
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:9,代码来源:gamestate_inspector.cpp
示例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);
}
}
}
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:57,代码来源:dmzQtPluginCanvasObjectBasic.cpp
示例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);
}
开发者ID:shillcock,项目名称:cycles,代码行数:9,代码来源:dmzCyclesPluginGridOSG.cpp
示例16: dump_type
static void dump_type(const struct arsc_type *type)
{
char c[CONFIG_LEN];
config_to_string(&type->data.config, c);
printf("type: id=0x%02x entry_count=%d entries_start=0x%02x config=%s\n",
dtohs(type->data.id), dtohl(type->data.entry_count),
dtohl(type->data.entries_start), c);
}
开发者ID:hawking2013,项目名称:arsc,代码行数:9,代码来源:dump.c
示例17: defs
void
dmz::EntityPluginOverlayDead::_init (Config &local) {
Definitions defs (get_plugin_runtime_context (), &_log);
defs.lookup_state (DefaultStateNameDead, _deadState);
activate_default_object_attribute (ObjectStateMask);
_hilAttrHandle = activate_object_attribute (
ObjectAttributeHumanInTheLoopName,
ObjectFlagMask);
_overlaySwitchName =
config_to_string ("overlay.switch.name", local, _overlaySwitchName);
_overlayScaleName = config_to_string ("overlay.scale.name", local, _overlayScaleName);
}
开发者ID:rdarken,项目名称:dmz,代码行数:18,代码来源:dmzEntityPluginOverlayDead.cpp
示例18: config_to_string
// QtPluginIconPalletTool Interface
void
dmz::QtPluginIconPalletTool::_add_type (const ObjectType &Type) {
const String IconResource = config_to_string (
get_plugin_name () + ".resource",
Type.get_config());
const String IconName = _rc.find_file (IconResource);
if (IconName) {
const String Name = Type.get_name ();
if (Name) {
QImage back (
(int)_iconExtent,
(int)_iconExtent,
QImage::Format_ARGB32_Premultiplied);
QPainter painter (&back);
painter.setCompositionMode (QPainter::CompositionMode_Source);
painter.fillRect (back.rect (), Qt::transparent);
painter.setCompositionMode (QPainter::CompositionMode_SourceOver);
QSvgRenderer qsr (QString (IconName.get_buffer ()));
QRectF size = qsr.viewBoxF ();
qreal width = size.width ();
qreal height = size.height ();
qreal scale = (width > height) ? width : height;
if (scale <= 0.0f) { scale = 1.0f; }
scale = _iconExtent / scale;
width *= scale;
height *= scale;
size.setWidth (width);
size.setHeight (height);
if (height < _iconExtent) { size.moveTop ((_iconExtent - height) * 0.5f); }
if (width < _iconExtent) { size.moveLeft ((_iconExtent - width) * 0.5f); }
qsr.render (&painter, size);
painter.end ();
QIcon icon;
icon.addPixmap (QPixmap::fromImage (back));
QStandardItem *item = new QStandardItem (icon, Name.get_buffer ());
item->setEditable (false);
_model.appendRow (item);
}
}
else if (IconResource) {
_log.error << "Unable to find icon resource: " << IconResource
<< " for object type: " << Type.get_name () << endl;
}
RuntimeIterator it;
ObjectType next;
while (Type.get_next_child (it, next)) { _add_type (next); }
}
开发者ID:sbhall,项目名称:dmz,代码行数:57,代码来源:dmzQtPluginIconPalletTool.cpp
示例19: activate_default_object_attribute
void
dmz::RenderPluginObjectLoaderOSG::_init (Config &local) {
activate_default_object_attribute (ObjectDestroyMask);
_modelAttrHandle = activate_object_attribute (
config_to_string ("attribute.model.name", local, "Object_Model_Attribute"),
ObjectTextMask |
ObjectRemoveAttributeMask);
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:10,代码来源:dmzRenderPluginObjectLoaderOSG.cpp
示例20: config_to_string
void
dmz::AudioModulePortalBasic::_init (const Config &Local) {
Config data;
if (Local.lookup_config ("name", data)) {
_name = config_to_string ("value", data);
}
}
开发者ID:Andais,项目名称:dmz,代码行数:10,代码来源:dmzAudioModulePortalBasic.cpp
注:本文中的config_to_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论