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


C++ CREATE_VECTOR3函数代码示例

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


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

示例1: VS

bool TestExtMisc::test_token_get_all() {
  String src = "blarb <?php 1";
  VS(f_token_get_all(src),
     CREATE_VECTOR3(CREATE_VECTOR3(k_T_INLINE_HTML, "blarb ", 1),
                    CREATE_VECTOR3(k_T_OPEN_TAG, "<?php ", 1),
                    CREATE_VECTOR3(k_T_LNUMBER, "1", 1)));
  return Count(true);
}
开发者ID:7755373049,项目名称:hiphop-php,代码行数:8,代码来源:test_ext_misc.cpp

示例2: fb_cs_test

bool TestExtFb::test_fb_compact_serialize() {
    fb_cs_test(null);
    fb_cs_test(true);
    fb_cs_test(false);
    fb_cs_test(1234.5678);
    fb_cs_test("");
    fb_cs_test("a");
    fb_cs_test("\0");
    fb_cs_test("\0 a");
    fb_cs_test("0123012301230123");
    fb_cs_test("0123012301230123a");
    fb_cs_test("012301230123012");
    fb_cs_test(Array());
    fb_cs_test(CREATE_VECTOR1(12345));
    fb_cs_test(CREATE_VECTOR3(12345,"abc",0.1234));
    fb_cs_test(CREATE_MAP1(1, 12345));
    fb_cs_test(CREATE_MAP3(1, 12345, "a", 123124, "sdf", 0.1234));
    fb_cs_test(CREATE_VECTOR1(CREATE_VECTOR1("a")));
    fb_cs_test(CREATE_VECTOR2(1, CREATE_VECTOR1("a")));
    fb_cs_test(CREATE_VECTOR2(CREATE_VECTOR1("a"), 1));
    fb_cs_test(CREATE_VECTOR2(CREATE_VECTOR1("a"), CREATE_VECTOR1(1)));

    // Test skips
    fb_cs_test(CREATE_MAP3(0, "a", 1, "b", 3, "c"));
    fb_cs_test(CREATE_MAP3(1, "a", 2, "b", 3, "c"));
    fb_cs_test(CREATE_MAP3(0, "a", 2, "b", 3, "c"));
    fb_cs_test(CREATE_MAP1(3, "a"));
    // Test for overflow
    fb_cs_test(CREATE_MAP1((int64_t)((1ULL << 63) - 1), "a"));

    // Test each power of two, +/- 1 and the negatives of them
    // Test a single number and packed inside an array
    for (int i = 0; i < 64; ++i) {
        int64_t n = (1ULL << i);
        fb_cs_test(n);
        fb_cs_test(CREATE_VECTOR1(n));
        fb_cs_test(n-1);
        fb_cs_test(CREATE_VECTOR1(n-1));
        fb_cs_test(n+1);
        fb_cs_test(CREATE_VECTOR1(n+1));
        fb_cs_test(-n);
        fb_cs_test(CREATE_VECTOR1(-n));
        fb_cs_test(-n-1);
        fb_cs_test(CREATE_VECTOR1(-n-1));
        fb_cs_test(-n+1);
        fb_cs_test(CREATE_VECTOR1(-n+1));
    }

    // Test vector code (PHP can't create those, but they might come form
    // C++ code in serialized strings)
    String s("\xfe\x01\x02\x03\xfc");  // VECTOR, 1, 2, 3, STOP
    Variant ret;
    VS(f_fb_compact_unserialize(s, ref(ret)), CREATE_VECTOR3(1, 2, 3));

    return Count(true);
}
开发者ID:neerajdas,项目名称:hiphop-php,代码行数:56,代码来源:test_ext_fb.cpp

示例3: VS

bool TestExtMath::test_min() {
  VS(f_min(4, 2, CREATE_VECTOR4(3, 1, 6, 7)), 1);
  VS(f_min(0, CREATE_VECTOR3(2, 4, 5)), 2);
  VS(f_min(1, 0, CREATE_VECTOR1("hello")), 0);
  VS(f_min(1, "hello", CREATE_VECTOR1(0)), "hello");
  VS(f_min(1, "hello", CREATE_VECTOR1(-1)), -1);
  VS(f_min(1, CREATE_VECTOR3(2, 4, 8),
           CREATE_VECTOR1(CREATE_VECTOR3(2, 5, 1))),
     CREATE_VECTOR3(2, 4, 8));
  VS(f_min(1, "string", CREATE_VECTOR2(CREATE_VECTOR3(2, 5, 7), 42)),
     "string");
  VS(f_min(1, CREATE_MAP1(1, "1236150163")), "1236150163");
  return Count(true);
}
开发者ID:wanghong1987,项目名称:hiphop-php,代码行数:14,代码来源:test_ext_math.cpp

示例4: walk_func

static void walk_func(VRefParam value, CVarRef key, CVarRef userdata,
                      const void *data) {
  CallCtx* ctx = (CallCtx*)data;
  Variant sink;
  g_vmContext->invokeFunc((TypedValue*)&sink, *ctx,
                          CREATE_VECTOR3(ref(value), key, userdata));
}
开发者ID:mariusz-szydzik,项目名称:hiphop-php,代码行数:7,代码来源:ext_array.cpp

示例5: CREATE_MAP3

bool TestExtProcess::test_proc_open() {
  Array descriptorspec =
    CREATE_MAP3(0, CREATE_VECTOR2("pipe", "r"),
                1, CREATE_VECTOR2("pipe", "w"),
                2, CREATE_VECTOR3("file", "/tmp/error-output.txt", "a"));
  String cwd = "/tmp";
  Array env = CREATE_MAP1("some_option", "aeiou");

  Variant pipes;
  Variant process = f_proc_open(php_path, descriptorspec, ref(pipes), cwd, env);
  VERIFY(!same(process, false));

  {
    File *f = pipes[0].toObject().getTyped<File>();
    VERIFY(f->valid());
    String s("<?php print(getenv('some_option')); ?>", AttachLiteral);
    f->write(s);
    f->close();
  }
  {
    File *f = pipes[1].toObject().getTyped<File>();
    VERIFY(f->valid());
    StringBuffer sbuf;
    sbuf.read(f);
    f->close();
    VS(sbuf.detach(), "aeiou");
  }

  VS(f_proc_close(process.toObject()), 0);
  return Count(true);
}
开发者ID:wanghong1987,项目名称:hiphop-php,代码行数:31,代码来源:test_ext_process.cpp

示例6: unserialize_from_string

bool TestExtVariable::test_unserialize() {
  {
    // this was crashing
    unserialize_from_string(StringUtil::HexDecode("53203a20224c612072756f74612067697261207065722074757474692220204d203a20227365636f6e646f206d6520736920c3a820696e6361737472617461206461207175616c6368652070617274652122"));
  }
  {
    Variant v = unserialize_from_string("O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}");
    VERIFY(v.is(KindOfObject));
    Object obj = v.toObject();
    VS(obj->o_getClassName(), "stdClass");
    VS(obj.o_get("name"), "value");
  }
  {
    Variant v = unserialize_from_string(String("O:8:\"stdClass\":1:{s:7:\"\0*\0name\";s:5:\"value\";}", 45, AttachLiteral));
    VERIFY(v.is(KindOfObject));
    Object obj = v.toObject();
    VS(obj->o_getClassName(), "stdClass");
    VS(obj.o_get("name"), uninit_null());
  }
  {
    Variant v1 = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
    Variant v2 = unserialize_from_string("a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}");
    VS(v1, v2);
  }
  return Count(true);
}
开发者ID:wanghong1987,项目名称:hiphop-php,代码行数:26,代码来源:test_ext_variable.cpp

示例7: curl_read

  static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) {
    CurlResource *ch = (CurlResource *)ctx;
    ReadHandler *t  = &ch->m_read;

    int length = -1;
    switch (t->method) {
    case PHP_CURL_DIRECT:
      if (!t->fp.isNull()) {
        int data_size = size * nmemb;
        String ret = t->fp->read(data_size);
        length = ret.size();
        if (length) {
          memcpy(data, ret.data(), length);
        }
      }
      break;
    case PHP_CURL_USER:
      {
        int data_size = size * nmemb;
        Variant ret = ch->do_callback(
          t->callback, CREATE_VECTOR3(Object(ch), t->fp->fd(), data_size));
        if (ret.isString()) {
          String sret = ret.toString();
          length = data_size < sret.size() ? data_size : sret.size();
          memcpy(data, sret.data(), length);
        }
        break;
      }
    }
    return length;
  }
开发者ID:Gauravjeetsingh,项目名称:hiphop-php,代码行数:31,代码来源:ext_curl.cpp

示例8: CREATE_MAP3

bool TestExtProcess::test_proc_get_status() {
  Array descriptorspec =
    CREATE_MAP3(0, CREATE_VECTOR2("pipe", "r"),
                1, CREATE_VECTOR2("pipe", "w"),
                2, CREATE_VECTOR3("file", "/tmp/error-output.txt", "a"));
  Variant pipes;
  Variant process = f_proc_open("php", descriptorspec, ref(pipes));
  VERIFY(!same(process, false));
  Array ret = f_proc_get_status(process.toObject());
  VS(ret["command"], "php");
  VERIFY(ret["pid"].toInt32() > 0);
  VERIFY(ret["running"]);
  VERIFY(!ret["signaled"]);
  VS(ret["exitcode"], -1);
  VS(ret["termsig"], 0);
  VS(ret["stopsig"], 0);

  {
    File *f = pipes[0].toObject().getTyped<File>();
    VERIFY(f->valid());
    f->close();
  }
  {
    File *f = pipes[1].toObject().getTyped<File>();
    VERIFY(f->valid());
    f->close();
  }
  VS(f_proc_close(process.toObject()), 0);
  return Count(true);
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:30,代码来源:test_ext_process.cpp

示例9: CREATE_MAP1

bool TestExtJson::test_json_decode() {
  Array arr = CREATE_MAP1("fbid", 101501853510151001LL);
  VS(f_json_decode(f_json_encode(arr), true), arr);

  VS(f_json_decode("{\"0\":{\"00\":0}}", true),
     CREATE_MAP1("0", CREATE_MAP1("00", 0)));

  VS(f_json_decode("{\"a\":1,\"b\":2.3,\"3\":\"test\"}", true),
     CREATE_MAP3("a", 1, "b", 2.3, 3, "test"));
  VS(f_json_decode("[\"a\",1,true,false,null]", true),
     CREATE_VECTOR5("a", 1, true, false, null));

  Object obj = f_json_decode("{\"a\":1,\"b\":2.3,\"3\":\"test\"}");
  Object obj2(SystemLib::AllocStdClassObject());
  obj2->o_set("a", 1);
  obj2->o_set("b", 2.3);
  obj2->o_set("3", "test");
  VS(obj.toArray(), obj2.toArray());

  obj = f_json_decode("[\"a\",1,true,false,null]");
  VS(obj.toArray(), CREATE_VECTOR5("a", 1, true, false, null));

  VS(f_json_decode("{z:1}",     true),       null);
  VS(f_json_decode("{z:1}",     true, k_JSON_FB_LOOSE), CREATE_MAP1("z", 1));
  VS(f_json_decode("{z:\"z\"}", true),       null);
  VS(f_json_decode("{z:\"z\"}", true, k_JSON_FB_LOOSE), CREATE_MAP1("z", "z"));
  VS(f_json_decode("{'x':1}",   true),       null);
  VS(f_json_decode("{'x':1}",   true, k_JSON_FB_LOOSE), CREATE_MAP1("x", 1));
  VS(f_json_decode("{y:1,}",    true),       null);
  VS(f_json_decode("{y:1,}",    true, k_JSON_FB_LOOSE), CREATE_MAP1("y", 1));
  VS(f_json_decode("{,}",       true),       null);
  VS(f_json_decode("{,}",       true, k_JSON_FB_LOOSE), null);
  VS(f_json_decode("[1,2,3,]",  true),       null);
  VS(f_json_decode("[1,2,3,]",  true, k_JSON_FB_LOOSE), CREATE_VECTOR3(1,2,3));
  VS(f_json_decode("[,]",       true),       null);
  VS(f_json_decode("[,]",       true, k_JSON_FB_LOOSE), null);
  VS(f_json_decode("[]",        true),       Array::Create());
  VS(f_json_decode("[]",        true, k_JSON_FB_LOOSE), Array::Create());
  VS(f_json_decode("{}",        true),       Array::Create());
  VS(f_json_decode("{}",        true, k_JSON_FB_LOOSE), Array::Create());
  VS(f_json_decode("test",      true),       null);
  VS(f_json_decode("test",      true, k_JSON_FB_LOOSE), "test");
  VS(f_json_decode("'test'",    true),       null);
  VS(f_json_decode("'test'",    true, k_JSON_FB_LOOSE), "test");
  VS(f_json_decode("\"test\"",  true),       "test");
  VS(f_json_decode("\"test\"",  true, k_JSON_FB_LOOSE), "test");

  VS(f_json_decode("[{\"a\":\"apple\"},{\"b\":\"banana\"}]", true),
     CREATE_VECTOR2(CREATE_MAP1("a", "apple"), CREATE_MAP1("b", "banana")));

  Variant a = "[{\"a\":[{\"n\":\"1st\"}]},{\"b\":[{\"n\":\"2nd\"}]}]";
  VS(f_json_decode(a, true),
     CREATE_VECTOR2
     (CREATE_MAP1("a", CREATE_VECTOR1(CREATE_MAP1("n", "1st"))),
      CREATE_MAP1("b", CREATE_VECTOR1(CREATE_MAP1("n", "2nd")))));

  return Count(true);
}
开发者ID:evoloshchuk,项目名称:hiphop-php,代码行数:58,代码来源:test_ext_json.cpp

示例10: walk_func

static void walk_func(VRefParam value, CVarRef key, CVarRef userdata,
                      const void *data) {
  HPHP::VM::CallCtx* ctx = (HPHP::VM::CallCtx*)data;
  Variant sink;
  g_vmContext->invokeFunc((TypedValue*)&sink, ctx->func,
                          CREATE_VECTOR3(ref(value), key, userdata),
                          ctx->this_, ctx->cls,
                          NULL, ctx->invName);
}
开发者ID:SagaieNet,项目名称:hiphop-php,代码行数:9,代码来源:ext_array.cpp

示例11: obj

bool TestExtVariable::test_serialize() {
  Object obj(SystemLib::AllocStdClassObject());
  obj->o_set("name", "value");
  VS(f_serialize(obj), "O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}");

  Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
  VS(f_serialize(v),
     "a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}");
  return Count(true);
}
开发者ID:wanghong1987,项目名称:hiphop-php,代码行数:10,代码来源:test_ext_variable.cpp

示例12: f_strtok

bool TestExtString::test_strtok() {
  String s = "This is\tan ";
  Array tokens;
  Variant tok = f_strtok(s, " \n\t");
  while (tok) {
    tokens.append(tok);
    tok = f_strtok(" \n\t");
  }
  VS(tokens, CREATE_VECTOR3("This", "is", "an"));
  return Count(true);
}
开发者ID:BauerBox,项目名称:hiphop-php,代码行数:11,代码来源:test_ext_string.cpp

示例13: VS

bool TestExtString::test_str_replace() {
  {
    VS(f_str_replace("%body%", "black", "<body text='%body%'>"),
       "<body text='black'>");
  }
  {
    Array vowels;
    vowels.append("a");
    vowels.append("e");
    vowels.append("i");
    vowels.append("o");
    vowels.append("u");
    vowels.append("A");
    vowels.append("E");
    vowels.append("I");
    vowels.append("O");
    vowels.append("U");
    VS(f_str_replace(vowels, "", "Hello World of PHP"), "Hll Wrld f PHP");
  }
  {
    String phrase  = "You should eat fruits, vegetables, and fiber every day.";
    Array healthy = CREATE_VECTOR3("fruits", "vegetables", "fiber");
    Array yummy   = CREATE_VECTOR3("pizza", "beer", "ice cream");
    VS(f_str_replace(healthy, yummy, phrase),
       "You should eat pizza, beer, and ice cream every day.");
  }
  {
    Variant count;
    Variant str = f_str_replace("ll", "", "good golly miss molly!",
                                ref(count));
    VS(count, 2);
  }
  {
    Array letters = CREATE_VECTOR2("a", "p");
    Array fruit = CREATE_VECTOR2("apple", "pear");
    String text = "a p";
    VS(f_str_replace(letters, fruit, text), "apearpearle pear");
  }

  return Count(true);
}
开发者ID:BauerBox,项目名称:hiphop-php,代码行数:41,代码来源:test_ext_string.cpp

示例14: VS

bool TestExtJson::test_json_encode() {
  VS(f_json_encode(CREATE_MAP3("a", 1, "b", 2.3, 3, "test")),
     "{\"a\":1,\"b\":2.3,\"3\":\"test\"}");
  VS(f_json_encode(CREATE_VECTOR5("a", 1, true, false, uninit_null())),
     "[\"a\",1,true,false,null]");

  VS(f_json_encode("a\xE0"), "null");
  VS(f_json_encode("a\xE0", k_JSON_FB_LOOSE), "\"a?\"");

  VS(f_json_encode(CREATE_MAP2("0", "apple", "1", "banana")),
     "[\"apple\",\"banana\"]");

  VS(f_json_encode(CREATE_VECTOR1(CREATE_MAP1("a", "apple"))),
     "[{\"a\":\"apple\"}]");

  VS(f_json_encode(CREATE_VECTOR1(CREATE_MAP1("a", "apple")),
                   k_JSON_PRETTY_PRINT),
    "[\n    {\n        \"a\": \"apple\"\n    }\n]");

  VS(f_json_encode(CREATE_VECTOR4(1, 2, 3, CREATE_VECTOR3(1, 2, 3)),
                   k_JSON_PRETTY_PRINT),
    "[\n"
    "    1,\n"
    "    2,\n"
    "    3,\n"
    "    [\n"
    "        1,\n"
    "        2,\n"
    "        3\n"
    "    ]\n"
    "]");

  Array arr = CREATE_MAP3(
    "a", 1,
    "b", CREATE_VECTOR2(1, 2),
    "c", CREATE_MAP1("d", 42)
  );
  VS(f_json_encode(arr, k_JSON_PRETTY_PRINT),
    "{\n"
    "    \"a\": 1,\n"
    "    \"b\": [\n"
    "        1,\n"
    "        2\n"
    "    ],\n"
    "    \"c\": {\n"
    "        \"d\": 42\n"
    "    }\n"
    "}");

  return Count(true);
}
开发者ID:bibitutanh,项目名称:hiphop-php,代码行数:51,代码来源:test_ext_json.cpp

示例15: CREATE_MAP3

bool TestExtVariable::test_var_export() {
  {
    Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3));
    VS(f_var_export(v, true),
       "array (\n"
       "  'a' => 'apple',\n"
       "  'b' => 2,\n"
       "  'c' => \n"
       "  array (\n"
       "    0 => 1,\n"
       "    1 => 'y',\n"
       "    2 => 3,\n"
       "  ),\n"
       ")");
  }
  {
    String current_locale = f_setlocale(2, k_LC_ALL, "0");
    if (f_setlocale(2, k_LC_ALL, CREATE_VECTOR5("de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8"))) {
      Variant v = CREATE_MAP3("a", -1, "b", 10.5, "c", 5.6);
      VS(f_var_export(v, true),
         "array (\n"
         "  'a' => -1,\n"
         "  'b' => 10.5,\n"
         "  'c' => 5.6,\n"
         ")");
      f_setlocale(2, k_LC_ALL, current_locale);
    } else {
      SKIP("setlocale() failed");
    }
  }
  {
    const char cs[] = "'\0\\";
    const char cr[] = "'\\'' . \"\\0\" . '\\\\'";
    String s(cs, sizeof(cs) - 1, CopyString);
    String r(cr, sizeof(cr) - 1, CopyString);
    VS(f_var_export(s, true), cr);
  }
  {
    Variant v = CREATE_MAP3(String("\0", 1, CopyString), "null",
                            "", "empty",
                            "0", "nul");
    VS(f_var_export(v, true),
       "array (\n"
       "  '' . \"\\0\" . '' => 'null',\n"
       "  '' => 'empty',\n"
       "  0 => 'nul',\n"
       ")");
  }
  return Count(true);
}
开发者ID:mariusz-szydzik,项目名称:hiphop-php,代码行数:50,代码来源:test_ext_variable.cpp


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