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


C++ copyStr函数代码示例

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


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

示例1: algo_

MCryptHandle::MCryptHandle(const std::string& algo, const std::string& mode):
  algo_( copyStr(algo) ),
  mode_( copyStr(mode) ),
  td_( mcrypt_module_open(algo_.get(), nullptr, mode_.get(), nullptr) )
{
  if(td_==MCRYPT_FAILED)
    throw std::runtime_error("mcrypt_module_open(): failed to open cypher");
}
开发者ID:el-bart,项目名称:WiFiChopper,代码行数:8,代码来源:MCryptHandle.cpp

示例2: N_NIMCALL

N_NIMCALL(NimStringDesc*, shortendir_114403)(NimStringDesc* dir) {
	NimStringDesc* result;
	NimStringDesc* prefix;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	NimStringDesc* LOC8;
	nimfr("shortenDir", "options.nim")
	result = 0;
	nimln(196, "options.nim");
	nimln(196, "options.nim");
	LOC1 = 0;
	nimln(196, "options.nim");
	LOC2 = 0;
	LOC2 = getprefixdir_114311();
	LOC1 = rawNewString(LOC2->Sup.len + 1);
appendString(LOC1, LOC2);
appendChar(LOC1, 47);
	prefix = LOC1;
	nimln(197, "options.nim");
	{
		NIM_BOOL LOC5;
		nimln(197, "options.nim");
		LOC5 = 0;
		LOC5 = nsuStartsWith(dir, prefix);
		if (!LOC5) goto LA6;
		nimln(198, "options.nim");
		nimln(198, "options.nim");
		nimln(198, "options.nim");
		nimln(198, "options.nim");
		result = copyStr(dir, prefix->Sup.len);
		goto BeforeRet;
	}	LA6: ;
	nimln(199, "options.nim");
	nimln(199, "options.nim");
	LOC8 = 0;
	LOC8 = rawNewString(gprojectpath_114198->Sup.len + 1);
appendString(LOC8, gprojectpath_114198);
appendChar(LOC8, 47);
	prefix = LOC8;
	nimln(200, "options.nim");
	{
		NIM_BOOL LOC11;
		nimln(200, "options.nim");
		LOC11 = 0;
		LOC11 = nsuStartsWith(dir, prefix);
		if (!LOC11) goto LA12;
		nimln(201, "options.nim");
		nimln(201, "options.nim");
		nimln(201, "options.nim");
		nimln(201, "options.nim");
		result = copyStr(dir, prefix->Sup.len);
		goto BeforeRet;
	}	LA12: ;
	nimln(202, "options.nim");
	result = copyString(dir);
	BeforeRet: ;	popFrame();
	return result;
}
开发者ID:rbehrends,项目名称:csources,代码行数:58,代码来源:compiler_options.c

示例3: N_NIMCALL

N_NIMCALL(NimStringDesc*, Shortendir_41200)(NimStringDesc* Dir_41202) {
    NimStringDesc* Result_41203;
    NimStringDesc* Prefix_41204;
    NimStringDesc* LOC1;
    NimStringDesc* LOC2;
    NIM_BOOL LOC4;
    NimStringDesc* LOC7;
    NimStringDesc* LOC8;
    NIM_BOOL LOC10;
    NimStringDesc* LOC13;
    NIM_BOOL LOC15;
    Result_41203 = 0;
    Prefix_41204 = 0;
    LOC1 = 0;
    LOC2 = 0;
    LOC2 = Getprefixdir_41109();
    LOC1 = rawNewString(LOC2->Sup.len + 1);
    appendString(LOC1, LOC2);
    appendChar(LOC1, 92);
    Prefix_41204 = LOC1;
    LOC4 = nsuStartsWith(Dir_41202, Prefix_41204);
    if (!LOC4) goto LA5;
    Result_41203 = copyStr(Dir_41202, Prefix_41204->Sup.len);
    goto BeforeRet;
LA5:
    ;
    LOC7 = 0;
    LOC8 = 0;
    LOC8 = nosgetCurrentDir();
    LOC7 = rawNewString(LOC8->Sup.len + 1);
    appendString(LOC7, LOC8);
    appendChar(LOC7, 92);
    Prefix_41204 = LOC7;
    LOC10 = nsuStartsWith(Dir_41202, Prefix_41204);
    if (!LOC10) goto LA11;
    Result_41203 = copyStr(Dir_41202, Prefix_41204->Sup.len);
    goto BeforeRet;
LA11:
    ;
    LOC13 = 0;
    LOC13 = rawNewString(Projectpath_41113->Sup.len + 1);
    appendString(LOC13, Projectpath_41113);
    appendChar(LOC13, 92);
    Prefix_41204 = LOC13;
    LOC15 = nsuStartsWith(Dir_41202, Prefix_41204);
    if (!LOC15) goto LA16;
    Result_41203 = copyStr(Dir_41202, Prefix_41204->Sup.len);
    goto BeforeRet;
LA16:
    ;
    Result_41203 = copyString(Dir_41202);
BeforeRet:
    ;
    return Result_41203;
}
开发者ID:ddlsmurf,项目名称:Nimrod,代码行数:55,代码来源:options.c

示例4: CopyToUniqueStr

static std::unique_ptr<char[]> CopyToUniqueStr(char *str)
{
	size_t len = strlen(str);
	std::unique_ptr<char[]> copyStr(new char[len + 1]);
	strcpy_s(copyStr.get(), len + 1, str);
	return copyStr;
}
开发者ID:KhalidElSayed,项目名称:windows8,代码行数:7,代码来源:MuPDFDoc.cpp

示例5: N_NIMCALL

N_NIMCALL(void, addpackage_277083_1623492514)(Stringtableobj152608* packages0, NimStringDesc* p0) {
	NI x0;
	NimStringDesc* name0;
	x0 = versionsplitpos_277007_1623492514(p0);
	name0 = copyStrLast(p0, ((NI) 0), (NI)(x0 - ((NI) 1)));
	{
		NimStringDesc* version0;
		if (!(x0 < (p0 ? p0->Sup.len : 0))) goto LA3;
		version0 = copyStr(p0, (NI)(x0 + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = (NimStringDesc*)0;
			LOC7 = getordefault_153214_603679043(packages0, name0);
			LOC8 = (NIM_BOOL)0;
			LOC8 = HEX3CHEX2E_277033_1623492514(LOC7, version0);
			if (!LOC8) goto LA9;
			nstPut(packages0, name0, version0);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages0, name0, ((NimStringDesc*) &T1623492514_5));
	}
	LA1: ;
}
开发者ID:FedericoCeratto,项目名称:debian-nim,代码行数:28,代码来源:compiler_nimblecmd.c

示例6: N_NIMCALL

N_NIMCALL(void, addpackage_196084)(Stringtableobj140209* packages, NimStringDesc* p) {
	NI x;
	NimStringDesc* name;
	x = versionsplitpos_196008(p);
	name = copyStrLast(p, ((NI) 0), (NI)(x - ((NI) 1)));
	{
		NimStringDesc* version;
		if (!(x < (p ? p->Sup.len : 0))) goto LA3;
		version = copyStr(p, (NI)(x + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = 0;
			LOC7 = getordefault_140814(packages, name);
			LOC8 = 0;
			LOC8 = HEX3CHEX2E_196034(LOC7, version);
			if (!LOC8) goto LA9;
			nstPut(packages, name, version);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages, name, ((NimStringDesc*) &TMP1794));
	}
	LA1: ;
}
开发者ID:StetHD,项目名称:csources,代码行数:28,代码来源:compiler_nimblecmd.c

示例7: twoBytesToUInt

QCpacket QCXB::readNextPacket() {
    XBpacket received = xb.receiveMessage();
    QCpacket result;
    result.command = -1;
    if (received.type != PACKET_RECEIVE)
        return result;

    result.command = (uint8_t)received.message[0];
    result.ID = twoBytesToUInt(received.message[1], received.message[2]);
    result.length = twoBytesToUInt(received.message[3], received.message[4]);
    if (result.length > QCPACKET_MAX_DATA_SIZE)
        result.length = QCPACKET_MAX_DATA_SIZE;
    copyStr(received.message, result.data, 5, 0, result.length);

    // TODO: calculate the checksum for the received bytes and compare with result.hash.
    // Perhaps output a byte for good checksum, and take QCpacket* as an argument that can be edited? Callback functions??
    // FUNDAMENTAL PROBLEM: how should we output multiple values from a function? Pairs? Tuples?
    result.hash = (received.message[5 + result.length] << 24) |
                  (received.message[6 + result.length] << 16) |
                  (received.message[7 + result.length] << 8) |
                  (received.message[8 + result.length]);

    // Note: srcAddr and RSSI are going to waste. Any way to output these? Perhaps maintain an instance variable called "last srcAddr" and "last RSSI"? Maybe we should do this for XB too and restructure XBpacket? I.e. no address fields and no RSSI field
    return result;
}
开发者ID:Princeton-Quadcopter,项目名称:PQ-Software,代码行数:25,代码来源:QCXB.cpp

示例8: N_NIMCALL

N_NIMCALL(void, addpackage_172126)(Stringtableobj133012* packages, NimStringDesc* p) {
	NI x;
	NimStringDesc* name;
	x = versionsplitpos_172023(p);
	name = copyStrLast(p, ((NI) 0), (NI)(x - ((NI) 1)));
	{
		NimStringDesc* version;
		if (!(x < (p ? p->Sup.len : 0))) goto LA3;
		version = copyStr(p, (NI)(x + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = 0;
			LOC7 = nstGet(packages, name);
			LOC8 = 0;
			LOC8 = HEX3CHEX2E_172064(LOC7, version);
			if (!LOC8) goto LA9;
			nstPut(packages, name, version);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages, name, ((NimStringDesc*) &TMP1660));
	}
	LA1: ;
}
开发者ID:jlp765,项目名称:csources,代码行数:28,代码来源:compiler_nimblecmd.c

示例9: N_NIMCALL

N_NIMCALL(Tnode192813*, parsepipe_220170)(NimStringDesc* filename, Tllstream179204* inputstream) {
	Tnode192813* result;
	Tllstream179204* s;
	result = 0;
	result = emptynode_193807;
	s = llstreamopen_179256(filename, ((NU8) 0));
	{
		NimStringDesc* line;
		NIM_BOOL LOC5;
		NI i;
		if (!!((s == NIM_NIL))) goto LA3;
		line = rawNewString(((NI) 80));
		LOC5 = 0;
		LOC5 = llstreamreadline_179610(s, (&line));
		i = utf8bom_220122(line);
		{
			NIM_BOOL LOC8;
			NIM_BOOL LOC11;
			LOC8 = 0;
			LOC8 = containsshebang_220132(line, i);
			if (!LOC8) goto LA9;
			LOC11 = 0;
			LOC11 = llstreamreadline_179610(s, (&line));
			i = ((NI) 0);
		}
		LA9: ;
		{
			NIM_BOOL LOC14;
			Tparser208205 q;
			NimStringDesc* LOC20;
			Tllstream179204* LOC21;
			LOC14 = 0;
			LOC14 = ((NU8)(line->data[i]) == (NU8)(35));
			if (!(LOC14)) goto LA15;
			LOC14 = ((NU8)(line->data[(NI)(i + ((NI) 1))]) == (NU8)(33));
			LA15: ;
			if (!LOC14) goto LA16;
			i += ((NI) 2);
			{
				while (1) {
					if (!(((NU8)(line->data[i])) == ((NU8)(32)) || ((NU8)(line->data[i])) == ((NU8)(9)) || ((NU8)(line->data[i])) == ((NU8)(11)) || ((NU8)(line->data[i])) == ((NU8)(13)) || ((NU8)(line->data[i])) == ((NU8)(10)) || ((NU8)(line->data[i])) == ((NU8)(12)))) goto LA19;
					i += ((NI) 1);
				} LA19: ;
			}
			memset((void*)(&q), 0, sizeof(q));
			objectInit((&q), (&NTI208205));
			LOC20 = 0;
			LOC20 = copyStr(line, i);
			LOC21 = 0;
			LOC21 = llstreamopen_179220(LOC20);
			openparser_208417((&q), filename, LOC21, NIM_FALSE);
			result = parseall_208216((&q));
			closeparser_208223((&q));
		}
		LA16: ;
		llstreamclose_179310(s);
	}
	LA3: ;
	return result;
}
开发者ID:apense,项目名称:csources,代码行数:60,代码来源:compiler_syntaxes.c

示例10: N_NIMCALL

N_NIMCALL(NimStringDesc*, getenv_121644)(NimStringDesc* key) {
	NimStringDesc* result;
	NI i;
{	result = 0;
	i = findenvvar_121605(key);
	{
		NI LOC5;
		if (!(((NI) 0) <= i)) goto LA3;
		LOC5 = 0;
		LOC5 = nsuFindChar(environment_121009->data[i], 61, ((NI) 0));
		result = copyStr(environment_121009->data[i], (NI)(LOC5 + ((NI) 1)));
		goto BeforeRet;
	}
	goto LA1;
	LA3: ;
	{
		NCSTRING env;
		env = getenv(key->data);
		{
			if (!(env == NIM_NIL)) goto LA9;
			result = copyString(((NimStringDesc*) &TMP136));
			goto BeforeRet;
		}
		LA9: ;
		result = cstrToNimstr(env);
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}
开发者ID:apense,项目名称:csources,代码行数:30,代码来源:stdlib_os.c

示例11: nulStr

	Token& Token::operator=( const Token& tok )
	{
	  module = tok.module;
	  id = tok.id;
	  type = tok.type;
	  precedence = tok.precedence;
	  deprecated = tok.deprecated;

	  nulStr();
      ownsStr = false;
	  if ( tok.token )
	  {
		if ( !tok.ownsStr )
		  setStr( tok.token );
		else
		  copyStr( tok.token );
	  }
	  dval = tok.dval;
	  lval = tok.lval;

	  dbg_filenum = tok.dbg_filenum;
	  dbg_linenum = tok.dbg_linenum;

	  userfunc = tok.userfunc;

	  return *this;
	}
开发者ID:AlessandroMamusa,项目名称:polserver,代码行数:27,代码来源:token.cpp

示例12: N_NIMCALL

N_NIMCALL(NimStringDesc*, canondynlibname_154459)(NimStringDesc* s) {
	NimStringDesc* result;
	NI start;
	NI ende;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = nsuStartsWith(s, ((NimStringDesc*) &TMP1863));
		if (!LOC3) goto LA4;
		start = ((NI) 3);
	}
	goto LA1;
	LA4: ;
	{
		start = ((NI) 0);
	}
	LA1: ;
	ende = nsuFindCharSet(s, TMP1864, ((NI) 0));
	{
		if (!(((NI) 0) <= ende)) goto LA9;
		result = copyStrLast(s, start, (NI)(ende - ((NI) 1)));
	}
	goto LA7;
	LA9: ;
	{
		result = copyStr(s, start);
	}
	LA7: ;
	return result;
}
开发者ID:jlp765,项目名称:csources,代码行数:31,代码来源:compiler_options.c

示例13: copyStr

char * stringHelper::genCharArrays(string* strPtr, int num, int *strLen){
    *strLen = getMaxStrLen(strPtr, num) + 1;
    // allocate maxLen * strNum chars to store the strings
    // using an one-dimentional array to ensure the allocated space is continuous
    char *buf = new char[num * (*strLen)];
    for(int i = 0; i < num; i++){
        copyStr(buf + i*(*strLen), *strLen, strPtr[i]);
    }
    return buf;
}
开发者ID:AnbangZhao,项目名称:ClusterWithOpenMPI,代码行数:10,代码来源:stringHelper.cpp

示例14: strlen

static char *maybeTruncateString(char *s) {
    int len = strlen(s);
    if (len > 10) {
        char *res = (char *)tlMalloc(14);
        memcpy(res, s, 10);
        res[10] = 0;
        strcat(res, "...");
        return res;
    }
    return copyStr(s);
}
开发者ID:biran0079,项目名称:Toy-Lang,代码行数:11,代码来源:toDot.c

示例15: DeleteWithSH

// Deletes a file using the shell (SHFileOperation)
// This is required as sometimes RemoveDirectory (and rm) report access is denied but the shell can delete it
static int DeleteWithSH(const TCHAR *f) {
	int retval;
	SHFILEOPSTRUCT op;
	ZeroMemory(&op, sizeof(SHFILEOPSTRUCT));
	op.wFunc = FO_DELETE;
	op.fFlags = FOF_NO_UI;
	op.pFrom = copyStr(f); // needs to be double null terminated (taken care of by copyStr)
	retval = SHFileOperation(&op);
	free((LPVOID)op.pFrom);
	return retval;
}
开发者ID:coderforlife,项目名称:c4l-utils,代码行数:13,代码来源:xdel.c


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