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


C++ GetBytes函数代码示例

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


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

示例1: FOOTMARK

DWORD 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,代码来源:comp_str.cpp

示例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,代码来源:mem.hpp

示例3:

void
UUID::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,代码来源:UUID.cpp

示例4: sizeof

std::string
UUID::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,代码来源:UUID.cpp

示例5: data

std::vector<byte> CSP::GetBytes(size_t Length)
{
	std::vector<byte> data(Length);
	GetBytes(data);

	return data;
}
开发者ID:Steppenwolfe65,项目名称:Blake2,代码行数:7,代码来源:CSP.cpp

示例6: PutBytes

HRESULT 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,代码来源:BPersistMgr.cpp

示例7: snprintf

char *
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,代码来源:UUID.cpp

示例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,代码来源:xgemv.cpp

示例9: VALIDATE_NOT_NULL

ECode 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,代码来源:UriCodec.cpp

示例10: CryptoRandomException

void 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,代码来源:CSP.cpp

示例11: Find

bool 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,代码来源:GXStandardObisCodeCollection.cpp

示例12: copy

int 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,代码来源:handler.cpp

示例13: EqualsMask

bool 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,代码来源:GXStandardObisCodeCollection.cpp

示例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,代码来源:xgemv.cpp

示例15: sizeof

uint 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,代码来源:CSP.cpp


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