本文整理汇总了C++中MakePair函数的典型用法代码示例。如果您正苦于以下问题:C++ MakePair函数的具体用法?C++ MakePair怎么用?C++ MakePair使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakePair函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: assertTest
void TestPdfListTable::TestNonLists()
{
PdfListTable table;
assertTest(table.OnListItem(L"CC") == MakePair(-1,-1));
assertTest(table.OnListItem(L"IV") == MakePair(-1,-1));
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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));
}
示例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);
}