• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ config_setting_create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中config_setting_create函数的典型用法代码示例。如果您正苦于以下问题:C++ config_setting_create函数的具体用法?C++ config_setting_create怎么用?C++ config_setting_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了config_setting_create函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: return

config_setting_t *config_setting_set_string_elem(config_setting_t *vector,
                                                 int idx, const char *value)
{
  config_setting_t *element = NULL;

  if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST))
    return(NULL);

  if(idx < 0)
  {
    if(! __config_vector_checktype(vector, CONFIG_TYPE_STRING))
      return(NULL);

    element = config_setting_create(vector, NULL, CONFIG_TYPE_STRING);
  }
  else
    element = config_setting_get_elem(vector, idx);

  if(! element)
    return(NULL);

  if(! config_setting_set_string(element, value))
    return(NULL);

  return(element);
}
开发者ID:mlafeldt,项目名称:ps2rd,代码行数:26,代码来源:libconfig.c


示例2: return

config_setting_t *config_setting_add(config_setting_t *parent,
                                     const char *name, int type)
{
  if((type < CONFIG_TYPE_NONE) || (type > CONFIG_TYPE_LIST))
    return(NULL);

  if(! parent)
    return(NULL);

  if((parent->type == CONFIG_TYPE_ARRAY) || (parent->type == CONFIG_TYPE_LIST))
    name = NULL;

  if(name)
  {
    if(! __config_validate_name(name))
      return(NULL);
  }

  config_setting_t *setting = config_setting_get_member(parent, name);
  if (setting != NULL)
  {
    if ((setting->type != type && type != CONFIG_TYPE_NONE) ||
        (setting->type != CONFIG_TYPE_GROUP &&
         setting->type != CONFIG_TYPE_ARRAY &&
         setting->type != CONFIG_TYPE_LIST))
      return(NULL); /* already exists */
    else
      return setting; /* merge with existing config */
  }

  return(config_setting_create(parent, name, type));
}
开发者ID:krin-san,项目名称:libconfig,代码行数:32,代码来源:libconfig.c


示例3: return

config_setting_t *config_setting_add(config_setting_t *parent,
                                     const char *name, int type)
{
  if((type < CONFIG_TYPE_NONE) || (type > CONFIG_TYPE_LIST))
    return(NULL);

  if(! parent)
    return(NULL);

  if((parent->type == CONFIG_TYPE_ARRAY) || (parent->type == CONFIG_TYPE_LIST))
    name = NULL;

  if(name)
  {
    if(! __config_validate_name(name))
      return(NULL);
  }

#if 0
  /* https://github.com/HerculesWS/Hercules/pull/136#discussion_r6363319
   * With this code, accidental duplicate keys would cause the file parsing to fail
   * (would cause several issues during runtime on file reloads), while libconfig's code
   * has no problems with duplicate members so it was ducked out -- TODO: looking now though
   * I'd think it could be useful to have it display a warning or error message when finding
   * duplicate keys instead of silently moving on. [Ind]
   */
  if(config_setting_get_member(parent, name) != NULL)
    return(NULL); /* already exists */
#endif

  return(config_setting_create(parent, name, type));
}
开发者ID:AchcarLucas,项目名称:Cronus,代码行数:32,代码来源:libconfig.c


示例4: return

LIBCONFIG_API config_setting_t *config_setting_set_bool_elem(
  config_setting_t *vector, int index, int value)
{
  config_setting_t *element = NULL;

  if((vector->type != CONFIG_TYPE_ARRAY) && (vector->type != CONFIG_TYPE_LIST))
    return(NULL);

  if(index < 0)
  {
    if(! __config_vector_checktype(vector, CONFIG_TYPE_BOOL))
      return(NULL);
    
    element = config_setting_create(vector, NULL, CONFIG_TYPE_BOOL);
  }
  else
    element = config_setting_get_elem(vector, index);

  if(! element)
    return(NULL);

  if(! config_setting_set_bool(element, value))
    return(NULL);
  
  return(element);
}
开发者ID:aveek0218,项目名称:ImpalaPythia,代码行数:26,代码来源:libconfig.c


示例5: return

config_setting_t *config_setting_add(config_setting_t *parent,
                                     const char *name, int type)
{
  if((type < CONFIG_TYPE_NONE) || (type > CONFIG_TYPE_LIST))
    return(NULL);

  if(! parent)
    return(NULL);

  if((parent->type == CONFIG_TYPE_ARRAY) || (parent->type == CONFIG_TYPE_LIST))
    name = NULL;

  if(name)
  {
    if(! __config_validate_name(name))
      return(NULL);
  }

  if(((name && *name != '$') || (!name)) && config_setting_get_member(parent, name) != NULL)
    return(NULL); /* already exists */

  return(config_setting_create(parent, name, type));
}
开发者ID:NeotericUK,项目名称:Pancake2,代码行数:23,代码来源:PancakeConfigurationParser.c



注:本文中的config_setting_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ config_setting_get_elem函数代码示例发布时间:2022-05-30
下一篇:
C++ config_set_int函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap