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

C++ MakePair函数代码示例

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

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



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

示例1: TString

 THttpResponse TResponseBuilder::FormResponse() {
     Response.Headers.push_back(MakePair("Content-Length", TString(NStr::TStringBuilder() << Response.Body.size())));
     Response.Headers.push_back(MakePair("Connection", "Closed"));
     Response.Headers.push_back(MakePair("Date", GetDateAndTime()));
     Response.Headers.push_back(MakePair("Server", "DnnServer"));
     Response.Headers.push_back(MakePair("LastModified", GetDateAndTime()));
     return Response;
 }
开发者ID:alexeyche,项目名称:alexeyche-junk,代码行数:8,代码来源:response_builder.cpp


示例2: assertTest

void TestPdfListTable::TestNonLists()
{
	PdfListTable table;

	assertTest(table.OnListItem(L"CC") == MakePair(-1,-1));
	assertTest(table.OnListItem(L"IV") == MakePair(-1,-1));
	
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:TestPdfListTable.cpp


示例3: LibraryExportByName

static void LibraryExportByName(FObject lib, FObject gl, FObject nam)
{
    FAssert(LibraryP(lib));
    FAssert(GlobalP(gl));
    FAssert(SymbolP(nam));
    FAssert(GlobalP(Assq(nam, AsLibrary(lib)->Exports)) == 0);

//    AsLibrary(lib)->Exports = MakePair(MakePair(nam, gl), AsLibrary(lib)->Exports);
    Modify(FLibrary, lib, Exports, MakePair(MakePair(nam, gl), AsLibrary(lib)->Exports));
}
开发者ID:beimprovised,项目名称:foment,代码行数:10,代码来源:library.cpp


示例4: onRead

    static size_t onRead(char *buffer, size_t size, size_t nitems, void *instream)
    {
        WebRequestInternalState *is_(reinterpret_cast<WebRequestInternalState*>(instream));
        is_->state = HTTP_OPEN;
        if (is_->isAborted)
        {
            is_->state = HTTP_CLOSED;
            return CURL_READFUNC_ABORT;
        }

        // Find the size in bytes.
        size_t real_size(size * nitems);

        // Read as much as we can from the upload buffer queue.
        Deserializer* upload(dynamic_cast<Deserializer*>(is_->upload.Get()));
        size_t size_queued(upload->GetSize());
        size_t size_left(real_size);
        if ((size_left > 0) && (size_queued > 0))
        {
            size_t read_size(std::min(size_queued, size_left));
            upload->Read(buffer, (unsigned int)read_size);
            size_left -= read_size;
        }

        // If we still have bytes to fill, then emit a "upload_chunk" event.
        if (size_left > 0)
        {
            VariantMap eventData;
            eventData.Insert(MakePair(StringHash("upload"), Variant(is_->upload)));
            eventData.Insert(MakePair(StringHash("size"), Variant((unsigned int)size_left)));
            is_->es.SendEvent("upload_chunk", eventData);
        }

        // Read as much as we can from the upload buffer queue (again).
        size_queued = upload->GetSize();
        size_left = real_size;
        if ((size_left > 0) && (size_queued > 0))
        {
            size_t read_size(std::min(size_queued, size_left));
            upload->Read(buffer, (unsigned int)read_size);
            size_left -= read_size;
        }

        // If we still have bytes to fill, then something went wrong, so we should abort.
        if (size_left > 0)
        {
            is_->isAborted = true;
            return CURL_READFUNC_ABORT;
        }

        return real_size;
    }
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:52,代码来源:WebRequest.cpp


示例5: onHeader

    static size_t onHeader(char *ptr, size_t size, size_t nmemb, void *userdata)
    {
        WebRequestInternalState *is_(reinterpret_cast<WebRequestInternalState*>(userdata));
        if (is_->isAborted)
        {
            is_->state = HTTP_CLOSED;
            // This should probably be CURL_HEADERFUNC_ABORT, but that doesn't
            // exist. It probably would be the same numeric value, if it did.
            // The docs say that it just has to be a number of bytes that is
            // not "size * nmemb" to abort.
            return CURL_READFUNC_ABORT;
        }

        // Find the size in bytes.
        size_t real_size(size * nmemb);

        // Check for some known values.
        if (real_size == 2 && ptr[0] == '\r' && ptr[1] == '\n')
        {
            return real_size;
        }
        if (real_size > 5 && !strncmp(ptr, "HTTP/", 5))
        {
            return real_size;
        }

        // Get the header key and value, and add them to the map.
        unsigned int key_end = 0;
        unsigned int value_begin = 2;
        while (value_begin < real_size)
        {
            if (ptr[key_end] == ':' && ptr[key_end + 1] == ' ')
            {
                break;
            }
            ++key_end;
            ++value_begin;
        }
        if (value_begin == real_size)
        {
            String key(ptr, (unsigned int)real_size);
            is_->responseHeaders.InsertNew(key.ToUpper(), MakePair(key, String()));
        }
        else
        {
            String key(ptr, (unsigned int)key_end);
            is_->responseHeaders.InsertNew(key.ToUpper(), MakePair(key, String(ptr + value_begin, (unsigned int)real_size - value_begin - 2)));
        }

        return real_size;
    }
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:51,代码来源:WebRequest.cpp


示例6: MakeLibrary

static FObject MakeLibrary(FObject nam, FObject exports, FObject proc)
{
    FAssert(sizeof(FLibrary) == sizeof(LibraryFieldsC) + sizeof(FRecord));

    FLibrary * lib = (FLibrary *) MakeRecord(R.LibraryRecordType);
    lib->Name = nam;
    lib->Exports = exports;

    R.LoadedLibraries = MakePair(lib, R.LoadedLibraries);

    if (ProcedureP(proc))
        R.LibraryStartupList = MakePair(List(proc), R.LibraryStartupList);

    return(lib);
}
开发者ID:beimprovised,项目名称:foment,代码行数:15,代码来源:library.cpp


示例7: if

void RenderPathCommand::SetOutputName(unsigned index, const String& name)
{
    if (index < outputs_.Size())
        outputs_[index].first_ = name;
    else if (index == outputs_.Size() && index < MAX_RENDERTARGETS)
        outputs_.Push(MakePair(name, FACE_POSITIVE_X));
}
开发者ID:ArtemKulyk,项目名称:Urho3D,代码行数:7,代码来源:RenderPath.cpp


示例8: DoOnlyOrExcept

static FObject DoOnlyOrExcept(FObject env, FObject is, int_t cfif)
{
    if (PairP(Rest(is)) == 0)
        return(NoValueObject);

    FObject ilst = DoImportSet(env, First(Rest(is)), is);
    FObject ids = Rest(Rest(is));
    while (PairP(ids))
    {
        if (IdentifierP(First(ids)) == 0 && SymbolP(First(ids)) == 0)
            return(NoValueObject);

        ids = Rest(ids);
    }

    if (ids != EmptyListObject)
        return(NoValueObject);

    FObject nlst = EmptyListObject;
    while (PairP(ilst))
    {
        FAssert(GlobalP(First(ilst)));

        if (CheckForIdentifier(AsGlobal(First(ilst))->Name, Rest(Rest(is))) == cfif)
            nlst = MakePair(First(ilst), nlst);

        ilst = Rest(ilst);
    }

    FAssert(ilst == EmptyListObject);

    return(nlst);
}
开发者ID:beimprovised,项目名称:foment,代码行数:33,代码来源:library.cpp


示例9: Visit

static void Visit(FObject key, FObject val, FObject ctx)
{
    FAssert(GlobalP(val));

    if (AsGlobal(val)->State == GlobalUndefined)
        UndefinedList = MakePair(AsGlobal(val)->Name, UndefinedList);
}
开发者ID:beimprovised,项目名称:foment,代码行数:7,代码来源:library.cpp


示例10: MakePair

void ShaderPrecache::StoreShaders(ShaderVariation* vs, ShaderVariation* ps)
{
    if (!vs || !ps)
        return;
    
    // Check for duplicate using pointers first (fast)
    Pair<ShaderVariation*, ShaderVariation*> shaderPair = MakePair(vs, ps);
    if (usedPtrCombinations_.Contains(shaderPair))
        return;
    usedPtrCombinations_.Insert(shaderPair);
    
    String vsName = vs->GetName();
    String psName = ps->GetName();
    const String& vsDefines = vs->GetDefines();
    const String& psDefines = ps->GetDefines();
    
    // Check for duplicate using strings (needed for combinations loaded from existing file)
    String newCombination = vsName + " " + vsDefines + " " + psName + " " + psDefines;
    if (usedCombinations_.Contains(newCombination))
        return;
    usedCombinations_.Insert(newCombination);
    
    XMLElement shaderElem = xmlFile_.GetRoot().CreateChild("shader");
    shaderElem.SetAttribute("vs", vsName);
    shaderElem.SetAttribute("vsdefines", vsDefines);
    shaderElem.SetAttribute("ps", psName);
    shaderElem.SetAttribute("psdefines", psDefines);
}
开发者ID:Gotusso,项目名称:Urho3D,代码行数:28,代码来源:ShaderPrecache.cpp


示例11: onEnd

 void onEnd(int code)
 {
     VariantMap eventData;
     if (code != CURLE_OK)
     {
         state = HTTP_ERROR;
         eventData.Insert(MakePair(StringHash("error"), Variant(String(error, (unsigned int)strnlen(error, sizeof(error))))));
     }
     else
     {
         state = HTTP_CLOSED;
         eventData.Insert(MakePair(StringHash("download"), Variant(download)));
         eventData.Insert(MakePair(StringHash("upload"), Variant(upload)));
     }
     es.SendEvent("complete", eventData);
 }
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:16,代码来源:WebRequest.cpp


示例12: CollectNodes

void Octree::CollectNodes(Vector<Pair<OctreeNode*, float> >& result, const Octant* octant, const Ray& ray, unsigned short nodeFlags,
    float maxDistance, unsigned layerMask) const
{
    float octantDist = ray.HitDistance(octant->cullingBox);
    if (octantDist >= maxDistance)
        return;

    const Vector<OctreeNode*>& octantNodes = octant->nodes;
    for (auto it = octantNodes.Begin(); it != octantNodes.End(); ++it)
    {
        OctreeNode* node = *it;
        if ((node->Flags() & nodeFlags) == nodeFlags && (node->LayerMask() & layerMask))
        {
            float distance = ray.HitDistance(node->WorldBoundingBox());
            if (distance < maxDistance)
                result.Push(MakePair(node, distance));
        }
    }

    for (size_t i = 0; i < NUM_OCTANTS; ++i)
    {
        if (octant->children[i])
            CollectNodes(result, octant->children[i], ray, nodeFlags, maxDistance, layerMask);
    }
}
开发者ID:valera-rozuvan,项目名称:turso3d,代码行数:25,代码来源:Octree.cpp


示例13: Hash32

// ------------------------------------------------------------------------------------------------
void GobBridge::RegisterProperty(const char* typeName, const char* propName, SetPropertyFncPtr set, GetPropertyFncPtr get)
{
    ObjectTypeGUID tid = Hash32(typeName);
    ObjectPropertyUID pid = Hash32(propName);
    uint64_t tidpid = MakePair(tid, pid);
    assert(m_propertyFunctions.find(tidpid) == m_propertyFunctions.end()); // double registration.
    m_propertyFunctions[tidpid] = PropertyFunc(set, get);
}
开发者ID:Anters,项目名称:LevelEditor,代码行数:9,代码来源:GobBridge.cpp


示例14: CompileEval

FObject CompileEval(FObject obj, FObject env)
{
    FAssert(EnvironmentP(env));

    FObject body = CompileEvalExpr(obj, env, EmptyListObject);

    body = ReverseListModify(body);
    if (R.LibraryStartupList != EmptyListObject)
    {
        body = MakePair(MakePair(BeginSyntax, ReverseListModify(R.LibraryStartupList)), body);
        R.LibraryStartupList = EmptyListObject;
    }
    else if (body == EmptyListObject)
        return(R.NoValuePrimitive);

    return(CompileLambda(env, NoValueObject, EmptyListObject, body));
}
开发者ID:beimprovised,项目名称:foment,代码行数:17,代码来源:library.cpp


示例15: AddToLibraryPath

static void AddToLibraryPath(FChS * prog)
{
    FChS * s = prog;
    FChS * pth = 0;
    while (*s)
    {
        if (PathChP(*s))
            pth = s;

        s += 1;
    }

    if (pth != 0)
        R.LibraryPath = MakePair(MakeStringS(prog, pth - prog), R.LibraryPath);
    else
        R.LibraryPath = MakePair(MakeStringC("."), R.LibraryPath);
}
开发者ID:beimprovised,项目名称:foment,代码行数:17,代码来源:main.cpp


示例16: lock

void BufferedSoundStream::AddData(SharedArrayPtr<signed short> data, unsigned numBytes)
{
    if (data && numBytes)
    {
        MutexLock lock(bufferMutex_);
        
        buffers_.Push(MakePair(ReinterpretCast<signed char>(data), numBytes));
    }
}
开发者ID:Boshin,项目名称:Urho3D,代码行数:9,代码来源:BufferedSoundStream.cpp


示例17: VectorToList

FObject VectorToList(FObject vec)
{
    FAssert(VectorP(vec));

    FObject lst = EmptyListObject;
    for (int_t idx = (int_t) VectorLength(vec) - 1; idx >= 0; idx--)
        lst = MakePair(AsVector(vec)->Vector[idx], lst);

    return(lst);
}
开发者ID:beimprovised,项目名称:foment,代码行数:10,代码来源:vectors.cpp


示例18: MOZ_ASSERT

Pair<DrawResult, RefPtr<layers::Image>>
RasterImage::GetCurrentImage(ImageContainer* aContainer, uint32_t aFlags)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aContainer);

  DrawResult drawResult;
  RefPtr<SourceSurface> surface;
  Tie(drawResult, surface) =
    GetFrameInternal(mSize, FRAME_CURRENT, aFlags | FLAG_ASYNC_NOTIFY);
  if (!surface) {
    // The OS threw out some or all of our buffer. We'll need to wait for the
    // redecode (which was automatically triggered by GetFrame) to complete.
    return MakePair(drawResult, RefPtr<layers::Image>());
  }

  RefPtr<layers::Image> image = new layers::SourceSurfaceImage(surface);
  return MakePair(drawResult, Move(image));
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:19,代码来源:RasterImage.cpp


示例19: onProgress

    static int onProgress(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
    {
        WebRequestInternalState *is_(reinterpret_cast<WebRequestInternalState*>(clientp));
        if (is_->isAborted)
        {
            // This should probably be CURL_XFERINFO_ABORT, but that doesn't
            // exist. It probably would be the same numeric value, if it did.
            // The docs say that it just has to be a nonzero to abort.
            return CURL_READFUNC_ABORT;
        }

        VariantMap eventData;
        eventData.Insert(MakePair(StringHash("down_total"), Variant((double)dltotal)));
        eventData.Insert(MakePair(StringHash("down_loaded"), Variant((double)dlnow)));
        eventData.Insert(MakePair(StringHash("up_total"), Variant((double)ultotal)));
        eventData.Insert(MakePair(StringHash("up_loaded"), Variant((double)ulnow)));
        is_->es.SendEvent("progress", eventData);
        return 0;
    }
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:19,代码来源:WebRequest.cpp


示例20: MakeCommandLine

static FObject MakeCommandLine(int_t argc, FChS * argv[])
{
    FObject cl = EmptyListObject;

    while (argc > 0)
    {
        argc -= 1;
        cl = MakePair(MakeStringS(argv[argc]), cl);
    }

    return(cl);
}
开发者ID:beimprovised,项目名称:foment,代码行数:12,代码来源:main.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MakeParameters函数代码示例发布时间:2022-05-30
下一篇:
C++ MakeOutgoingFrame函数代码示例发布时间: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