这篇教程C++ GetBytes函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetBytes函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBytes函数的具体用法?C++ GetBytes怎么用?C++ GetBytes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetBytes函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FOOTMARKDWORD COMPSTREXTRA::Store(const LogCompStrExtra *log) { FOOTMARK(); assert(this); assert(log); BYTE *pb = GetBytes(); dwSignature = 0xDEADFACE; iClause = log->iClause; pb += sizeof(COMPSTREXTRA); DWORD size; dwHiraganaClauseOffset = (DWORD)(pb - GetBytes()); dwHiraganaClauseCount = 0; for (size_t i = 0; i < log->hiragana_clauses.size(); ++i) { size = (log->hiragana_clauses[i].size() + 1) * sizeof(WCHAR); memcpy(pb, &log->hiragana_clauses[i][0], size); ++dwHiraganaClauseCount; pb += size; } dwTypingClauseOffset = (DWORD)(pb - GetBytes()); dwTypingClauseCount = 0; for (size_t i = 0; i < log->typing_clauses.size(); ++i) { size = (log->typing_clauses[i].size() + 1) * sizeof(WCHAR); memcpy(pb, &log->typing_clauses[i][0], size); ++dwTypingClauseCount; pb += size; } assert(log->GetTotalSize() == (DWORD)(pb - GetBytes())); return (DWORD)(pb - GetBytes());} // COMPSTREXTRA::Store
开发者ID:katahiromz,项目名称:mzimeja,代码行数:33,
示例2: AsString /// start : 0 ~ GetBytes()-1 std::string AsString(size_t start, size_t length)const { BOOST_ASSERT(start < GetBytes()); BOOST_ASSERT(start + length <= GetBytes()); return std::string(ptr_ + start, length); }
开发者ID:John-Chan,项目名称:logcpp,代码行数:8,
示例3: voidUUID::Dump (Stream *s) const{ const uint8_t *u = (const uint8_t *)GetBytes(); s->Printf ("%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X", u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]);}
开发者ID:carlokok,项目名称:lldb,代码行数:7,
示例4: sizeofstd::stringUUID::GetAsString (const char *separator) const{ std::string result; char buf[256]; if (!separator) separator = "-"; const uint8_t *u = (const uint8_t *)GetBytes(); if (sizeof (buf) > (size_t)snprintf (buf, sizeof (buf), "%2.2X%2.2X%2.2X%2.2X%s%2.2X%2.2X%s%2.2X%2.2X%s%2.2X%2.2X%s%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X", u[0],u[1],u[2],u[3],separator, u[4],u[5],separator, u[6],u[7],separator, u[8],u[9],separator, u[10],u[11],u[12],u[13],u[14],u[15])) { result.append (buf); if (m_num_uuid_bytes == 20) { if (sizeof (buf) > (size_t)snprintf (buf, sizeof (buf), "%s%2.2X%2.2X%2.2X%2.2X", separator,u[16],u[17],u[18],u[19])) result.append (buf); } } return result;}
开发者ID:2asoft,项目名称:freebsd,代码行数:26,
示例5: datastd::vector<byte> CSP::GetBytes(size_t Length){ std::vector<byte> data(Length); GetBytes(data); return data;}
开发者ID:Steppenwolfe65,项目名称:Blake2,代码行数:7,
示例6: PutBytesHRESULT CBPersistMgr::Transfer(const char* Name, AnsiStringArray& Val){ size_t size; if (m_Saving) { size = Val.size(); PutBytes((BYTE*)&size, sizeof(size_t)); for (AnsiStringArray::iterator it = Val.begin(); it != Val.end(); ++it) { PutString((*it).c_str()); } } else { Val.clear(); GetBytes((BYTE*)&size, sizeof(size_t)); for (size_t i = 0; i < size; i++) { char* str = GetString(); if (str) Val.push_back(str); } } return S_OK;}
开发者ID:segafan,项目名称:wmelite_jankavan-julia-repo,代码行数:28,
示例7: snprintfchar *UUID::GetAsCString (char *dst, size_t dst_len) const{ const uint8_t *u = (const uint8_t *)GetBytes(); snprintf(dst, dst_len, "%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X", u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]); return dst;}
开发者ID:carlokok,项目名称:lldb,代码行数:8,
示例8: GetTunerSettings // Settings for this kernel (general) static TunerSettings GetTunerSettings(const Arguments<T> &args) { auto settings = TunerSettings(); // Identification of the kernel settings.kernel_family = (V==1) ? "xgemv" : ((V==2) ? "xgemv_fast" : "xgemv_fast_rot"); settings.kernel_name = (V==1) ? "Xgemv" : ((V==2) ? "XgemvFast" : "XgemvFastRot"); settings.sources =#include "../src/kernels/common.opencl"#include "../src/kernels/level2/xgemv.opencl"#include "../src/kernels/level2/xgemv_fast.opencl" ; // Buffer sizes settings.size_x = args.n; settings.size_y = args.m; settings.size_a = args.m * args.n; // Sets the base thread configuration settings.global_size = {args.m}; settings.global_size_ref = settings.global_size; settings.local_size = {1}; settings.local_size_ref = {64}; // Transforms the thread configuration based on the parameters settings.mul_local = {{"WGS"+std::to_string(V)}}; settings.div_global = (V==1 || V==2) ? TunerSettings::TransformVector{{"WPT"+std::to_string(V)}} : TunerSettings::TransformVector{}; // Sets the tuning parameters and their possible values if (V==1) { settings.parameters = { {"WGS"+std::to_string(V), {32, 64, 128, 256}}, {"WPT"+std::to_string(V), {1, 2, 4}}, }; } if (V==2) { settings.parameters = { {"WGS"+std::to_string(V), {16, 32, 64, 128, 256}}, {"WPT"+std::to_string(V), {1, 2, 4}}, {"VW"+std::to_string(V), {1, 2, 4, 8}}, }; } if (V==3) { settings.parameters = { {"WGS"+std::to_string(V), {16, 32, 64, 128}}, {"WPT"+std::to_string(V), {1, 2, 4, 8, 16, 32}}, {"VW"+std::to_string(V), {1, 2, 4, 8}}, }; } // Describes how to compute the performance metrics settings.metric_amount = (args.m*args.n + 2*args.m + args.n) * GetBytes(args.precision); settings.performance_unit = "GB/s"; return settings; }
开发者ID:gpu,项目名称:CLBlast,代码行数:58,
示例9: VALIDATE_NOT_NULLECode UriCodec::Decode( /* [in] */ const String& s, /* [in] */ Boolean convertPlus, /* [in] */ ICharset* charset, /* [in] */ Boolean throwOnFailure, /* [out] */ String* decodedString){ VALIDATE_NOT_NULL(decodedString); if (s.IndexOf('%') == -1 && (!convertPlus || s.IndexOf('+') == -1)) { *decodedString = s; return NOERROR; } StringBuilder result(s.GetByteLength()); AutoPtr<IByteArrayOutputStream> out; CByteArrayOutputStream::New((IByteArrayOutputStream**)&out); IOutputStream* os = IOutputStream::Probe(out); AutoPtr<ArrayOf<Char32> > char32Array = s.GetChars(); for (Int32 i = 0; i < s.GetLength();) { Char32 c = (*char32Array)[i]; if (c == '%') { do { Int32 d1, d2; if (i + 2 < s.GetLength() && (d1 = HexToInt((*char32Array)[i + 1])) != -1 && (d2 = HexToInt((*char32Array)[i + 2])) != -1) { os->Write((Byte) ((d1 << 4) + d2)); } else if (throwOnFailure) { return E_ILLEGAL_ARGUMENT_EXCEPTION; } else { // TODO: unicode escape const char* chars = "/ufffd"; AutoPtr<ArrayOf<Byte> > replacement = GetBytes(chars, charset); os->Write(replacement, 0, replacement->GetLength()); } i += 3; } while (i < s.GetLength() && (*char32Array)[i] == '%'); AutoPtr<ArrayOf<Byte> > bytes; out->ToByteArray((ArrayOf<Byte>**)&bytes); //result.append(new String(out.toByteArray(), charset); result.Append(String((char*)bytes->GetPayload())); out->Reset(); } else { if (convertPlus && c == '+') { c = ' '; } result.AppendChar(c); i++; } } *decodedString = result.ToString(); return NOERROR;}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:57,
示例10: CryptoRandomExceptionvoid CSP::GetBytes(std::vector<byte> &Output, size_t Offset, size_t Length){ if (Offset + Length > Output.size()) throw CryptoRandomException("CSP:GetBytes", "The array is too small to fulfill this request!"); std::vector<byte> rnd(Length); GetBytes(rnd); memcpy(&Output[Offset], &rnd[0], rnd.size());}
开发者ID:Steppenwolfe65,项目名称:Blake2,代码行数:9,
示例11: Findbool CGXStandardObisCodeCollection::Find(basic_string<char> ln, OBJECT_TYPE objectType, CGXStandardObisCode& item){ unsigned char bytes[6]; if (GetBytes(ln, bytes) != ERROR_CODES_OK) { return NULL; } return Find(bytes, objectType, item);}
开发者ID:AMildner,项目名称:GuruxDLMSLib,代码行数:9,
示例12: copyint c4_Handler::Compare(int index_, const c4_Bytes &buf_){ // create a copy for small data, since ints use a common _item buffer c4_Bytes copy(buf_.Contents(), buf_.Size(), buf_.Size() <= 8); c4_Bytes data; GetBytes(index_, data); return f4_CompareFormat(Property().Type(), data, copy);}
开发者ID:KDE,项目名称:kdepim,代码行数:10,
示例13: EqualsMaskbool CGXStandardObisCodeCollection::EqualsMask(basic_string<char> obisMask, basic_string<char> ln){ unsigned char bytes[6]; if (GetBytes(ln, bytes) != ERROR_CODES_OK) { return NULL; } vector< basic_string<char> > tmp = GXHelpers::Split(obisMask, '.'); return EqualsObisCode(tmp, bytes);}
开发者ID:AMildner,项目名称:GuruxDLMSLib,代码行数:10,
示例14: SetLocalMemorySize static void SetLocalMemorySize(cltune::Tuner &tuner, const size_t id, const Arguments<T> &args) { if (V==1 || V==2) { auto LocalMemorySize = [args] (std::vector<size_t> v) { return v[0]*GetBytes(args.precision); }; tuner.SetLocalMemoryUsage(id, LocalMemorySize, {"WGS"+std::to_string(V)}); } else { auto LocalMemorySize = [args] (std::vector<size_t> v) { return (v[0]*v[1] + v[1])*GetBytes(args.precision); }; tuner.SetLocalMemoryUsage(id, LocalMemorySize, {"WGS"+std::to_string(V), "WPT"+std::to_string(V)}); } }
开发者ID:gpu,项目名称:CLBlast,代码行数:10,
示例15: sizeofuint CSP::Next(){ uint rndNum = 0; size_t len = sizeof(rndNum); std::vector<byte> rnd(len); GetBytes(rnd); memcpy(&rndNum, &rnd[0], len); return rndNum;}
开发者ID:Steppenwolfe65,项目名称:Blake2,代码行数:10,
示例16: GetBytes// extensionCOMPSTREXTRA *CompStr::GetExtra() { if (dwPrivateSize > sizeof(COMPSTREXTRA)) { BYTE *pb = GetBytes(); pb += dwPrivateOffset; COMPSTREXTRA *pExtra = (COMPSTREXTRA *)pb; if (pExtra->dwSignature == 0xDEADFACE) { return pExtra; } } return NULL;}
开发者ID:katahiromz,项目名称:mzimeja,代码行数:12,
示例17: voidUUID::Dump (Stream *s) const{ const uint8_t *u = (const uint8_t *)GetBytes(); s->Printf ("%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X", u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]); if (m_num_uuid_bytes == 20) { s->Printf ("-%2.2X%2.2X%2.2X%2.2X", u[16],u[17],u[18],u[19]); }}
开发者ID:2asoft,项目名称:freebsd,代码行数:11,
示例18: GetBytesbool TriAcePS1Seq::GetTrackPointers(void) { VGMHeader *TrkInfoHeader = header->AddHeader(dwOffset + 0x16, 6 * 32, L"Track Info Blocks"); GetBytes(dwOffset + 0x16, 6 * 32, &TrkInfos); for (int i = 0; i < 32; i++) if (TrkInfos[i].trkOffset != 0) { aTracks.push_back(new TriAcePS1Track(this, TrkInfos[i].trkOffset, 0)); VGMHeader *TrkInfoBlock = TrkInfoHeader->AddHeader(dwOffset + 0x16 + 6 * i, 6, L"Track Info"); } return true;}
开发者ID:vgmtrans,项目名称:vgmtrans,代码行数:13,
示例19: GetBytesECode UriCodec::AppendHex( /* [in] */ IStringBuilder * builder, /* [in] */ const String& s, /* [in] */ ICharset* charset){ AutoPtr<ArrayOf<Byte> > bytes; bytes = GetBytes(s.string(), charset); assert(bytes != NULL); for (Int32 i = 0; i < bytes->GetLength(); ++i) { AppendHex(builder, (*bytes)[i]); } return NOERROR;}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:13,
示例20: GetBytesvoid c4_Handler::Move(int from_, int to_){ if (from_ != to_) { c4_Bytes data; GetBytes(from_, data); Remove(from_, 1); if (to_ > from_) { --to_; } Insert(to_, data, 1); }}
开发者ID:KDE,项目名称:kdepim,代码行数:15,
示例21: assert UUID UUID::RandomUUID() { auto secureRandom = Crypto::CreateSecureRandomBytesImplementation(); assert(secureRandom); unsigned char randomBytes[UUID_BINARY_SIZE]; memset(randomBytes, 0, UUID_BINARY_SIZE); secureRandom->GetBytes(randomBytes, UUID_BINARY_SIZE); //Set version bits to 0100 //https://tools.ietf.org/html/rfc4122#section-4.1.3 randomBytes[VERSION_LOCATION] = (randomBytes[VERSION_LOCATION] & VERSION_MASK) | VERSION; //set variant bits to 10 //https://tools.ietf.org/html/rfc4122#section-4.1.1 randomBytes[VARIANT_LOCATION] = (randomBytes[VARIANT_LOCATION] & VARIANT_MASK) | VARIANT; return UUID(randomBytes); }
开发者ID:capeanalytics,项目名称:aws-sdk-cpp,代码行数:17,
示例22: INFO_LOGReturnCode ES::ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes, const std::vector<u8>& cert_chain){ INFO_LOG(IOS_ES, "ImportTitleInit"); ResetTitleImportContext(&context, m_ios.GetIOSC()); context.title_import_export.tmd.SetBytes(tmd_bytes); if (!context.title_import_export.tmd.IsValid()) { ERROR_LOG(IOS_ES, "Invalid TMD while adding title (size = %zd)", tmd_bytes.size()); return ES_EINVAL; } // Finish a previous import (if it exists). FinishStaleImport(context.title_import_export.tmd.GetTitleId()); ReturnCode ret = VerifyContainer(VerifyContainerType::TMD, VerifyMode::UpdateCertStore, context.title_import_export.tmd, cert_chain); if (ret != IPC_SUCCESS) return ret; const auto ticket = FindSignedTicket(context.title_import_export.tmd.GetTitleId()); if (!ticket.IsValid()) return ES_NO_TICKET; std::vector<u8> cert_store; ret = ReadCertStore(&cert_store); if (ret != IPC_SUCCESS) return ret; ret = VerifyContainer(VerifyContainerType::Ticket, VerifyMode::DoNotUpdateCertStore, ticket, cert_store); if (ret != IPC_SUCCESS) return ret; ret = InitTitleImportKey(ticket.GetBytes(), m_ios.GetIOSC(), &context.title_import_export.key_handle); if (ret != IPC_SUCCESS) return ret; if (!InitImport(context.title_import_export.tmd)) return ES_EIO; context.title_import_export.valid = true; return IPC_SUCCESS;}
开发者ID:OrN,项目名称:dolphin,代码行数:45,
示例23: GetBytesbool Buffer::ReadTo(Buffer& other, size_t length){ other.EnsureWritableSize(length); if ((m_curOff + length) > m_bytes->size()) { return false; } auto bytes = GetBytes(); auto otherBytes = other.GetBytes(); memcpy(&(*otherBytes)[other.GetCurOffset()], &(*bytes)[GetCurOffset()], length); m_curOff += length; other.m_curOff += length; // ugly :( return true;}
开发者ID:ghost30812,项目名称:client,代码行数:19,
示例24: GetBytes vector<achar> Generator::GetCharactors(astring textPath) { std::vector<achar> charactors; auto bytes = GetBytes(textPath); auto chars = ToUtf16(bytes.data(), bytes.size()); std::set<achar> charactorSet; for (auto& c : chars) { charactorSet.insert(c); } std::vector<achar> charactorVector; for (auto& c : charactorSet) { charactorVector.push_back(c); } return charactorVector; }
开发者ID:Pctg-x8,项目名称:Altseed,代码行数:20,
示例25: GetBytesbyte *BitConverter::GetBytes(double value){ if (SwappedWordsInDouble()) { byte *data = new byte[8]; byte *p = (byte*)&value; data[0] = p[4]; data[1] = p[5]; data[2] = p[6]; data[3] = p[7]; data[4] = p[0]; data[5] = p[1]; data[6] = p[2]; data[7] = p[3]; return data; } else { return GetBytes((byte *) &value, 8); }}
开发者ID:Halofreak1990,项目名称:XFXFramework,代码行数:21,
示例26: dwFindPattern/* Shoutouts * To * Marc3842h * for * the * way * better * sigscan */uintptr_t CSignature::dwFindPattern(uintptr_t dwAddress, uintptr_t dwLength, const char *szPattern){ const char *pattern = szPattern; uintptr_t firstMatch = 0; uintptr_t start = dwAddress; uintptr_t end = dwLength; for (uintptr_t pos = start; pos < end; pos++) { if (*pattern == 0) return firstMatch; const uint8_t currentPattern = *reinterpret_cast<const uint8_t *>(pattern); const uint8_t currentMemory = *reinterpret_cast<const uint8_t *>(pos); if (currentPattern == '/?' || currentMemory == GetBytes(pattern)) { if (firstMatch == 0) firstMatch = pos; if (pattern[2] == 0) { logging::Info("Found pattern /"%s/" at 0x%08X.", szPattern, firstMatch); return firstMatch; } pattern += currentPattern != '/?' ? 3 : 2; } else { pattern = szPattern; firstMatch = 0; } } logging::Info("THIS IS SERIOUS: Could not locate signature: " "/n============/n/"%s/"/n============", szPattern); return 0;}
开发者ID:UNKN-0WN,项目名称:cathook,代码行数:49,
示例27: offsetofReturnCode ES::DeleteTicket(const u8* ticket_view){ const auto fs = m_ios.GetFS(); const u64 title_id = Common::swap64(ticket_view + offsetof(IOS::ES::TicketView, title_id)); if (!CanDeleteTitle(title_id)) return ES_EINVAL; auto ticket = FindSignedTicket(title_id); if (!ticket.IsValid()) return FS_ENOENT; const u64 ticket_id = Common::swap64(ticket_view + offsetof(IOS::ES::TicketView, ticket_id)); ticket.DeleteTicket(ticket_id); const std::vector<u8>& new_ticket = ticket.GetBytes(); const std::string ticket_path = Common::GetTicketFileName(title_id); if (!new_ticket.empty()) { const auto file = fs->OpenFile(PID_KERNEL, PID_KERNEL, ticket_path, FS::Mode::ReadWrite); if (!file || !file->Write(new_ticket.data(), new_ticket.size())) return ES_EIO; } else { // Delete the ticket file if it is now empty. fs->Delete(PID_KERNEL, PID_KERNEL, ticket_path); } // Delete the ticket directory if it is now empty. const std::string ticket_parent_dir = StringFromFormat("/ticket/%08x", static_cast<u32>(title_id >> 32)); const auto ticket_parent_dir_entries = fs->ReadDirectory(PID_KERNEL, PID_KERNEL, ticket_parent_dir); if (ticket_parent_dir_entries && ticket_parent_dir_entries->empty()) fs->Delete(PID_KERNEL, PID_KERNEL, ticket_parent_dir); return IPC_SUCCESS;}
开发者ID:OrN,项目名称:dolphin,代码行数:39,
注:本文中的GetBytes函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetCOD函数代码示例 C++ GetBufferSize函数代码示例 |