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


C++ CREATE_VECTOR1函数代码示例

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


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

示例1: VS

bool TestExtString::test_sscanf() {
  VS(f_sscanf(0, "SN/2350001", "SN/%d"), CREATE_VECTOR1(2350001));

  Variant out;
  VS(f_sscanf(0, "SN/2350001", "SN/%d", CREATE_VECTOR1(ref(out))), 1);
  VS(out, 2350001);
  return Count(true);
}
开发者ID:BauerBox,项目名称:hiphop-php,代码行数:8,代码来源:test_ext_string.cpp

示例2: 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

示例3: f_mb_regex_encoding

bool TestExtMb::test_mb_ereg_search_regs() {
  String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C";
  String reg = "\\w+";
  f_mb_regex_encoding("UTF-8");
  f_mb_ereg_search_init(str, reg);
  Variant r = f_mb_ereg_search();
  r = f_mb_ereg_search_getregs(); // get first result
  VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung"));
  r = f_mb_ereg_search_regs();    // get next result
  VS(r, CREATE_VECTOR1("abc"));
  return Count(true);
}
开发者ID:wanghong1987,项目名称:hiphop-php,代码行数:12,代码来源:test_ext_mb.cpp

示例4: VS

bool TestExtFb::test_fb_thrift_serialize() {
  Variant ret;
  VS(f_fb_thrift_unserialize(f_fb_thrift_serialize("test"), ref(ret)), "test");
  VERIFY(same(ret, true));

  ret = null;
  VS(f_fb_thrift_unserialize(f_fb_thrift_serialize(CREATE_VECTOR1("test")),
                             ref(ret)),
     CREATE_VECTOR1("test"));
  VERIFY(same(ret, true));
  return Count(true);
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:12,代码来源:test_ext_fb.cpp

示例5: CREATE_VECTOR1

bool TestExtFb::test_fb_call_user_func_safe_return() {
  {
    Variant ret = f_fb_call_user_func_safe_return
      (1, "TEst", "ok", CREATE_VECTOR1("param"));
    VS(ret, "param");
  }
  {
    Variant ret = f_fb_call_user_func_safe_return
      (1, "NonTEst", "ok", CREATE_VECTOR1("param"));
    VS(ret, "ok");
  }
  return Count(true);
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:13,代码来源:test_ext_fb.cpp

示例6: CREATE_VECTOR1

bool TestExtFb::test_fb_call_user_func_safe() {
  {
    Variant ret = f_fb_call_user_func_safe
      (1, "TEst", CREATE_VECTOR1("param"));
    VS(ret, CREATE_VECTOR2(true, "param"));
  }
  {
    Variant ret = f_fb_call_user_func_safe
      (1, "NonTEst", CREATE_VECTOR1("param"));
    VS(ret, CREATE_VECTOR2(false, uninit_null()));
  }
  return Count(true);
}
开发者ID:CyaLiven,项目名称:hiphop-php,代码行数:13,代码来源:test_ext_fb.cpp

示例7: 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

示例8: VS

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

示例9: CREATE_VECTOR1

bool BaseExecutionContext::onUnhandledException(Object e) {
  String err = e.toString();
  if (RuntimeOption::AlwaysLogUnhandledExceptions) {
    Logger::Error("HipHop Fatal error: Uncaught %s", err.data());
  }

  if (e.instanceof("Exception")) {
    // user thrown exception
    if (!m_userExceptionHandlers.empty()) {
      if (!same(f_call_user_func_array
                (m_userExceptionHandlers.back(),
                 CREATE_VECTOR1(e)),
                false)) {
        return true;
      }
    }
  } else {
    ASSERT(false);
  }
  m_lastError = err;

  if (!RuntimeOption::AlwaysLogUnhandledExceptions) {
    Logger::Error("HipHop Fatal error: Uncaught %s", err.data());
  }
  return false;
}
开发者ID:Bathrisyah,项目名称:hiphop-php,代码行数:26,代码来源:execution_context.cpp

示例10: f_check_user_func_async

Variant f_check_user_func_async(CVarRef handles, int timeout /* = -1 */) {
  if (handles.isArray()) {
    return FiberAsyncFunc::Status(handles, timeout);
  }
  Array ret = FiberAsyncFunc::Status(CREATE_VECTOR1(handles), timeout);
  return !ret.empty();
}
开发者ID:ckwalsh,项目名称:hiphop-php,代码行数:7,代码来源:ext_function.cpp

示例11: f_apc_store

bool TestExtApc::test_apc_exists() {
  f_apc_store(s_ts, s_TestString);
  VS(f_apc_exists(s_ts), true);
  VS(f_apc_exists(s_TestString), false);
  VS(f_apc_exists(CREATE_VECTOR2(s_ts, s_TestString)), CREATE_VECTOR1(s_ts));
  return Count(true);
}
开发者ID:CyaLiven,项目名称:hiphop-php,代码行数:7,代码来源:test_ext_apc.cpp

示例12: ASSERT

bool ExecutionContext::obFlush() {
  ASSERT(m_protectedLevel >= 0);
  if ((int)m_buffers.size() > m_protectedLevel) {
    list<OutputBuffer*>::const_iterator iter = m_buffers.end();
    OutputBuffer *last = *(--iter);
    if (iter != m_buffers.begin()) {
      OutputBuffer *prev = *(--iter);
      if (last->handler.isNull()) {
        prev->oss << last->oss.str();
      } else {
        try {
          string output = last->oss.str();
          String sout(output.data(), output.length(), AttachLiteral);
          Variant tout =
            f_call_user_func_array(last->handler, CREATE_VECTOR1(sout));
          sout = tout.toString();
          prev->oss << string(sout.data(), sout.size());
        } catch (...) {
          prev->oss << last->oss.str();
        }
      }
      last->oss.str("");
      return true;
    }
    cout << last->oss.str();
    last->oss.str("");
  }
  return false;
}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:29,代码来源:execution_context.cpp

示例13: CREATE_AND_CONSTRUCT

ObjectData* SystemLib::AllocBadMethodCallExceptionObject(CVarRef message) {
  if (hhvm) {
    CREATE_AND_CONSTRUCT(BadMethodCallException, CREATE_VECTOR1(message));
  } else {
    return (NEWOBJ(c_BadMethodCallException)())->create(message);
  }
}
开发者ID:CoolCloud,项目名称:hiphop-php,代码行数:7,代码来源:systemlib.cpp

示例14: switch

bool UserFile::lock(int operation, bool &wouldBlock) {
    int64_t op = 0;
    if (operation & LOCK_NB) {
        op |= k_LOCK_NB;
    }
    switch (operation & ~LOCK_NB) {
    case LOCK_SH:
        op |= k_LOCK_SH;
        break;
    case LOCK_EX:
        op |= k_LOCK_EX;
        break;
    case LOCK_UN:
        op |= k_LOCK_UN;
        break;
    }

    // bool stream_lock(int $operation)
    bool success = false;
    Variant ret = invoke(m_StreamLock, s_stream_lock,
                         CREATE_VECTOR1(op), success);
    if (!success) {
        if (operation) {
            raise_warning("%s::stream_lock is not implemented!",
                          m_cls->name()->data());
        }
        return false;
    }
    return ret.isBoolean() ? ret.toBoolean() : false;
}
开发者ID:jobin-sun,项目名称:hiphop-php,代码行数:30,代码来源:user_file.cpp

示例15: f_apc_store

bool TestExtApc::test_apc_exists() {
  f_apc_store("ts", "TestString");
  VS(f_apc_exists("ts"), true);
  VS(f_apc_exists("TestString"), false);
  VS(f_apc_exists(CREATE_VECTOR2("ts", "TestString")), CREATE_VECTOR1("ts"));
  return Count(true);
}
开发者ID:dipjyotighosh,项目名称:hiphop-php,代码行数:7,代码来源:test_ext_apc.cpp


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