本文整理汇总了C++中filename函数的典型用法代码示例。如果您正苦于以下问题:C++ filename函数的具体用法?C++ filename怎么用?C++ filename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filename函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Lock
void
FindWindow::FindResults(void)
{
// This function is called from the FinderThread function, so locking is
// required when accessing any member variables.
Lock();
bool canReplace = fReplaceButton->IsEnabled();
EnableReplace(false);
for (int32 i = fResultList->CountItems() - 1; i >= 0; i--)
{
// We don't want to hog the window lock, but we also don't want
// tons of context switches, either. Yielding the lock every 5 items
// should give us sufficient responsiveness.
if (i % 5 == 0)
{
Unlock();
Lock();
}
BListItem *item = fResultList->RemoveItem(i);
delete item;
}
Unlock();
ShellHelper shell;
shell << "cd ";
shell.AddEscapedArg(fWorkingDir);
shell << "; pwd; find . -type f ";
shell << "|xargs grep -n -H -s --binary-files=without-match ";
// TODO check for PCRE invocation and pass in pcre flag to grep if so
// TODO Ensure RE escaping also happens (E.g. open/close paran etc.)
shell.AddEscapedArg(fFindBox->Text());
if (fThreadQuitFlag)
return;
BString out;
shell.RunInPipe(out, false);
if (fThreadQuitFlag)
return;
BObjectList<BString> resultList(20, true);
TokenizeToList(out.String(), resultList);
Lock();
for (int32 i = 0; i < resultList.CountItems(); i++)
{
// We don't want to hog the window lock, but we also don't want
// tons of context switches, either. Yielding the lock every 5 items
// should give us sufficient responsiveness.
if (i % 5 == 0)
{
Unlock();
Lock();
}
BString entryString(resultList.ItemAt(i)->String());
BString filename(entryString);
int32 pos = filename.FindFirst(":");
if (pos < 0)
continue;
filename.Truncate(pos);
if (filename.StartsWith("./"))
filename.Remove(0,2);
STRACE(2,("Truncated file name from grep: %s\n",filename.String()));
BString lineString;
entryString.CopyInto(lineString, pos + 1, entryString.CountChars() - pos);
int32 pos2 = lineString.FindFirst(":");
BString locationString;
lineString.CopyInto(locationString, pos2 + 1, lineString.CountChars() - pos2);
lineString.Truncate(pos2);
DPath entryPath(fWorkingDir);
entryPath << filename;
BString fullPath(fWorkingDir);
fullPath << "/" << filename;
STRACE(2,("Full path: %s\n",fullPath.String()));
DPath relPath(filename);
fResultList->AddItem(new GrepListItem(fullPath,filename,
entryPath.GetRef(), atol(lineString.String()),
locationString.String()));
}
EnableReplace(true);
if (fResultList->CountItems() == 0)
fResultList->AddItem(new BStringItem(B_TRANSLATE("No matches found")));
Unlock();
}
开发者ID:humdingerb,项目名称:Paladin,代码行数:100,代码来源:FindWindow.cpp
示例2: merror
bool ExperimentUnpackager::unpackageExperiment(Datum payload) {
namespace bf = boost::filesystem;
if(payload.getDataType() != M_DICTIONARY) {
merror(M_NETWORK_MESSAGE_DOMAIN,
"Invalid payload type for experiment package");
return false;
}
Datum experimentFilePackage =
payload.getElement(M_PACKAGER_EXPERIMENT_STRING);
if(experimentFilePackage.getNElements() !=
M_EXPERIMENT_PACKAGE_NUMBER_ELEMENTS_PER_UNIT ||
experimentFilePackage.getDataType() != M_DICTIONARY)
return false;
Datum experimentFileName =
experimentFilePackage.getElement(M_PACKAGER_FILENAME_STRING);
if(experimentFileName.getDataType() != M_STRING ||
experimentFileName.getStringLength() <= 0)
return false;
bf::path experimentName(experimentFileName.getString());
loadedExperimentFilename = prependExperimentInstallPath(removeFileExtension(experimentName.string()),
experimentName.string());
bf::path experimentPath = loadedExperimentFilename.branch_path();
createExperimentInstallDirectoryStructure(experimentName.string());
// create the XML file
Datum experimentFileBuffer =
experimentFilePackage.getElement(M_PACKAGER_CONTENTS_STRING);
if(experimentFileBuffer.getDataType() != M_STRING ||
experimentFileBuffer.getStringLength() <= 0)
return false;
if(!(createFile(Datum(loadedExperimentFilename.string().c_str()),
experimentFileBuffer))) {
// failed to create experiment file
merror(M_FILE_MESSAGE_DOMAIN,
"Failed to create server side experiment file %s",
loadedExperimentFilename.string().c_str());
return false;
}
// create all of the other media files
Datum mediaFileList = payload.getElement(M_PACKAGER_MEDIA_BUFFERS_STRING);
if(mediaFileList.isList()) {
for(int i=0; i<mediaFileList.getNElements(); ++i) {
Datum mediaFilePackage = mediaFileList.getElement(i);
if(mediaFilePackage.getDataType() != M_DICTIONARY |
mediaFilePackage.getNElements() != 2) {
merror(M_FILE_MESSAGE_DOMAIN,
"incorrectly packaged media files");
return false;
}
Datum mediaFileName =
mediaFilePackage.getElement(M_PACKAGER_FILENAME_STRING);
Datum mediaFileBuffer =
mediaFilePackage.getElement(M_PACKAGER_CONTENTS_STRING);
if(mediaFileName.getDataType() != M_STRING ||
mediaFileName.getStringLength() <= 0 ||
mediaFileBuffer.getDataType() != M_STRING) return false;
std::string filename(mediaFileName.getString());
std::string filenameWPath = experimentPath.string() + "/" + filename;
if(!(createFile(Datum(filenameWPath.c_str()),
mediaFileBuffer))) {
// failed to create experiment file
merror(M_FILE_MESSAGE_DOMAIN,
"Failed to create server side experiment file %s",
filenameWPath.c_str());
return false;
}
}
}
expandRangeReplicatorItems(loadedExperimentFilename);
modifyExperimentMediaPaths(loadedExperimentFilename);
return true;
}
开发者ID:kumbhani,项目名称:mworks,代码行数:94,代码来源:ExperimentUnpackager.cpp
示例3: dataImport
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SimpleImportExample::runImport(const std::string &outputFilePath)
{
// Create a DataModel
MXADataModel::Pointer model = this->createSimpleModel();
// Create some external files that our import delegate will read
this->createTestFiles(model);
// Create a DataFile object which will create the actual file on disk.
IDataFile::Pointer dataFile = H5MXADataFile::CreateFileWithModel(outputFilePath, model);
//Create the DataImport Class
MXADataImport::Pointer dataImport(new MXADataImport());
dataImport->setDataFile(dataFile);
// Get an instance to the ImportDelegateManager
ImportDelegateManager::Pointer idManagerPtr = ImportDelegateManager::instance();
// Get a reference to an Import Delegate given the name of the class
IImportDelegate::Pointer delegatePtr = ImportDelegateManager::createNewImportDelegate(ExampleImport::Detail::ClassName);
// We have two dimensions for this model, create a loop to create data sets for each possible dimension value
IDataDimension::Pointer dim0 = model->getDataDimension(0); // Get the first Dimension
IDataDimension::Pointer dim1 = model->getDataDimension(1); // Get the second Dimension
// Create a DataRecord entry for the Data Model
IDataRecord::Pointer record = model->getDataRecordByNamedPath("DataRecordContainer/Test Data/Deep Nested Data");
// Set the start/end/increment values for each Data Dimension
int32_t dim0Start = dim0->getStartValue();
int32_t dim0End = dim0->getEndValue();
int32_t dim0Increment = dim0->getIncrement();
int32_t dim1Start = dim1->getStartValue();
int32_t dim1End = dim1->getEndValue();
int32_t dim1Increment = dim1->getIncrement();
// Create a nested loop to create the necessary DataSource objects that will
// be used to import the data into the HDF5 file
for (int32_t i = dim0Start; i <= dim0End; i += dim0Increment)
{
for (int j = dim1Start; j <= dim1End; j = j + dim1Increment)
{
std::string filename(Examples::SimportImportDataInputFile);
filename.append( StringUtils::numToString<int32_t>(i) );
filename.append("_").append(StringUtils::numToString<int32_t>(j)).append(".data");
//Create some Data Sources
MXADataSource::Pointer ds(new MXADataSource());
std::vector<int32_t> dimValues;
dimValues.push_back(i);
dimValues.push_back(j);
ds->setDimensionValues(dimValues);
ds->setDataRecord(record);
ds->setSourcePath(filename); //Since we are doing everything in software, this is unused
ds->setImportDelegate(delegatePtr);
ds->setDataModel(model);
dataImport->addDataSource(ds);
}
}
// Import the Data into the HDF5 File
// std::cout << "IMPORTING DATA NOW" << std::endl;
int32_t err = dataImport->import();
if (err < 0)
{
}
dataFile->closeFile(false);
}
开发者ID:BlueQuartzSoftware,项目名称:MXADataModel,代码行数:72,代码来源:SimpleImportExample.cpp
示例4: ASSERT
void
ExporterVTK<MeshType>::readVTUFiles( exporterData_Type& dvar )
{
ASSERT( this->M_numImportProc, "The number of pieces to be loaded was not specified." );
UInt numPoints, numCells;
std::vector<Real> inputValues;
std::vector<Real> localDOF;
const UInt start ( dvar.start() );
const UInt numGlobalDOF ( dvar.numDOF() );
// Each processor will read all the files, and fill just its own component of the vectors
for( UInt iProc = 0; iProc < this->M_numImportProc; ++iProc )
{
std::string filename( this->M_postDir + this->M_prefix + "_" + dvar.variableName() +
this->M_postfix + "." + iProc + ".vtu" );
std::ifstream inputFile( filename.c_str() );
if (!this->M_procId) std::cout << "\tfile "<< filename << std::endl;
ASSERT(inputFile.is_open(), "There is an error while opening " + filename );
// file parsing: line by line
std::string line;
size_t found;
std::stringstream parseLine;
while ( inputFile.good() && getline( inputFile, line ) )
{
// this is essentially a consistency check: the number of DOF is explicitly
// written in the VTK files. We will check that the number of values read
// from file matches this number
found = line.find( "NumberOfPoints" );
if ( found != std::string::npos )
{
// place the get pointer at the first " after NumberOfPoints
found = line.find( "\"", found, 1 );
// after the " we'll find the number: parse the substring
parseLine.str( line.substr(found+1) );
parseLine >> numPoints;
// do the same for NumberOfCells
found = line.find( "NumberOfCells" );
found = line.find( "\"", found, 1 );
parseLine.str( line.substr(found+1) );
parseLine >> numCells;
}
// load all PointData arrays
if ( line.find( "<PointData" ) != std::string::npos )
{
while ( inputFile.good() && getline( inputFile, line ) )
{
if ( line.find( dvar.variableName() ) != std::string::npos )
{
inputValues.resize( dvar.fieldDim()*numPoints );
if ( line.find( "binary" ) != std::string::npos )
{
UInt numBitsFloat;
found = line.find( "Float" );
parseLine.str( line.substr(found+5) );
parseLine >> numBitsFloat;
ASSERT(inputFile.good(), "There is an error while opening " + filename );
getline( inputFile, line );
readBinaryData( line, inputValues, numBitsFloat );
}
else
{
ASSERT(inputFile.good(), "There is an error while opening " + filename );
getline( inputFile, line );
readASCIIData( line, inputValues );
}
}
if ( line.find( "GlobalId" ) != std::string::npos )
{
localDOF.resize( numPoints );
ASSERT(inputFile.good(), "There is an error while opening " + filename );
getline( inputFile, line );
readASCIIData( line, localDOF );
}
}
开发者ID:nuraiman,项目名称:lifev,代码行数:83,代码来源:ExporterVTK.hpp
示例5: add_files
// Adds the file specified by ``path`` to the file_storage object. In case ``path``
// refers to a diretory, files will be added recursively from the directory.
//
// If specified, the predicate ``p`` is called once for every file and directory that
// is encountered. files for which ``p`` returns true are added, and directories for
// which ``p`` returns true are traversed. ``p`` must have the following signature::
//
// bool Pred(std::string const& p);
//
// The path that is passed in to the predicate is the full path of the file or
// directory. If no predicate is specified, all files are added, and all directories
// are traveresed.
//
// The ".." directory is never traversed.
//
// The ``flags`` argument should be the same as the flags passed to the `create_torrent`_
// constructor.
template <class Pred> void add_files(file_storage& fs, std::string const& file, Pred p, boost::uint32_t flags = 0)
{
detail::add_files_impl(fs, parent_path(complete(file)), filename(file), p, flags);
}
开发者ID:andreicristianpetcu,项目名称:popcorn-time,代码行数:21,代码来源:create_torrent.hpp
示例6: WindowsFlushable
MemoryMappedFile::Flushable* MemoryMappedFile::prepareFlush() {
return new WindowsFlushable(this, viewForFlushing(), fd, _uniqueId, filename(), _flushMutex);
}
开发者ID:VonRosenchild,项目名称:percona-server-mongodb,代码行数:3,代码来源:mmap_windows.cpp
示例7: open_table
void csvbuilder::open_table(const table_spec &spec) {
csv.open(filename(spec).c_str());
}
开发者ID:mcmayer,项目名称:sodata,代码行数:3,代码来源:csvbuilder.cpp
示例8: on_candidate
void MulticastHandler::dispatch(
boost::asio::ip::address senderAddress,
MulticastNetwork::Command command,
char *args,
unsigned char argsSize,
bool forward)
{
typedef MulticastNetwork::Command Command;
m_senderAddress = &senderAddress;
bool valid = false;
if (Command::Candidate == command && sizeof(uint32_t) == argsSize) {
valid = true;
on_candidate(ntohl(*reinterpret_cast<uint32_t*>(args)));
}
else if (Command::ElectGateway == command && 0 == argsSize) {
valid = true;
on_electGateway();
}
else if (Command::Forward == command && 0 < argsSize)
{
valid = true;
on_forward(static_cast<Command>(args[0]), args + 1, argsSize - 1);
}
else if (Command::Gateway == command && 0 == argsSize)
{
valid = true;
on_gateway();
}
else if (Command::Hello == command && sizeof(float) < argsSize) {
valid = true;
uint32_t b = ntohl(*reinterpret_cast<uint32_t*>(args + argsSize - sizeof(float)));
on_hello(std::string(args, argsSize - sizeof(float)),
*reinterpret_cast<float*>(&b));
}
else if (Command::Message == command && 0 < argsSize) {
valid = true;
on_message(std::string(args, argsSize));
}
else if (Command::RemoteGateway == command && 0 == argsSize) {
valid = true;
on_remoteGateway();
}
else if (Command::SearchBlock == command && sizeof(uint32_t) < argsSize) {
valid = true;
on_searchBlock(std::string(args, argsSize - sizeof(uint32_t)),
*reinterpret_cast<uint32_t*>(args + argsSize - sizeof(uint32_t)));
}
else if (Command::SearchFileName == command && 0 < argsSize) {
valid = true;
on_searchFileName(std::string(args, argsSize));
}
else if (Command::SearchFileNameReply == command && 0 < argsSize) {
valid = true;
std::map<std::string, std::pair<float, std::string>> results;
int index = 0;
while (index < argsSize) {
float filesize;
int stringLength = 0;
for (int i = index + Hash::SIZE + sizeof filesize; i < argsSize; i++) {
if (args[i] == '\0') {
break;
}
++stringLength;
}
if (index + stringLength + Hash::SIZE + sizeof filesize >= argsSize) {
break;
}
std::string hash(args + index, Hash::SIZE);
filesize = *reinterpret_cast<float*>(args + index + Hash::SIZE);
std::string filename(args + index + Hash::SIZE + sizeof filesize, stringLength);
results[filename] = std::pair<float, std::string>(filesize, hash);
index += Hash::SIZE + sizeof filesize + stringLength + 1;
}
on_searchFileNameReply(results);
}
if (valid && forward) {
m_gateway->forward(*m_senderAddress, command, args, argsSize);
}
}
开发者ID:nhurman,项目名称:Lecista,代码行数:88,代码来源:MulticastHandler.cpp
示例9: AddFilesFromDirectoryToTpaList
void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList)
{
const char * const tpaExtensions[] = {
".ni.dll", // Probe for .ni.dll first so that it's preferred if ni and il coexist in the same dir
".dll",
".ni.exe",
".exe",
};
DIR* dir = opendir(directory);
if (dir == nullptr)
{
return;
}
std::set<std::string> addedAssemblies;
// Walk the directory for each extension separately so that we first get files with .ni.dll extension,
// then files with .dll extension, etc.
for (int extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++)
{
const char* ext = tpaExtensions[extIndex];
int extLength = strlen(ext);
struct dirent* entry;
// For all entries in the directory
while ((entry = readdir(dir)) != nullptr)
{
// We are interested in files only
switch (entry->d_type)
{
case DT_REG:
break;
// Handle symlinks and file systems that do not support d_type
case DT_LNK:
case DT_UNKNOWN:
{
std::string fullFilename;
fullFilename.append(directory);
fullFilename.append("/");
fullFilename.append(entry->d_name);
struct stat sb;
if (stat(fullFilename.c_str(), &sb) == -1)
{
continue;
}
if (!S_ISREG(sb.st_mode))
{
continue;
}
}
break;
default:
continue;
}
std::string filename(entry->d_name);
// Check if the extension matches the one we are looking for
int extPos = filename.length() - extLength;
if ((extPos <= 0) || (filename.compare(extPos, extLength, ext) != 0))
{
continue;
}
std::string filenameWithoutExt(filename.substr(0, extPos));
// Make sure if we have an assembly with multiple extensions present,
// we insert only one version of it.
if (addedAssemblies.find(filenameWithoutExt) == addedAssemblies.end())
{
addedAssemblies.insert(filenameWithoutExt);
tpaList.append(directory);
tpaList.append("/");
tpaList.append(filename);
tpaList.append(":");
}
}
// Rewind the directory stream to be able to iterate over it for the next extension
rewinddir(dir);
}
closedir(dir);
}
开发者ID:blackdwarf,项目名称:coreclr,代码行数:92,代码来源:coreruncommon.cpp
示例10: ASSERT
CArchive *CDataFile::OpenAsCArchive( const char *pFilename )
{
ASSERT( pFilename );
// Get the relative path of the file for which to search.
CString filename( pFilename );
CString path;
path = "files\\" + filename;
path.MakeLower ();
// Check to see if the file exists in the patch directory.
if ( m_pPatchDir )
{
CString patchPath = *m_pPatchDir + "\\" + path;
CFile test;
if ( test.Open( patchPath, CFile::modeRead | CFile::shareDenyWrite | CFile::typeBinary ) != FALSE )
{
// Close the file so we can allocate a new CFile object to
// return to the caller.
test.Close();
// Allocate a new CFile object. By creating and opening the CFile
// this way, the CFile dtor will automagically close the file
// handle for us.
CFile *pNewFile = new CFile;
if ( pNewFile->Open( patchPath, CFile::modeRead | CFile::shareDenyWrite | CFile::typeBinary ) == FALSE )
ThrowError( ERR_PATCHFILE_OPEN );
CArchive *pNewCArchive = new CArchive( pNewFile, CArchive::load );
if ( pNewCArchive == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
return pNewCArchive;
}
}
// If here, the file does not exist in the
// patch directory or there is no patch directory.
// If a datafile was opened, look for it in the
// datafile.
if ( m_pDataFile )
{
// Look for the file path in the map. If
// it is not found, if searching for language
// file try searching for US version; otherwise,
// return NULL.
void * dummy;
if ( m_pFileMap->Lookup( path, dummy ) == FALSE )
ThrowError( ERR_DATAFILE_NO_ENTRY );
// If here, file was found in the map. Seek to
// that position in the file.
// If negative seek checks between CMmio's are
// desired, they should be done here.
long fileOffset = ( long )dummy;
long offsetFromHere = fileOffset - ( long )m_pDataFile->GetPosition();
#ifdef _DEBUG
if ( m_bNegativeSeekCheck == TRUE && fileOffset < m_lastPos )
WarnNegativeSeek( pFilename, m_lastPos, fileOffset );
#endif
m_pDataFile->Seek( offsetFromHere, CFile::current );
#ifdef _DEBUG
m_lastPos = m_pDataFile->GetPosition();
#endif
// Create a new CFile object. It will be positioned
// at the current file offset. Note that this dtor will
// not automagically close the file handle, which is what we
// want.
CFile * pNewFile = new CFile ();
if ( pNewFile == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
if (pNewFile->Open( m_sFileName, CFile::modeRead | CFile::shareDenyWrite | CFile::typeBinary ) == FALSE)
ThrowError( ERR_OUT_OF_MEMORY );
pNewFile->Seek (m_pDataFile->GetPosition (), CFile::begin);
CArchive *pNewCArchive = new CArchive( pNewFile, CArchive::load );
if ( pNewCArchive == NULL )
ThrowError( ERR_OUT_OF_MEMORY );
return pNewCArchive;
}
// If here, file was not found in patch dir ( or
// no patch dir was given ), and no datafile was
// opened, so return NULL ( no file found ).
ThrowError( ERR_DATAFILE_NO_ENTRY );
return NULL;
}
开发者ID:Marenz,项目名称:EnemyNations,代码行数:92,代码来源:Datafile.cpp
示例11: Clear
void CSHDispDialog::DisStart(const NewSHDispInfo& info)
{
CString strText;
if(m_peerMager->GetItemCount()>=100)
{
Clear();
}
strText.Format(_T("%d"),m_peerMager->GetItemCount()+1);
int item = m_peerMager->InsertItem(m_peerMager->GetItemCount(),strText);
m_peerMager->SetSelectedItem(item);
int subItem = 1;
CString filename(info.file_name);
m_peerMager->SetItemText(item,subItem++,filename);
//
strText.Format(_T("%d"),info.num);
m_peerMager->SetItemText(item,subItem++,strText);
m_peerMager->SetItemText(item,subItem++,GetSizeDesc(info.size).c_str());
strText.Format(_T("%ds"),info.duration);
m_peerMager->SetItemText(item,subItem++,strText);
subItem += 5;
//
strText.Format(_T("%d"),info.cdn_num);
m_peerMager->SetItemText(item,subItem++,strText);
subItem++;
strText.Format(_T("%d/%d"),m_usablePeer,m_allUsablePeer);
m_peerMager->SetItemText(item,subItem++,strText);
time_t ti(info.start_time);
tm temptm = *localtime(&ti);
SYSTEMTIME st = {1900 + temptm.tm_year,
1 + temptm.tm_mon,
temptm.tm_wday,
temptm.tm_mday,
temptm.tm_hour,
temptm.tm_min,
temptm.tm_sec,
0};
strText.Format(_T("%02d-%02d %02d:%02d:%02d"),st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);
m_peerMager->SetItemText(item,subItem++,strText);
strText.Format(_T("-:-:-"));
m_peerMager->SetItemText(item,subItem++,strText);
m_peerMager->SetItemText(item,subItem++,_T("正在下载"));
m_peerMager->SetItemData(item,info.ID);
subItem += 3;
if(info.type == 0)
{
m_peerMager->SetItemText(item,subItem++,_T("完整"));
}
else if(info.type == 1)
{
m_peerMager->SetItemText(item,subItem++,_T("拖拽"));
}
strText.Format(_T("%d"),info.play_start);
m_peerMager->SetItemText(item,subItem++,strText);
m_peerInfoHandle.insert(std::make_pair(info.ID,peer_list));
if(IsVisable())
{
m_peerMager->EnsureVisible(m_peerMager->GetItemCount()-1,FALSE);
}
if(m_peerDlg != NULL && m_peerDlg->IsVisable() )
{
CString peerDlgText = _T("");
peerDlgText.Format(_T("文件:%s 段号:%d"),info.file_name,info.num);
m_peerDlg->SetCaptionName(peerDlgText.GetBuffer());
m_peerDlg->Clear();
m_peerDlg->SetDownState(false);
m_peerDlg->SetDispItemID((int)info.ID);
m_peerDlg->UpdatePeerInfo(&peer_list,(int)info.ID);
}
}
开发者ID:chalilayang,项目名称:HttpProxyVersion1,代码行数:82,代码来源:DispDialog.cpp
示例12: main
/**
* Main function
**/
int main()
{
/**
* Initializing our input file stream
**/
ifstream Stream;
Stream.open("1.txt", ios::in);
/**
* Initializing the list and the iterator
**/
list<string>* Loaded = OrthodoxIterLoad(Stream);
Stream.close();
list<string>::iterator _i;
StringStack Cont1;
/**
* Just a test to show the correct work
* of the iterator
**/
cout << "Data from Loaded list, using OrthodoxIterLoad()"
<< endl;
for (_i = Loaded->begin(); _i != Loaded->end(); _i++)
{
cout << *_i
<< endl;
Cont1.push(*_i);
}
/**
* Reversing and outputing our stack
**/
Cont1.Reverse();
cout << "stack Cont1 after reversing:"
<< endl;
while (!Cont1.empty())
{
cout << Cont1.OutputRemoval() << endl;
}
/**
* Outputing our vector to file using iterators
**/
ofstream OutStream;
OutStream.open("e:/paul/2.txt", ios::out);
IterOutput(Loaded, OutStream);
/**
* Testing the ifstrean - derived class;
**/
Stringfstream SFS;
SFS.open("1.txt", ios::in | ios::out);
cout << "Testing the Stringfstream in work..."
<< endl;
string s;
SFS >> s;
cout << s << endl;
SFS.close();
/**
* Testing the NumberCopy class
**/
cout << "Testing the NumberCopy class..."
<< endl;
NumberCopy f1;
string filename("1.txt");
f1.Load(filename);
cout << f1.top();
/**
* Post-execution issues
**/
_getch();
return EXIT_SUCCESS;
}
开发者ID:Icebreaker454,项目名称:LAB6,代码行数:97,代码来源:Lab7.cpp
示例13: leaf
path leaf() const { return filename(); }
开发者ID:gijs,项目名称:PDAL,代码行数:1,代码来源:path.hpp
示例14: filename
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
ModifiedLambertProjection::Pointer ModifiedLambertProjection::CreateProjectionFromXYZCoords(FloatArrayType* coords, int dimension, float sphereRadius)
{
size_t npoints = coords->getNumberOfTuples();
bool nhCheck = false;
float sqCoord[2];
//int sqIndex = 0;
ModifiedLambertProjection::Pointer squareProj = ModifiedLambertProjection::New();
squareProj->initializeSquares(dimension, sphereRadius);
#if WRITE_LAMBERT_SQUARE_COORD_VTK
QString ss;
QString filename("/tmp/");
filename.append("ModifiedLambert_Square_Coords_").append(coords->getName()).append(".vtk");
FILE* f = NULL;
f = fopen(filename.toLatin1().data(), "wb");
if(NULL == f)
{
ss.str("");
QString ss = QObject::tr("Could not open vtk viz file %1 for writing. Please check access permissions and the path to the output location exists").arg(filename);
return squareProj;
}
// Write the correct header
fprintf(f, "# vtk DataFile Version 2.0\n");
fprintf(f, "data set from DREAM3D\n");
fprintf(f, "ASCII");
fprintf(f, "\n");
fprintf(f, "DATASET UNSTRUCTURED_GRID\nPOINTS %lu float\n", coords->getNumberOfTuples() );
#endif
for(size_t i = 0; i < npoints; ++i)
{
sqCoord[0] = 0.0;
sqCoord[1] = 0.0;
//get coordinates in square projection of crystal normal parallel to boundary normal
nhCheck = squareProj->getSquareCoord(coords->getPointer(i * 3), sqCoord);
#if WRITE_LAMBERT_SQUARE_COORD_VTK
fprintf(f, "%f %f 0\n", sqCoord[0], sqCoord[1]);
#endif
// Based on the XY coordinate, get the pointer index that the value corresponds to in the proper square
// sqIndex = squareProj->getSquareIndex(sqCoord);
if (nhCheck == true)
{
//north increment by 1
// squareProj->addValue(ModifiedLambertProjection::NorthSquare, sqIndex, 1.0);
squareProj->addInterpolatedValues(ModifiedLambertProjection::NorthSquare, sqCoord, 1.0);
}
else
{
// south increment by 1
// squareProj->addValue(ModifiedLambertProjection::SouthSquare, sqIndex, 1.0);
squareProj->addInterpolatedValues(ModifiedLambertProjection::SouthSquare, sqCoord, 1.0);
}
}
#if WRITE_LAMBERT_SQUARE_COORD_VTK
fclose(f);
#endif
return squareProj;
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:67,代码来源:ModifiedLambertProjection.cpp
示例15: cServerIndexNodeName
/**
Update ports for WebSphere
Load XML file <disk path>/config/cells/<Cell Name>/nodes/<Node Name>/serverindex.xml
Ger serverIndex/serverEntries node where serverName attribute is the name of the server
For HTTP port get specialEndpoints node where endPointName is WC_defaulthost and
get port attribute from endPoint node
For HTTPS port get specialEndpoints node where endPointName is WC_defaulthost_secure and
get port attribute from endPoint node
*/
void WebSphereAppServerInstance::UpdatePorts()
{
const string cServerIndexNodeName("serverindex:ServerIndex");
const string cServerEntriesNodeName("serverEntries");
const string cServerNameAttributeName("serverName");
const string cSpecialEndpointsNodeName("specialEndpoints");
const string cEndPointNameAttributeName("endPointName");
const string cWCdefaultHostName("WC_defaulthost");
const string cWCdefaultHostSecureName("WC_defaulthost_secure");
const string cEndPointNodeName("endPoint");
const string cPortAttributeName("port");
string xmlcontent;
SCXFilePath filename(returnProfileDiskPath(m_diskPath));
filename.AppendDirectory(L"config");
filename.AppendDirectory(L"cells");
filename.AppendDirectory(m_cell);
filename.AppendDirectory(L"nodes");
filename.AppendDirectory(m_node);
filename.SetFilename(L"serverindex.xml");
try {
SCXHandle<istream> mystream = m_deps->OpenXmlServerFile(filename.Get());
GetStringFromStream(mystream, xmlcontent);
// Load the XML, but don't honor namespaces
XElementPtr serverIndexNode;
XElement::Load(xmlcontent, serverIndexNode, false);
if (serverIndexNode->GetName() == cServerIndexNodeName)
{
XElementList serverEntriesNodes;
bool foundServer = false;
serverIndexNode->GetChildren(serverEntriesNodes);
for (size_t idx = 0; !foundServer && idx < serverEntriesNodes.size(); ++idx)
{
string name;
if (serverEntriesNodes[idx]->GetName() == cServerEntriesNodeName &&
serverEntriesNodes[idx]->GetAttributeValue(cServerNameAttributeName, name) &&
m_server == StrFromUTF8(name))
{
XElementList childNodes;
bool foundHTTPnode = false;
bool foundHTTPSnode = false;
foundServer = true;
serverEntriesNodes[idx]->GetChildren(childNodes);
for (size_t idx2 = 0; !(foundHTTPnode && foundHTTPSnode) && idx2 < childNodes.size(); ++idx2)
{
if (childNodes[idx2]->GetName() == cSpecialEndpointsNodeName &&
childNodes[idx2]->GetAttributeValue(cEndPointNameAttributeName, name))
{
if (cWCdefaultHostName == name)
{
GetPortFromXml(childNodes[idx2], foundHTTPnode, m_httpPort);
}
else if (cWCdefaultHostSecureName == name)
{
GetPortFromXml(childNodes[idx2], foundHTTPSnode, m_httpsPort);
}
}
}
}
}
}
}
catch (SCXFilePathNotFoundException&)
{
SCX_LOGERROR(m_log, wstring(L"WebSphereAppServerInstance::UpdatePorts() - ").append(GetId()).append(L" - Could not find file: ").append(filename));
}
catch (SCXUnauthorizedFileSystemAccessException&)
{
SCX_LOGERROR(m_log, wstring(L"WebSphereAppServerInstance::UpdatePorts() - ").append(GetId()).append(L" - not authorized to open file: ").append(filename));
}
catch (XmlException&)
{
SCX_LOGERROR(m_log, wstring(L"WebSphereAppServerInstance::UpdatePorts() - ").append(GetId()).append(L" - Could not load XML from file: ").append(filename));
}
}
开发者ID:Microsoft,项目名称:SCXcore,代码行数:94,代码来源:websphereappserverinstance.cpp
示例16: fopen
//=================================================================
bool TileAssembler::convertRawFile(const std::string& pModelFilename)
{
bool success = true;
std::string filename = iSrcDir;
if (filename.length() >0)
filename.push_back('/');
filename.append(pModelFilename);
FILE *rf = fopen(filename.c_str(), "rb");
if (!rf)
{
printf("ERROR: Can't open model file in form: %s", pModelFilename.c_str());
printf("... or form: %s", filename.c_str() );
return false;
}
char ident[8];
int readOperation = 1;
// temporary use defines to simplify read/check code (close file and return at fail)
#define READ_OR_RETURN(V, S) if (fread((V), (S), 1, rf) != 1) { \
fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++;
#define READ_OR_RETURN_WITH_DELETE(V, S) if (fread((V), (S), 1, rf) != 1) { \
fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++;
#define CMP_OR_RETURN(V, S) if (strcmp((V), (S)) != 0) { \
fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); }
READ_OR_RETURN(&ident, 8);
CMP_OR_RETURN(ident, "VMAP003");
// we have to read one int. This is needed during the export and we have to skip it here
uint32 tempNVectors;
READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors));
uint32 groups;
uint32 RootWMOID;
char blockId[5];
blockId[4] = 0;
int blocksize;
READ_OR_RETURN(&groups, sizeof(uint32));
READ_OR_RETURN(&RootWMOID, sizeof(uint32));
std::vector<GroupModel> groupsArray;
for (uint32 g=0; g<groups; ++g)
{
std::vector<MeshTriangle> triangles;
std::vector<Vector3> vertexArray;
uint32 mogpflags, GroupWMOID;
READ_OR_RETURN(&mogpflags, sizeof(uint32));
READ_OR_RETURN(&GroupWMOID, sizeof(uint32));
float bbox1[3], bbox2[3];
READ_OR_RETURN(bbox1, sizeof(float)*3);
READ_OR_RETURN(bbox2, sizeof(float)*3);
uint32 liquidflags;
READ_OR_RETURN(&liquidflags, sizeof(uint32));
// will this ever be used? what is it good for anyway??
uint32 branches;
READ_OR_RETURN(&blockId, 4);
CMP_OR_RETURN(blockId, "GRP ");
READ_OR_RETURN(&blocksize, sizeof(int));
READ_OR_RETURN(&branches, sizeof(uint32));
for (uint32 b=0; b<branches; ++b)
{
uint32 indexes;
// indexes for each branch (not used jet)
READ_OR_RETURN(&indexes, sizeof(uint32));
}
// ---- indexes
READ_OR_RETURN(&blockId, 4);
CMP_OR_RETURN(blockId, "INDX");
READ_OR_RETURN(&blocksize, sizeof(int));
uint32 nindexes;
READ_OR_RETURN(&nindexes, sizeof(uint32));
if (nindexes >0)
{
uint16 *indexarray = new uint16[nindexes];
READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16));
for (uint32 i=0; i<nindexes; i+=3)
{
triangles.push_back(MeshTriangle(indexarray[i], indexarray[i+1], indexarray[i+2]));
}
delete[] indexarray;
}
// ---- vectors
READ_OR_RETURN(&blockId, 4);
CMP_OR_RETURN(blockId, "VERT");
READ_OR_RETURN(&blocksize, sizeof(int));
uint32 nvectors;
READ_OR_RETURN(&nvectors, sizeof(uint32));
//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:TrilliumEMU-1,代码行数:101,代码来源:TileAssembler.cpp
示例17: filename
void pyne::Material::from_hdf5(char * fchar, char * dchar, int row, int protocol)
{
std::string filename (fchar);
std::string datapath (dchar);
from_hdf5(filename, datapath, row, protocol);
};
开发者ID:chrisdembia,项目名称:pyne,代码行数:6,代码来源:material.cpp
示例18: found
void ExporterVTK<MeshType>::postProcess(const Real& time)
{
// typedef std::list< ExporterData >::iterator Iterator;
this->computePostfix();
std::size_t found( this->M_postfix.find( "*" ) );
if ( found == string::npos )
{
if (!this-&g
|
请发表评论