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


C++ Dir函数代码示例

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


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

示例1: Pos

NaGePlane::NaGePlane(const double& A, const double& B, const double& C, const double& D)
{
	Equation[0] = A;
	Equation[1] = B;
	Equation[2] = C;
	Equation[3] = D;

	NaGePoint3D Pos(A, B, C);
	NaGeVector3D Dir(A, B, C);

	
	NaGeAxisSystem location(Pos, Dir);

	double d = location.GetDirection().Magnitude();
	if ( d > 0.0 )
	{
		d = 1.0/d;
		NaGeVector3D O = location.GetDirection()*(-d)*Equation[3];
		location.SetPosition(O.Point());
	}

	itsLocation = location;
	
	geomType = GEPLANE;
}
开发者ID:cybaj,项目名称:NAK,代码行数:25,代码来源:NaGePlane.cpp

示例2: Dir

void ProcessingDlg::ReadDir(const wxString& DirName)
{
    wxDir Dir(DirName);

    if ( !Dir.IsOpened() ) return;

    Status->SetLabel(_T("Reading dir: ") + DirName);
    ::wxYield();
    if ( StopFlag ) return;

    wxString Name;

    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_FILES|wxDIR_HIDDEN) )
    {
        do
        {
            Map[Name].Add(DirName + wxFileName::GetPathSeparator() + Name);
        }
        while ( Dir.GetNext(&Name) );
    }

    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_DIRS|wxDIR_HIDDEN) )
    {
        do
        {
            Map[Name].Add(DirName + wxFileName::GetPathSeparator() + Name);
            ReadDir(DirName + wxFileName::GetPathSeparator() + Name);
        }
        while ( Dir.GetNext(&Name) );
    }
}
开发者ID:stahta01,项目名称:EmBlocks,代码行数:31,代码来源:processingdlg.cpp

示例3: Origin

/*
Creates the hyperboloid using a formula. 
TODO: Update this so the hyperboloid actually represents a proper parametric model. 
*/
TopoDS_Shape hyperboloid::create(double innerRadius, double height, double heightUnder, double angle)
{
		int detail = 40;
		gp_Pnt Origin(0,0,0);
		gp_Vec Dir(0,0,1);

		int uCount = detail;
		double a = innerRadius;
		double c = angle;
		double totalHeight = height + heightUnder;
		TColgp_Array1OfPnt array (0,uCount - 1);

		for (double u = 0; u < uCount; u++)
		{	
			double uValue = ((totalHeight * u / (uCount - 1)) - heightUnder) / c;
			double vValue = 0;

			double sqrMe = 1 + uValue * uValue;

			double x = a * sqrt(sqrMe) * cos(vValue);
			double y = a * sqrt(sqrMe) * sin(vValue);
			double z = c * uValue;
			gp_Pnt P1(x,y,z);   
			array.SetValue(u,P1); 
		}
	                          
		Handle(Geom_BSplineCurve) hyperbola = GeomAPI_PointsToBSpline(array).Curve();    
		TopoDS_Edge hyperbolaTopoDS = BRepBuilderAPI_MakeEdge(hyperbola); 

		gp_Ax1 axis = gp_Ax1(Origin,Dir); 
		TopoDS_Shape hyperboloid = BRepPrimAPI_MakeRevol(hyperbolaTopoDS, axis); 

		return hyperboloid;
}
开发者ID:jf---,项目名称:openshapefactory,代码行数:38,代码来源:hyperboloid.cpp

示例4: heapifica

void heapifica(int *heap, int N, int x) 
{
	int aux, maior = x, esq = Esq(x), dir = Dir(x);  		
	
    if(esq <= N && heap[esq] > heap[x])//se o filho for maior q o pai, faz a troca
									//a partir da posicao passada como parametro
	{        
		maior = esq;
	}

	if(dir <= N && heap[dir] > heap[maior])
	{
		maior = dir;
	}


	if(maior != x) // se o indice do pai mudou;
	{
		aux = heap[x];
		heap[x] = heap[maior];
		heap[maior] = aux;

		heapifica(heap, N, maior);
	}
}
开发者ID:diogosm,项目名称:Faculdade,代码行数:25,代码来源:trabalho_PAA.c

示例5: Split2

QStringList CArchiveThread::ListParts(const QString &ArchivePath, bool NamesOnly)
{
	QStringList Parts;

	StrPair PathName = Split2(ArchivePath, "/", true);
	StrPair NameEx = Split2(PathName.second, ".", true);
	QRegExp Pattern;
	if(NameEx.second == "rar")
		Pattern = QRegExp(QRegExp::escape(NameEx.first) + "(\\.part[0-9]*)?\\.rar", Qt::CaseInsensitive);
	else
		Pattern = QRegExp(QRegExp::escape(NameEx.first + "." + NameEx.second) + "(\\.[0-9]*)?", Qt::CaseInsensitive);
	
	QDir Dir(PathName.first);
	foreach (const QString& File, Dir.entryList())
	{
		if (File.compare(".") == 0 || File.compare("..") == 0)
			continue;
		if(Pattern.exactMatch(File))
		{
			if(NamesOnly)
				Parts.append(File);
			else
				Parts.append(PathName.first + "/" + File);
		}
	}
	return Parts;
}
开发者ID:bratao,项目名称:NeoLoader,代码行数:27,代码来源:ArchiveThread.cpp

示例6: Dir

	void Roataion::rotate( Dir axis )
	{
		mDir[0] = FDir::Rotate( axis , mDir[0] );
		mDir[1] = FDir::Rotate( axis , mDir[1] );
		mDir[2] = Dir( FDir::Cross( mDir[0] , mDir[1] ) );
		assert( mDir[2] != -1 );
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:7,代码来源:MVCommon.cpp

示例7: Dir

int LibraryDetectionManager::LoadXmlConfig(const wxString& Path)
{
    wxDir Dir(Path);
    wxString Name;
    if ( !Dir.IsOpened() ) return 0;

    int loaded = 0;
    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_DIRS|wxDIR_HIDDEN) )
    {
        do
        {
            loaded += LoadXmlConfig(Path+wxFileName::GetPathSeparator()+Name);
        }
        while ( Dir.GetNext(&Name) );
    }

    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_FILES|wxDIR_HIDDEN) )
    {
        do
        {
            loaded += LoadXmlFile(Path+wxFileName::GetPathSeparator()+Name) ? 1 : 0;
        }
        while ( Dir.GetNext(&Name) );
    }

    return loaded;
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:27,代码来源:librarydetectionmanager.cpp

示例8: Dir

///////////////////////////////////////////////////////////////////////////
//	Name:	CopyDataStore
//
//	Description:
//	Copy all the files in the specified source directory to the specified
//	destination directory.  Based on bQuestion ask a question about overwriting
//	any existing files, else just copy the files whether or not something
//	already exists.
//	
//	Declaration:
//	bool CDbIni::CopyDataStore(CString &strSourceRootPath, CString &strDestinationRootPath, bool bQuestion)
//
//	Input:	strSourceRootPath		base path of where to get the datastore to copy from
//			strDestinationRootPath	base path of where to copy the datastore to
//			bQuestion				whether or not to ask a question if the datastore exists at the destination
//			m_strComponentName		name of the subpath where this instrument's datastore is kept
//			m_strMyIniFilename		name of file that indicates a datastore is present
//
//	Output:	none
//
//	Return:	true (db exists and initialized) / false (error in operation)
//	
//  date    /	author	revision
//  -----------------	--------
//	28-Jan-2002	SFK		Created
//////////////////////////////////////////////////////////////////
bool CDbIni::CopyDataStore(CString &strSourceRootPath, CString &strDestinationRootPath, bool bQuestion)
{
	CDirUtilities Dir(false);  //QUIET MODE IS ALWAYS OFF FOR TIMEALIGN pjm 11/27/2007 for B2R1
	bool bOverwrite;
	bool bSuccess = false;
	CString strError;
	
	if ((m_strComponentName.GetLength() == 0) || (m_strMyIniFilename.GetLength() == 0)) {
		strError.Format("BackupDataStore: No component name or ini filename program error, cannot continue.");
		MessageBox(NULL, strError, "Fatal Error", MB_OK|MB_ICONWARNING);
		return(false);
	}

	CString strFullDestinationPath = Dir.AppendPath(strDestinationRootPath, m_strComponentName);	// create the Instrument Com specific path
	CString strFullSourcePath = Dir.AppendPath(strSourceRootPath, m_strComponentName);	// create the Instrument Com specific path

	bool bExists = Dir.FileExists(strFullDestinationPath, m_strMyIniFilename);	// does a datastore exist there already?

	if (bExists && bQuestion) {
		bOverwrite = Dir.OverwriteDbQuestion(strFullDestinationPath);		// datastore exists, see if they want to overwrite
	}
	else bOverwrite = true;

	if ((!bExists) || (bExists && bOverwrite)) {	// copy current datastore to the specified destination
		bExists = Dir.FileExists(strFullSourcePath, m_strMyIniFilename);	// is a file even there to copy?
		if (bExists) bSuccess = Dir.CopyDirectory(strFullSourcePath, strFullDestinationPath, true);
		else bSuccess = true;
	}
	return(bSuccess);
}
开发者ID:hnordquist,项目名称:Radiation-Review,代码行数:56,代码来源:DbIni.cpp

示例9: Node

Route_Node::Route_Node (void)
{
	Node (0);
	Dwell (0);
	TTime (0);
	Dir (0);
}
开发者ID:kravitz,项目名称:transims4,代码行数:7,代码来源:Route_Node.cpp

示例10: Dir

bool cFileList::Read(char *dir, bool withsub)
{
  bool ret = false;
  char *buffer = NULL;

  struct dirent *DirData = NULL;

  cReadDir Dir(dir);
  if(Dir.Ok())
  {
    while((DirData = Dir.Next()) != NULL)
    {
      if(CheckIncludes(dir, DirData->d_name)  &&
         !CheckExcludes(dir, DirData->d_name) &&
         CheckType(dir, DirData->d_name, Type))
        SortIn(dir, DirData->d_name);
      if(withsub &&
         CheckType(dir, DirData->d_name, tDir) &&
         !RegIMatch(DirData->d_name, "^\\.{1,2}$"))
      {
        asprintf(&buffer, "%s/%s", dir, DirData->d_name);
        Read(buffer, withsub);
        FREENULL(buffer);
      }
    }
    ret = true;
  }

  return ret;
}
开发者ID:suborb,项目名称:reelvdr,代码行数:30,代码来源:helpers.c

示例11: sRoot

void CWebSock::GetAvailSkins(VCString& vRet) const {
	vRet.clear();

	CString sRoot(GetSkinPath("_default_"));

	sRoot.TrimRight("/");
	sRoot.TrimRight("_default_");
	sRoot.TrimRight("/");

	if (!sRoot.empty()) {
		sRoot += "/";
	}

	if (!sRoot.empty() && CFile::IsDir(sRoot)) {
		CDir Dir(sRoot);

		for (unsigned int d = 0; d < Dir.size(); d++) {
			const CFile& SubDir = *Dir[d];

			if (SubDir.IsDir() && SubDir.GetShortName() == "_default_") {
				vRet.push_back(SubDir.GetShortName());
				break;
			}
		}

		for (unsigned int e = 0; e < Dir.size(); e++) {
			const CFile& SubDir = *Dir[e];

			if (SubDir.IsDir() && SubDir.GetShortName() != "_default_" && SubDir.GetShortName() != ".svn") {
				vRet.push_back(SubDir.GetShortName());
			}
		}
	}
}
开发者ID:Affix,项目名称:znc,代码行数:34,代码来源:WebModules.cpp

示例12: setWindowTitle

void MainWindow::PathFileRefresh(QString szFilePath)
{
	// reverse find last path separator,
	// strip filename from path
	// and check for supported files in path
	szFilePath.replace('\\', "/");
	int iPos = szFilePath.lastIndexOf('/');
	if (iPos == -1)
	{
		// does not have path separator as expected -> nothing to do
		setWindowTitle(m_szBaseTitle);
		return;
	}

	QString szFile = szFilePath.right(szFilePath.length() - iPos -1);

	// quick hack to show current file
	QString szTitle = m_szBaseTitle + " - " + szFile;
	setWindowTitle(szTitle);
	
	if (m_ImageList.length() < 1)
	{
		m_szCurPath = szFilePath.left(iPos + 1);

		// TODO: filter by supported image-codecs..
		// see: QImageReader::supportedImageFormats()
		
		QDir Dir(m_szCurPath);
		m_ImageList = Dir.entryList(QDir::Files | QDir::NoDotAndDotDot, 
									QDir::Name | QDir::IgnoreCase);
	}
	
	m_iCurImageIx = m_ImageList.indexOf(szFile);
}
开发者ID:cosmos180,项目名称:qpicview,代码行数:34,代码来源:mainwindow.cpp

示例13: firstUse

bool firstUse()
{
    QDir Dir(loc);
    if (Dir.exists())
        return false;
    else
        return true;
}
开发者ID:yuting-zhang,项目名称:EasySign,代码行数:8,代码来源:FileProcess.cpp

示例14: assert

	void Roataion::set(Dir dirX , Dir dirZ)
	{
		int dirCross = FDir::Cross( dirZ , dirX );
		assert( dirCross != -1 );
		mDir[0] = dirX;
		mDir[1] = Dir( dirCross );
		mDir[2] = dirZ;
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:8,代码来源:MVCommon.cpp

示例15: Dir0

void RecentBooksDlg::removeFile(LVPtrVector<CRFileHistRecord> & files, int num)
{

    QDir Dir0( cr2qt(files[num-1]->getFilePath()) );
    // Удаляемый файл ещё существует
    if((Dir0.exists( cr2qt(files.get(num-1)->getFileName()) )) && (files.length() > 1)){
        // Нужно чтобы в истории было больше одной книжки, чтобы можно было загрузить удяляемую запись а потом удалить
        m_docview->loadDocument(cr2qt(files[num-1]->getFilePathName()));

        // remove cache file
        QString filename = cr2qt(files.get(num-1)->getFileName());
        filename = cr2qt(m_docview->getDocView()->getDocProps()->getStringDef(DOC_PROP_FILE_NAME));

        // Уточняем CRC удаляемого файла
        lUInt32 crc = m_docview->getDocView()->getDocProps()->getIntDef(DOC_PROP_FILE_CRC32, 0);
        char s[16];
        sprintf(s, ".%08x", (unsigned)crc);
        filename = filename+ QString(s);

        // Возвращаем активным первоначально просматриваемый документ (он сейчас первым в списке истории стоит)
        m_docview->loadDocument(cr2qt(files[1]->getFilePathName()));
        //	// для отладки

        // trim file extension, need for archive files

        QDir Dir(qApp->applicationDirPath() + QDir::toNativeSeparators(QString("/data/cache/")));
        QStringList fileList = Dir.entryList(QStringList() << filename + "*.cr3", QDir::Files);
        if(fileList.count())
            Dir.remove(fileList.at(0));

        files.remove(1);
    } else {
        // Известно лишь название архива и если его название не совпадает с названием файла то кеш файл не будет удалён
        // remove cache file
        QString filename = cr2qt(files.get(num-1)->getFileName());
        // trim file extension, need for archive files
        int pos = filename.lastIndexOf(".");
        if(pos != -1) filename.resize(pos);
        QDir Dir(qApp->applicationDirPath() + QDir::toNativeSeparators(QString("/data/cache/")));
        QStringList fileList = Dir.entryList(QStringList() << filename + "*.cr3", QDir::Files);
        if(fileList.count())
            Dir.remove(fileList.at(0));
        files.remove(num-1);
    }
}
开发者ID:Tvangeste,项目名称:coolreader-kindle-qt,代码行数:45,代码来源:recentdlg.cpp


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