当前位置: 首页>>代码示例>>C++>>正文


C++ JsonObject::add方法代码示例

本文整理汇总了C++中JsonObject::add方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonObject::add方法的具体用法?C++ JsonObject::add怎么用?C++ JsonObject::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonObject的用法示例。


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

示例1: visitEnumStatement

  void visitEnumStatement(EnumStatement *node) override {
    if (!node->name()) {
      for (size_t i = 0; i < node->entries()->length(); i++) {
        EnumConstant *cs = node->entries()->at(i);

        JsonObject *val = new (pool_) JsonObject();
        val->add(atom_name_, toJson(cs->name()));
        startDoc(val, "enum value", cs->name(), cs->loc());

        constants_->add(val);
      }
      return;
    }

    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(node->name()));
    startDoc(obj, "enum", node->name(), node->loc());

    JsonList *list = new (pool_) JsonList();
    for (size_t i = 0; i < node->entries()->length(); i++) {
      EnumConstant *cs = node->entries()->at(i);

      JsonObject *val = new (pool_) JsonObject();
      val->add(atom_name_, toJson(cs->name()));
      startDoc(val, "enum value", cs->name(), cs->loc());

      list->add(val);
    }
    obj->add(atom_entries_, list);

    enums_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:32,代码来源:docparse.cpp

示例2: visitTypedefDecl

  void visitTypedefDecl(TypedefDecl *decl) override {
    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(decl->name()));
    startDoc(obj, "typedef", decl->name(), decl->loc());

    obj->add(atom_type_, toJson(decl->te()));

    typedefs_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:9,代码来源:docparse.cpp

示例3: visitPropertyDecl

  void visitPropertyDecl(PropertyDecl *node) override {
    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(node->name()));
    startDoc(obj, "property", node->name(), node->loc());

    obj->add(atom_type_, toJson(node->te()));
    obj->add(atom_getter_, new (pool_) JsonBool(!!node->getter()));
    obj->add(atom_setter_, new (pool_) JsonBool(!!node->setter()));
    props_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:10,代码来源:docparse.cpp

示例4: visitMethodDecl

  void visitMethodDecl(MethodDecl *node) override {
    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(node->name()));
    startDoc(obj, "method", node->name(), node->loc());

    FunctionNode *fun = node->method();
    obj->add(atom_returnType_, toJson(fun->signature()->returnType()));
    obj->add(atom_parameters_, toJson(fun->signature()->parameters()));
    methods_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:10,代码来源:docparse.cpp

示例5: visitMethodmapDecl

  void visitMethodmapDecl(MethodmapDecl *node) override {
    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(node->name()));
    startDoc(obj, "class", node->name(), node->loc());

    SaveAndSet<JsonList *> new_props(&props_, new (pool_) JsonList());
    SaveAndSet<JsonList *> new_methods(&methods_, new (pool_) JsonList());
    for (size_t i = 0; i < node->body()->length(); i++)
      node->body()->at(i)->accept(this);

    obj->add(atom_methods_, methods_);
    obj->add(atom_properties_, props_);
    methodmaps_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:14,代码来源:docparse.cpp

示例6: visitFunctionStatement

  void visitFunctionStatement(FunctionStatement *node) override {
    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(node->name()));
    startDoc(obj, "function", node->name(), node->loc());

    if (node->token() == TOK_FORWARD)
      obj->add(atom_kind_, toJson("forward"));
    else if (node->token() == TOK_NATIVE)
      obj->add(atom_kind_, toJson("native"));
    else
      obj->add(atom_kind_, toJson("stock"));

    obj->add(atom_returnType_, toJson(node->signature()->returnType()));
    obj->add(atom_parameters_, toJson(node->signature()->parameters()));

    functions_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:17,代码来源:docparse.cpp

示例7: results

void SWorker::results(int total_ms) {

	JsonObject r;
	r.add("elapsed", total_ms);
	
	// results are really out there...
	r.add("file", "results.dat");
	
    stringstream ss;
    r.write(true, &ss);

    StringMsg msg(0, 0, ss.str());
   	zmq::message_t message(2);
    msg.set(&message);
    result->send(message);

}
开发者ID:phamtec,项目名称:skweltch,代码行数:17,代码来源:sinkstrings.cpp

示例8: visitTypesetDecl

  void visitTypesetDecl(TypesetDecl *decl) override {
    JsonObject *obj = new (pool_) JsonObject();
    obj->add(atom_name_, toJson(decl->name()));
    startDoc(obj, "typeset", decl->name(), decl->loc());

    JsonList *list = new (pool_) JsonList();
    for (size_t i = 0; i < decl->types()->length(); i++) {
      const TypesetDecl::Entry &entry = decl->types()->at(i);
      JsonObject *te = new (pool_) JsonObject();
      te->add(atom_type_, toJson(entry.te));
      unsigned start, end;
      if (comments_.findCommentFor(entry.loc, &start, &end)) {
        te->add(atom_doc_start_, new (pool_) JsonInt(start));
        te->add(atom_doc_end_, new (pool_) JsonInt(end));
      }
      list->add(te);
    }
    obj->add(cc_.add("types"), list);

    typesets_->add(obj);
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:21,代码来源:docparse.cpp

示例9: new

  JsonList *toJson(const ParameterList *params) {
    JsonList *list = new (pool_) JsonList();
    for (size_t i = 0; i < params->length(); i++) {
      VarDecl *decl = params->at(i);
      JsonObject *obj = new (pool_) JsonObject();

      obj->add(atom_type_, toJson(decl, false));

      if (decl->name()) {
        obj->add(atom_name_, toJson(decl->name()));
        obj->add(atom_decl_, toJson(decl, true));
      } else {
        obj->add(atom_name_, toJson("..."));

        AutoString builder = BuildTypeName(decl->te(), nullptr, TypeDiagFlags::Names);
        builder = builder + " ...";
        obj->add(atom_decl_, toJson(builder.ptr()));
      }
      list->add(obj);
    }
    return list;
  }
开发者ID:alliedmodders,项目名称:sourcepawn,代码行数:22,代码来源:docparse.cpp

示例10: createObject

JsonObject createObject() {

	// {"x":{"a":{"b":1}},"y":{"d":{"e":2},"g":{"h":3,"o":{"p":9}},"z":[{"i"5},{"j":6},{"l":{"m":7,"n":8}}]}
	JsonObject o;
	{
		JsonObject x;
		{
			JsonObject a;
			a.add("b", 1);
			x.add("a", a);
		}
		o.add("x", x);
	}
	{
		JsonObject y;
		{
			JsonObject d;
			d.add("e", 2);
			y.add("d", d);
		}
		{
			JsonObject g;
			g.add("h", 3);
			JsonObject oo;
			oo.add("p", 9);
			g.add("o", oo);
			y.add("g", g);
		}
		o.add("y", y);	
	}
	{
		JsonArray z;
		{
			JsonObject i;
			i.add("i", 5);
			z.add(i);
		}
		{
			JsonObject j;
			j.add("j", 6);
			z.add(j);
		}
		{
			JsonObject l;
			JsonObject s;
			s.add("m", 7);
			s.add("n", 8);
			l.add("l", s);
			z.add(l);
		}
		o.add("z", z);	
	}
	
	return o;
}
开发者ID:phamtec,项目名称:skweltch,代码行数:55,代码来源:pathtest.cpp


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