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


C++ dir2函数代码示例

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


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

示例1: archIndexTestSerialization

rc_t archIndexTestSerialization(ss_m*, test_volume_t*)
{
    // ============================== DIR 1 ==============================
    LogArchiver::ArchiveDirectory dir1(test_env->archive_dir, BLOCK_SIZE,
            true /* createIndex */);
    EXPECT_TRUE(dir1.getIndex());

    unsigned total = 0;
    generateFakeArchive(&dir1, BLOCK_SIZE*1000, 10, total);
    // ===================================================================


    // ============================== DIR 2 ==============================
    LogArchiver::ArchiveDirectory dir2(test_env->archive_dir, BLOCK_SIZE,
            true /* createIndex */);
    EXPECT_TRUE(dir2.getIndex());
    // ===================================================================

    LogArchiver::ArchiveIndex* index1 = dir1.getIndex();
    LogArchiver::ArchiveIndex* index2 = dir2.getIndex();
    EXPECT_EQ(index1->runs.size(), index2->runs.size());

    for(unsigned i=0; i<index1->runs.size(); i++) {
        EXPECT_EQ(index1->runs[i].entries.size(), index2->runs[i].entries.size());
        for(unsigned j=0; j<index1->runs[i].entries.size(); j++) {
            EXPECT_EQ(index1->runs[i].entries[j].offset, index2->runs[i].entries[j].offset);
            EXPECT_EQ(index1->runs[i].entries[j].pid, index2->runs[i].entries[j].pid);
        }
    }

    return RCOK;
}
开发者ID:shemmer,项目名称:zero,代码行数:32,代码来源:test_logarchiver.cpp

示例2: dir

void Dialog::browse_objectsdir() {
  QString d = QFileDialog::getExistingDirectory (edobjectsdir->text(), this, 0,
						 "select objects dir");
  
  if (! d.isEmpty()) {
#ifdef WIN32
    QDir dir(d);
    
    if (! dir.exists()) {
      int index = d.length() - 1;
      
      if (d.at(index) == QChar('/'))
	index -= 1;
      
      QString d2 = d;
	
      d2.remove(index, 1);
	
      QDir dir2(d2);
	
      if (dir2.exists())
	d = d2;
    }
#endif
    
    edobjectsdir->setText(d);
  }
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:28,代码来源:Dialog.cpp

示例3: dir2

void postoperation::send()   //连接到服务器,执行发送
{
    ui->pbsendfile->setEnabled(false);
    bytesWritten = 0;
    //初始化已发送字节为0

    QDir dir;
    QString path = dir.currentPath();
    path += "/setting";
    QDir dir2(path);
    QString settingname;
    if(dir2.exists())
    {
        dir2.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
        dir2.setSorting(QDir::Size | QDir::Reversed);
        QFileInfoList list = dir2.entryInfoList();
        QFileInfo fileInfo = list.at(0);
        settingname = fileInfo.fileName();
        qDebug()<<settingname;
    }
    QString filename = path + "/" +settingname;
    QFile file(filename);
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QMessageBox::information(this,tr("提示"),tr("无法打开文件"),QMessageBox::Ok);
        qDebug()<<"Can't open the file!"<<endl;
    }
    QTextStream  in(&file);
    QString ipaddress;
    ipaddress = in.readLine();
    qDebug()<<ipaddress;
    tcpClient->connectToHost(QHostAddress(ipaddress),6111);//连接
}
开发者ID:lingma1993,项目名称:Smart-Express-System,代码行数:33,代码来源:postoperation.cpp

示例4: dif

void CGenericParticleProjectile::Draw()
{
	inArray = true;

	if (directional) {
		float3 dif(pos-camera->GetPos());
		dif.ANormalize();
		float3 dir1(dif.cross(speed));
		dir1.ANormalize();
		float3 dir2(dif.cross(dir1));

		unsigned char color[4];

		colorMap->GetColor(color, life);

		va->AddVertexTC(drawPos - dir1 * size - dir2 * size, texture->xstart, texture->ystart, color);
		va->AddVertexTC(drawPos - dir1 * size + dir2 * size, texture->xend,   texture->ystart, color);
		va->AddVertexTC(drawPos + dir1 * size + dir2 * size, texture->xend,   texture->yend,   color);
		va->AddVertexTC(drawPos + dir1 * size - dir2 * size, texture->xstart, texture->yend,   color);
	} else {
		unsigned char color[4];

		colorMap->GetColor(color, life);

		va->AddVertexTC(drawPos - camera->right * size - camera->up * size, texture->xstart, texture->ystart, color);
		va->AddVertexTC(drawPos + camera->right * size - camera->up * size, texture->xend,   texture->ystart, color);
		va->AddVertexTC(drawPos + camera->right * size + camera->up * size, texture->xend,   texture->yend,   color);
		va->AddVertexTC(drawPos - camera->right * size + camera->up * size, texture->xstart, texture->yend,   color);
	}
}
开发者ID:jamerlan,项目名称:spring,代码行数:30,代码来源:GenericParticleProjectile.cpp

示例5: dif

void CExploSpikeProjectile::Draw(void)
{
	inArray=true;

	float3 dif(pos-camera->pos2);
	dif.Normalize();
	float3 dir2(dif.cross(dir));
	dir2.Normalize();

	unsigned char col[4];
	float a=std::max(0.f,alpha-alphaDecay*gu->timeOffset)*255;
	col[0]=(unsigned char)(a*color.x);
	col[1]=(unsigned char)(a*color.y);
	col[2]=(unsigned char)(a*color.z);
	col[3]=1;

	float3 interpos=pos+speed*gu->timeOffset;
	float3 l=dir*length+lengthGrowth*gu->timeOffset;
	float3 w=dir2*width;

	va->AddVertexTC(interpos+l+w, ph->laserendtex.xend, ph->laserendtex.yend, col);
	va->AddVertexTC(interpos+l-w, ph->laserendtex.xend, ph->laserendtex.ystart, col);
	va->AddVertexTC(interpos-l-w, ph->laserendtex.xstart, ph->laserendtex.ystart, col);
	va->AddVertexTC(interpos-l+w, ph->laserendtex.xstart, ph->laserendtex.yend, col);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:25,代码来源:ExploSpikeProjectile.cpp

示例6: GetPlaneCapsuleOffset

float GetPlaneCapsuleOffset(const Vect &dir, float capsuleHalfHeight, float capsuleRadius)
{
    Vect2 dir2(sqrtf(1.0f-(dir.y*dir.y)), fabs(dir.y));
    Vect2 centerOffset(capsuleRadius, capsuleHalfHeight);

    return centerOffset.Dot(dir2)-(1.0f-MAX(dir2.x, dir2.y));
}
开发者ID:373137461,项目名称:OBS,代码行数:7,代码来源:XMath.cpp

示例7: dif

void CExploSpikeProjectile::Draw(void)
{
	inArray=true;

	float3 dif(pos-camera->pos2);
	dif.Normalize();
	float3 dir2(dif.cross(dir));
	dir2.Normalize();

	unsigned char col[4];
	float a=std::max(0.f,alpha-alphaDecay*gu->timeOffset)*255;
	col[0]=(unsigned char)a;
	col[1]=(unsigned char)(a*0.8);
	col[2]=(unsigned char)(a*0.5);
	col[3]=1;

	float3 interpos=pos+speed*gu->timeOffset;
	float3 l=dir*length+lengthGrowth*gu->timeOffset;
	float3 w=dir2*width;

	va->AddVertexTC(interpos+l+w, 8/8.0, 1/8.0, col);
	va->AddVertexTC(interpos+l-w, 8/8.0, 0/8.0, col);
	va->AddVertexTC(interpos-l-w, 7/8.0, 0/8.0, col);
	va->AddVertexTC(interpos-l+w, 7/8.0, 1/8.0, col);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:25,代码来源:ExploSpikeProjectile.cpp

示例8: dif

void CGeoSquareProjectile::Draw(void)
{
	inArray=true;
	unsigned char col[4];
	col[0]=(unsigned char) (r*a*255);
	col[1]=(unsigned char) (g*a*255);
	col[2]=(unsigned char) (b*a*255);
	col[3]=(unsigned char) (a*255);

	float3 dif(p1-camera->pos);
	dif.Normalize();
	float3 dir1(dif.cross(v1));
	dir1.Normalize();
	float3 dif2(p2-camera->pos);
	dif2.Normalize();
	float3 dir2(dif2.cross(v2));
	dir2.Normalize();

	if(w2!=0){
		va->AddVertexTC(p1-dir1*w1,1.0/16,1.0/8,col);
		va->AddVertexTC(p1+dir1*w1,1.0/16,0.0/8,col);
		va->AddVertexTC(p2+dir2*w2,1.0/16,0.0/8,col);
		va->AddVertexTC(p2-dir2*w2,1.0/16,1.0/8,col);
	} else {
		va->AddVertexTC(p1-dir1*w1,1.0/16,1.0/8,col);
		va->AddVertexTC(p1+dir1*w1,1.0/16,0.0/8,col);
		va->AddVertexTC(p2+dir2*w2,1.0/16,0.5/8,col);
		va->AddVertexTC(p2-dir2*w2,1.0/16,1.5/8,col);
	}
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:30,代码来源:GeoSquareProjectile.cpp

示例9: dif

void CGeoSquareProjectile::Draw()
{
	inArray = true;
	unsigned char col[4];
	col[0] = (unsigned char) (r * a * 255);
	col[1] = (unsigned char) (g * a * 255);
	col[2] = (unsigned char) (b * a * 255);
	col[3] = (unsigned char) (    a * 255);

	float3 dif(p1 - camera->GetPos());
	dif.ANormalize();
	float3 dir1(dif.cross(v1));
	dir1.ANormalize();
	float3 dif2(p2 - camera->GetPos());
	dif2.ANormalize();
	float3 dir2(dif2.cross(v2));
	dir2.ANormalize();


	const float u = (projectileDrawer->geosquaretex->xstart + projectileDrawer->geosquaretex->xend) / 2;
	const float v0 = projectileDrawer->geosquaretex->ystart;
	const float v1 = projectileDrawer->geosquaretex->yend;

	if (w2 != 0) {
		va->AddVertexTC(p1 - dir1 * w1, u, v1, col);
		va->AddVertexTC(p1 + dir1 * w1, u, v0, col);
		va->AddVertexTC(p2 + dir2 * w2, u, v0, col);
		va->AddVertexTC(p2 - dir2 * w2, u, v1, col);
	} else {
		va->AddVertexTC(p1 - dir1 * w1, u, v1,                    col);
		va->AddVertexTC(p1 + dir1 * w1, u, v0,                    col);
		va->AddVertexTC(p2,             u, v0 + (v1 - v0) * 0.5f, col);
		va->AddVertexTC(p2,             u, v0 + (v1 - v0) * 1.5f, col);
	}
}
开发者ID:304471720,项目名称:spring,代码行数:35,代码来源:GeoSquareProjectile.cpp

示例10: TEST

TEST( ResourceDependenciesGraph, removingDir )
{
   ResourceDependenciesGraph graph;

   FilePath file( "/directory1/a.res" );
   FilePath res1( "/directory2/b.tmat" );
   FilePath res2( "/directory3/c.tmat" );
   FilePath dir1( "/directory1" );
   FilePath dir2( "/directory2" );
   FilePath dir3( "/directory3" );
   graph.addDependency( file, res1 );
   graph.addDependency( file, res2 );

   CPPUNIT_ASSERT_EQUAL( ( uint ) 2, graph.getAffectedResources( file ).size() );

   graph.onDirRemoved( dir2 );
   CPPUNIT_ASSERT_EQUAL( ( uint ) 1, graph.getAffectedResources( file ).size() );
   CPPUNIT_ASSERT_EQUAL( res2.getRelativePath(), graph.getAffectedResources( file ).front().getRelativePath() );

   graph.onDirRemoved( dir3 );
   CPPUNIT_ASSERT_EQUAL( ( uint ) 0, graph.getAffectedResources( file ).size() );

   graph.addDependency( file, res1 );
   graph.addDependency( file, res2 );
   CPPUNIT_ASSERT_EQUAL( ( uint ) 2, graph.getAffectedResources( file ).size() );

   graph.onDirRemoved( dir1 );
   CPPUNIT_ASSERT_EQUAL( ( uint ) 0, graph.getAffectedResources( file ).size() );
}
开发者ID:dabroz,项目名称:Tamy,代码行数:29,代码来源:ResourcesDependenciesTreeTests.cpp

示例11: main

int main()
{
	std::string dir_name = "/tmp/1/1/1";
	native_dir dir(dir_name);
	assert(!dir.exist());
	assert(!dir.create_dir(false));
	assert(dir.create_dir(true));

	printf("press a key to continue the test of delete function.\n");
	getchar();
	native_dir dir2("/tmp/1");
	assert(!dir2.delete_dir(false));
	assert(dir2.delete_dir(true));

	dir_name = "1/1/1";
	native_dir dir3(dir_name);
	assert(!dir3.exist());
	assert(!dir3.create_dir(false));
	assert(dir3.create_dir(true));

	printf("press a key to continue the test of delete function.\n");
	getchar();
	native_dir dir4("1");
	assert(!dir4.delete_dir(false));
	assert(dir4.delete_dir(true));
}
开发者ID:zheng-da,项目名称:FlashX,代码行数:26,代码来源:native_file_unit_test.cpp

示例12: QString

void MainWindow::LoadContest(const QString& path)
{
    if (!QDir(path).exists())
    {
        QMessageBox::critical(this, "无法打开竞赛", QString("%1\n路径不存在或已被移除。").arg(path));
        QSettings set("ccr.ini", QSettings::IniFormat);
        QStringList list = set.value("RecentContestList").toStringList();
        list.removeAll(path);
        set.setValue("RecentContestList", list);
        UpdateRecentContest(true);
        return;
    }

    QDir dir1(path + "/src"), dir2(path + "/data");
    if (!dir1.exists() || !dir2.exists())
        if (QMessageBox::question(this, "找不到试题或选手目录", "是否继续打开并创建子目录?") == QMessageBox::No) return;

    if (!dir1.exists() && !QDir(path).mkdir("src"))
    {
        QMessageBox::critical(this, "无法创建子目录", "创建子目录失败!");
        return;
    }
    if (!dir2.exists() && !QDir(path).mkdir("data"))
    {
        QMessageBox::critical(this, "无法创建子目录", "创建子目录失败!");
        return;
    }

    if (!Global::g_is_contest_closed) CloseContest();
    lastContest = path;
    Global::g_contest.SetPath(path);

    QSettings set("ccr.ini", QSettings::IniFormat);
    QStringList list = set.value("RecentContestList").toStringList();
    if (!list.count(path)) list.prepend(path);
    set.setValue("RecentContestList", list);
    set.setValue("LastContest", lastContest);
    UpdateRecentContest(false);

    ui->label_top->hide();
    ui->label_bottom->hide();
    ui->listWidget_recent->hide();
    close_button->show();

    this->setWindowTitle(path + " - CCR Plus 测评器");
    ui->action_close->setEnabled(true);
    ui->action_configure->setEnabled(true);
    ui->action_set_list->setEnabled(true);
    ui->action_export->setEnabled(true);
    ui->action_refresh->setEnabled(true);
    ui->action_judge_selected->setEnabled(true);
    ui->action_judge_unjudged->setEnabled(true);
    ui->action_judge_all->setEnabled(true);
    ui->action_stop->setEnabled(false);

    Global::g_is_judge_stoped = false;
    Global::g_is_contest_closed = false;

    LoadTable();
}
开发者ID:equation314,项目名称:CCR-Plus,代码行数:60,代码来源:mainwindow.cpp

示例13: u

void KBookmarkManager::slotNotify( const char *_url )
{
  if ( !m_bNotify )
    return;
  
  KURL u( _url );
  if ( strcmp( u.protocol(), "file" ) != 0 )
    return;
  
  QString p = kapp->localkdedir().data();
  p += "/share/apps/kfm/bookmarks";
  QDir dir2( p );
  QDir dir1( u.path() );

  QString p1( dir1.canonicalPath() );
  QString p2( dir2.canonicalPath() );
  if ( p1.isEmpty() )
    p1 = u.path();
  if ( p2.isEmpty() )
    p2 = p.data();
  
  if ( strncmp( p1.data(), p2.data(), p2.length() ) == 0 )
  {
    QString d = kapp->localkdedir().data();
    d += "/share/apps/kfm/bookmarks/";
    scan( d );
  }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:28,代码来源:bookmark.cpp

示例14: GetPlaneCylinderOffset

float GetPlaneCylinderOffset(const Vect &dir, float cylHalfHeight, float cylRadius)
{
    Vect2 dir2(sqrtf(1.0f-(dir.y*dir.y)), fabs(dir.y));
    Vect2 centerOffset(cylRadius, cylHalfHeight);

    return centerOffset.Dot(dir2);
}
开发者ID:373137461,项目名称:OBS,代码行数:7,代码来源:XMath.cpp

示例15: dif

void InMapDraw_QuadDrawer::DrawQuad(int x, int y)
{
	int drawQuadsX = imd->drawQuadsX;
	CInMapDraw::DrawQuad* dq = &imd->drawQuads[y * drawQuadsX + x];

	va->EnlargeArrays(dq->points.size()*12,0,VA_SIZE_TC);
	//! draw point markers
	for (std::list<CInMapDraw::MapPoint>::iterator pi = dq->points.begin(); pi != dq->points.end(); ++pi) {
		if (pi->MaySee(imd)) {
			float3 pos = pi->pos;
			float3 dif(pos - camera->pos);
			dif.ANormalize();
			float3 dir1(dif.cross(UpVector));
			dir1.ANormalize();
			float3 dir2(dif.cross(dir1));

			unsigned char col[4];
			col[0] = pi->color[0];
			col[1] = pi->color[1];
			col[2] = pi->color[2];
			col[3] = 200;

			float size = 6;
			float3 pos1 = pos;
			pos1.y += 5.0f;
			float3 pos2 = pos1;
			pos2.y += 100.0f;

			va->AddVertexQTC(pos1 - dir1 * size,               0.25f, 0, col);
			va->AddVertexQTC(pos1 + dir1 * size,               0.25f, 1, col);
			va->AddVertexQTC(pos1 + dir1 * size + dir2 * size, 0.00f, 1, col);
			va->AddVertexQTC(pos1 - dir1 * size + dir2 * size, 0.00f, 0, col);

			va->AddVertexQTC(pos1 - dir1 * size,               0.75f, 0, col);
			va->AddVertexQTC(pos1 + dir1 * size,               0.75f, 1, col);
			va->AddVertexQTC(pos2 + dir1 * size,               0.75f, 1, col);
			va->AddVertexQTC(pos2 - dir1 * size,               0.75f, 0, col);

			va->AddVertexQTC(pos2 - dir1 * size,               0.25f, 0, col);
			va->AddVertexQTC(pos2 + dir1 * size,               0.25f, 1, col);
			va->AddVertexQTC(pos2 + dir1 * size - dir2 * size, 0.00f, 1, col);
			va->AddVertexQTC(pos2 - dir1 * size - dir2 * size, 0.00f, 0, col);

			if (pi->label.size() > 0) {
				font->SetTextColor(pi->color[0]/255.0f, pi->color[1]/255.0f, pi->color[2]/255.0f, 1.0f); //FIXME (overload!)
				font->glWorldPrint(pos2 + UpVector * 6, 26.0f, pi->label);
			}
		}
	}

	lineva->EnlargeArrays(dq->lines.size()*2,0,VA_SIZE_C);
	//! draw line markers
	for (std::list<CInMapDraw::MapLine>::iterator li = dq->lines.begin(); li != dq->lines.end(); ++li) {
		if (li->MaySee(imd)) {
			lineva->AddVertexQC(li->pos - (li->pos - camera->pos).ANormalize() * 26, li->color);
			lineva->AddVertexQC(li->pos2 - (li->pos2 - camera->pos).ANormalize() * 26, li->color);
		}
	}
}
开发者ID:tranchis,项目名称:spring,代码行数:59,代码来源:InMapDraw.cpp


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