本文整理汇总了C++中Concat函数的典型用法代码示例。如果您正苦于以下问题:C++ Concat函数的具体用法?C++ Concat怎么用?C++ Concat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Concat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanUpMesh
HRESULT Mesh::LoadMesh(WCHAR* directory, WCHAR* name, WCHAR* extension)
{
HRESULT hr;
CleanUpMesh();
SetDirectory( directory );
SetName( name );
WCHAR meshfile[120];
WCHAR meshpathrel[120];
WCHAR meshpath[120];
Concat(meshfile, name, extension );
Concat(meshpathrel, directory, meshfile );
AppendToRootDir(meshpath, meshpathrel);
hr = D3DXLoadMeshFromX( meshpath,
D3DXMESH_MANAGED | D3DXMESH_32BIT, mDevice, NULL,
&mMaterialBuffer, NULL, &mNumMaterials, &mMesh );
PD(hr, L"load mesh from file");
if(FAILED(hr)) return hr;
mMaterials = (D3DXMATERIAL*)mMaterialBuffer->GetBufferPointer();
PD( AdjustMeshDecl(), L"adjust mesh delaration" );
PD( AttribSortMesh(), L"attribute sort mesh" );
PD( LoadTextures(), L"load textures" );
PD( CreateTopologyFromMesh(), L"create topology from mesh");
return D3D_OK;
}
示例2: Replace
Status Replace(SString& S, SString T, SString V){
//入口断言:S,T,V存在
//操作结果:将S中出现的所有不重复的T都替换为V
int k = Index(S, T, 1);
if(k){
SString suffix; StrAssign(suffix,"");
int n = T[0], m = S[0];
while(k){
printf("%d\n",k);
SString temp;
SubString(temp, S, 1, k-1); //当前第一个T的前缀
StrPrint(temp);
if(Concat(suffix, temp)){
StrPrint(suffix);
Concat(suffix, V); //追加上V
StrPrint(suffix);
m -= (k-1)+n; //处理掉上一组后剩余的后缀长度
SubString(temp, S, k+n, m);
StrCopy(S, temp); //S被截断为尚未处理的后缀
k = Index(S, T, 1);
}else return OVERFLOW; //S空间不足
}
if(Concat(suffix, S)){
StrCopy(S, suffix);
return OK;
}else return OVERFLOW;
}
else return OK; //T未出现过
}
示例3: main
int main( )
{
execute( Seq(
If( True( ), Print( String( "hello " ) ), Print( True( ) ) ),
If( Or( False( ), Neg( True( ) ) ), Print( Unit( ) ), Print( String( "world!\n" ) ) ) ) );
execute( Seq(
When( True( ), Print( String( "hello " ) ) ),
Unless( False( ), Print( String( "world!\n" ) ) ) ) );
execute( Print( Print( Seq( Print( True( ) ), Print( False( ) ) ) ) ) );
execute( Print( Concat( String( "4" ), Show( True( ) ) ) ) );
assert( value_to_bool( execute( IsDefined( String( "not defined" ) ) ) ) == false );
execute(
Seq( Set( String( "SomeVar" ), String( "12" ) ),
Seq( Print( Get( String( "SomeVar" ) ) ),
Seq( Set( Concat( String( "S" ), String( "omeVar" ) ), String( "345\n" ) ),
Print( Get( Concat( String( "Some" ), String( "Var" ) ) ) ) ) ) ) );
execute( Seq(
If( True( ), Set( String( "hello " ), String( "hellos \n" ) ), Print( True( ) ) ), Print( Get( String( "hello " ) ) ) ) );
execute( Seq( Scope( Set( String( "hi" ), True( ) ) ), Print( IsDefined( String( "hi" ) ) ) ) );
assert(
value_to_bool( execute( Seq( Seq( Set( String( "var" ), False( ) ), Scope( Set( String( "var" ), True( ) ) ) ), Get( String( "var" ) ) ) ) ) );
execute(
Seq(
Seq( Set( String( "b1" ), True( ) ), Set( String( "b2" ), True( ) ) ),
While(
Or( Get( String( "b1" ) ), Get( String( "b2" ) ) ),
If( Get( String( "b1" ) ),
Seq( Set( String( "b1" ), False( ) ), Print( String( "Hello" ) ) ),
Seq( Set( String( "b2" ), False( ) ), Print( String( "World" ) ) ) ) ) ) );
}
示例4: gpmi_hid_script_addcfg
int gpmi_hid_script_addcfg(hid_gpmi_script_info_t *i)
{
char *fn, *home;
FILE *f;
home = getenv ("PCB_RND_GPMI_HOME");
if (home == NULL)
home = homedir;
if (homedir != NULL) {
fn = Concat(home, PCB_DIR_SEPARATOR_S ".pcb", NULL);
mkdir(fn, 0755);
free(fn);
fn = Concat(home, PCB_DIR_SEPARATOR_S ".pcb" PCB_DIR_SEPARATOR_S "plugins", NULL);
mkdir(fn, 0755);
free(fn);
fn = Concat(home, PCB_DIR_SEPARATOR_S ".pcb" PCB_DIR_SEPARATOR_S "plugins" PCB_DIR_SEPARATOR_S, CONFNAME, NULL);
}
else
fn = Concat("plugins" PCB_DIR_SEPARATOR_S, CONFNAME, NULL);
f = fopen(fn, "a");
if (f == NULL) {
Message("gpmi_hid_script_addcfg: can't open %s for write\n", fn);
return -1;
}
fprintf(f, "\n%s\t%s\n", i->module_name, i->name);
fclose(f);
free(fn);
return 0;
}
示例5: Diagonalize
///Diagonalizes a symmetric matrix (M = M^T)
void Diagonalize(Mat3Ptr matrix)
{
if (matrix == NULL)
ErrorIf(matrix == NULL, "Matrix3 - Null pointer passed for matrix.");
Matrix3 quatMatrix = ToMatrix3(CreateDiagonalizer(*matrix));
*matrix = Concat(Concat(quatMatrix, *matrix), quatMatrix.Transposed());
}
示例6: Assert
bool YString::Concat(wchar_t* destStr, int destStrSize, const wchar_t* srcStr1, const wchar_t* srcStr2)
{
Assert(Concat(destStr, destStrSize, srcStr1));
Assert(Concat(destStr, destStrSize, srcStr2));
return true;
Exit:
return false;
}
示例7: test_Concat
void test_Concat(void) {
STRING_TYPE temp = NULL;
CU_ASSERT_EQUAL(Concat(&temp, getString("abc"), getString("de")), OK);
CU_ASSERT_EQUAL(Compare(temp, getString("abcde")), 0);
CU_ASSERT_EQUAL(Concat(&temp, getString("abc"), getEmptyString()), OK);
CU_ASSERT_EQUAL(Compare(temp, getString("abc")), 0);
}
示例8: TestConcat
void TestConcat(void)
{
std::cout << "\n******************** TestConcat ********************\n";
struct Node *list1 = 0;
struct Node *list2 = 0;
const int numbers1[] = {12, 34, 21, 56, 38, 94, 23};
const int numbers2[] = {67, 56, 88, 19, 59, 10, 17};
int size1 = sizeof(numbers1) / sizeof(*numbers1);
int size2 = sizeof(numbers2) / sizeof(*numbers2);
for (int i = 0; i < size1; i++)
AddToEnd(&list1, numbers1[i]);
for (int i = 0; i < size2; i++)
AddToEnd(&list2, numbers2[i]);
std::cout << "List1 (" << std::setw(2) << Count(list1) << " nodes): ";
PrintList(list1);
std::cout << "List2 (" << std::setw(2) << Count(list2) << " nodes): ";
PrintList(list2);
std::cout << "Adding both lists (" << std::setw(2) << Count(list1) << " nodes): ";
Concat(&list1, list2);
FreeList(list2);
PrintList(list1);
FreeList(list1);
}
示例9: swprintf_s
BOOL CNktStringW::Concat(__in ULONGLONG nSrc)
{
WCHAR szTempW[128];
swprintf_s(szTempW, X_ARRAYLEN(szTempW), L"%I64u", nSrc);
return Concat(szTempW);
}
示例10: TEST01_Sqstr_main
void TEST01_Sqstr_main()
{
SqString s, s1, s2, s3, s4;
printf("(1)建立串s和串s1\n");
StrAssign(s, "abcdefghefghijklmn");
StrAssign(s1, "xyz");
printf("(2)输出串s:"); DispStr(s);
printf("(3)串s的长度:%d\n", StrLength(s));
printf("(4)在串s的第9个字符位置插入串s1而产生串s2\n");
s2 = InsStr(s, 9, s1);
printf("(5)输出串s2:"); DispStr(s2);
printf("(6)删除串s第2个字符开始的5个字符而产生串s2\n");
s2 = DelStr(s, 2, 5);
printf("(7)输出串s2:"); DispStr(s2);
printf("(8)将串s第2个字符开始的5个字符替换成串s1而产生串s2\n");
s2 = RepStr(s, 2, 5, s1);
printf("(9)输出串s2:"); DispStr(s2);
printf("(10)提取串s的第2个字符开始的10个字符而产生串s3\n");
s3 = SubStr(s, 2, 10);
printf("(11)输出串s3:"); DispStr(s3);
printf("(12)将串s1和串s2连接起来而产生串s4\n");
s4 = Concat(s1, s2);
printf("(13)输出串s4:"); DispStr(s4);
}
示例11: xlConcat
LPXLFOPER EXCEL_EXPORT
xlConcat(
XLWSTR str1a,
XLWSTR str2a)
{
EXCEL_BEGIN;
if (XlfExcel::Instance().IsCalledByFuncWiz())
return XlfOper(true);
std::wstring str1(
voidToWstr(str1a));
std::wstring str2(
voidToWstr(str2a));
double t = (clock()+0.0)/CLOCKS_PER_SEC;
std::wstring result(
Concat(
str1,
str2)
);
t = (clock()+0.0)/CLOCKS_PER_SEC-t;
CellMatrix resultCells(result);
CellMatrix time(1,2);
time(0,0) = "time taken";
time(0,1) = t;
resultCells.PushBottom(time);
return XlfOper(resultCells);
EXCEL_END
}
示例12: CreateTunnelDataMsg
std::shared_ptr<I2NPMessage> CreateTunnelDataMsg (const uint8_t * buf)
{
auto msg = NewI2NPShortMessage ();
msg->Concat (buf, i2p::tunnel::TUNNEL_DATA_MSG_SIZE);
msg->FillI2NPMessageHeader (eI2NPTunnelData);
return msg;
}
示例13: Concat
//******
//Constructor
//Copy (Shallow copy)
//******
Z_String::Z_String( const INT8 &c ) {
INT8 arr[2];
arr[0] = c;
arr[1] = '\0';
Concat( 1, arr );
}
示例14: operator_plus
LOCAL expr_val operator_plus (EParser p, const expr_val e1, const expr_val e2)
{
expr_val ret;
switch (e1.type) {
case ET_INT: switch (e2.type) {
case ET_INT: ret.type = ET_INT; ret.i_val = e1.i_val + e2.i_val; break;
case ET_DBL: ret.type = ET_DBL; ret.d_val = e1.i_val + e2.d_val; break;
case ET_BOOL: ret.type = ET_INT; ret.i_val = e1.i_val + e2.b_val; break;
case ET_STR: SetError(p, ERR_TYPE_MISMATCH); break;
} break;
case ET_DBL: switch (e2.type) {
case ET_INT: ret.type = ET_DBL; ret.d_val = e1.d_val + e2.i_val; break;
case ET_DBL: ret.type = ET_DBL; ret.d_val = e1.d_val + e2.d_val; break;
case ET_BOOL: ret.type = ET_DBL; ret.d_val = e1.d_val + e2.b_val; break;
case ET_STR: SetError(p, ERR_TYPE_MISMATCH); break;
} break;
case ET_BOOL: switch (e2.type) {
case ET_INT: ret.type = ET_INT; ret.i_val = e1.b_val + e2.i_val; break;
case ET_DBL: ret.type = ET_DBL; ret.d_val = e1.b_val + e2.d_val; break;
case ET_BOOL: ret.type = ET_BOOL;ret.b_val = e1.b_val + e2.b_val; break;
case ET_STR: SetError(p, ERR_TYPE_MISMATCH); break;
} break;
case ET_STR: switch (e2.type) {
case ET_STR: ret = Concat(p, e1, e2); break;
default: SetError(p, ERR_TYPE_MISMATCH); break;
} break;
}
return ret;
}
示例15: Concat
/** Create view with all rows not in both views (no dups)
*
* Calculates the "XOR" of two sets. This will only work if both
* input views are sets, i.e. they have no duplicate rows in them.
*
* This view operation is based on a read-only custom viewer.
*/
c4_View c4_View::Different(const c4_View &view_)const {
c4_View v = Concat(view_);
// assume neither view has any duplicates
c4_IntProp count("#N#");
return v.Counts(Clone(), count).Select(count[1]).ProjectWithout(count);
}