本文整理汇总了C++中AddFile函数的典型用法代码示例。如果您正苦于以下问题:C++ AddFile函数的具体用法?C++ AddFile怎么用?C++ AddFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CrashCallback
BOOL WINAPI CrashCallback(LPVOID lpvState)
{
CString sLogFile = GetAppDir() + _T("\\dummy.log");
CString sIniFile = GetAppDir() + _T("\\dummy.ini");
#ifdef TEST_DEPRECATED_FUNCS
AddFile(lpvState, sLogFile, _T("Dummy Log File"));
AddFile(lpvState, sLogFile, _T("Dummy INI File"));
#else
lpvState;
int nResult = crAddFile2(sLogFile, NULL, _T("Dummy Log File"), CR_AF_MAKE_FILE_COPY);
ATLASSERT(nResult==0);
nResult = crAddFile(sIniFile, _T("Dummy INI File"));
ATLASSERT(nResult==0);
nResult = crAddScreenshot(CR_AS_MAIN_WINDOW);
ATLASSERT(nResult==0);
nResult = crAddProperty(_T("VideoCard"),_T("nVidia GeForce 9800"));
ATLASSERT(nResult==0);
#endif
return TRUE;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:26,代码来源:CrashRptTest.cpp
示例2: CONS_Printf
// Pass a null terminated list of files to use.
// All files are optional, but at least one file must be found.
// The name searcher looks backwards, so a later file does override all earlier ones.
// Also adds GWA files if they exist.
bool FileCache::InitMultipleFiles(const char *const*filenames)
{
CONS_Printf("Loading resource files...\n");
bool result = true;
for ( ; *filenames != NULL; filenames++)
{
const char *curfile = *filenames;
if (AddFile(curfile) == -1)
result = false;
// try finding corresponding GWA file (GL-nodes data)
string gwafile(curfile);
// Try lower case.
gwafile.replace(gwafile.length()-3, 3, "gwa");
if (AddFile(gwafile.c_str(), true) == -1)
{
// not found, try upper case
gwafile.replace(gwafile.length()-3, 3, "GWA");
if (AddFile(gwafile.c_str(), true) == -1)
{
// CONS_Printf(" No GL information for file %s.\n", curfile);
continue; // not found
}
}
CONS_Printf(" Added GL information from file %s.\n", gwafile.c_str());
}
if (vfiles.size() == 0)
I_Error("FileCache::InitMultipleFiles: no files found");
// result = false : at least one file was missing
return result;
}
开发者ID:meiavy,项目名称:doom-legacy,代码行数:39,代码来源:w_wad.cpp
示例3: ProjectExistingFile
void ProjectExistingFile(void)
{
PROJECTITEM *data = GetItemInfo(prjSelectedItem);
if (data && (data->type == PJ_PROJ || data->type == PJ_FOLDER))
{
OPENFILENAME ofn;
if (OpenFileDialog(&ofn, data->realName, hwndProject, FALSE, TRUE, szNewFileFilter,
"Open existing file"))
{
char *path = ofn.lpstrFile;
if (path[strlen(path)+1]) // multiselect
{
char buf[MAX_PATH];
char *q = path + strlen(path) + 1;
while (*q)
{
sprintf(buf, "%s\\%s", path, q);
AddFile(data, buf, TRUE);
q += strlen(q) + 1;
}
}
else
{
AddFile(data, path, TRUE);
}
}
}
}
开发者ID:jossk,项目名称:OrangeC,代码行数:28,代码来源:prjfile.c
示例4: Walk
void Walk(boost::filesystem::path p, unsigned short int top, std::string prefix, file_list& files)
{
boost::filesystem::directory_iterator end;
if(!boost::filesystem::exists(p))
{
std::cerr << "Could not open " << p.string() << std::endl;
return;
}
top = AddFile(p, top, prefix, files);
for(boost::filesystem::directory_iterator it(p); it != end; ++it)
{
if(!boost::filesystem::is_directory(it->status()))
AddFile(it->path(), top, prefix, files);
else
{
char* dirname;
dirname = new char[strlen(it->path().string().c_str())+2];
strcpy(dirname, it->path().string().c_str());
Walk(dirname, top, prefix, files);
delete[] dirname;
}
}
}
开发者ID:thekidder,项目名称:taffy,代码行数:25,代码来源:walker.cpp
示例5: msg
void
ProjectWindow::AddNewFile(BString name, bool create_pair)
{
BMessage msg(M_ADD_FILES);
DPath projfile(fProject->GetPath().GetFolder());
projfile << name;
entry_ref ref = gFileFactory.CreateSourceFile(projfile.GetFolder(),
projfile.GetFileName(),
create_pair ? SOURCEFILE_PAIR : 0);
if (!ref.name || strlen(ref.name) == 0)
return;
AddFile(ref);
if (fSourceControl)
fSourceControl->AddToRepository(projfile.GetFullPath());
msg.AddRef("refs",&ref);
if (create_pair && fSourceControl)
{
entry_ref partnerRef = GetPartnerRef(ref);
DPath partnerPath(partnerRef);
fSourceControl->AddToRepository(projfile.GetFullPath());
msg.AddRef("refs",&partnerRef);
if (!gDontManageHeaders)
AddFile(partnerRef);
fSourceControl->AddToRepository(partnerPath.GetFullPath());
}
be_app->PostMessage(&msg);
}
开发者ID:passick,项目名称:Paladin,代码行数:35,代码来源:ProjectWindow.cpp
示例6: dlg
void CPackagePage::OnAddFile()
{
CFileDialog dlg( TRUE, NULL, NULL,
OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING,
_T("All Files|*.*||"), this );
const DWORD nFilesSize = 81920;
LPTSTR szFiles = new TCHAR [ nFilesSize ];
ZeroMemory( szFiles, nFilesSize * sizeof( TCHAR ) );
dlg.m_ofn.lpstrFile = szFiles;
dlg.m_ofn.nMaxFile = nFilesSize;
if ( dlg.DoModal() == IDOK )
{
CWaitCursor wc;
CString strFolder = szFiles;
LPCTSTR pszFile = szFiles + strFolder.GetLength() + 1;
if ( *pszFile )
{
for ( strFolder += '\\' ; *pszFile ; )
{
AddFile( strFolder + pszFile );
pszFile += _tcslen( pszFile ) + 1;
}
}
else
{
AddFile( strFolder );
}
}
delete [] szFiles;
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:34,代码来源:PagePackage.cpp
示例7: internalConfig
int LibMain::Run(int argc, char **argv)
{
Utils::banner(argv[0]);
CmdSwitchFile internalConfig(SwitchParser);
std::string configName = Utils::QualifiedFile(argv[0], ".cfg");
std::fstream configTest(configName.c_str(), std::ios::in);
if (!configTest.fail())
{
configTest.close();
if (!internalConfig.Parse(configName.c_str()))
Utils::fatal("Corrupt configuration file");
}
if (!SwitchParser.Parse(&argc, argv))
{
Utils::usage(argv[0], usageText);
}
if (argc < 2 && File.GetCount() < 3)
{
Utils::usage(argv[0], usageText);
}
// setup
ObjString outputFile = argv[1];
size_t n = outputFile.find_last_of('.');
if (n == std::string::npos || (n != outputFile.size()-1 && outputFile[n+1] != 'l'))
{
outputFile += ".l";
}
LibManager librarian(outputFile, caseSensitiveSwitch.GetValue());
if (librarian.IsOpen())
if (!librarian.LoadLibrary())
{
std::cout << outputFile.c_str() << " is not a library" << std::endl;
return 1;
}
for (int i= 2; i < argc; i++)
AddFile(librarian, argv[i]);
for (int i = 1; i < File.GetCount(); i++)
AddFile(librarian, File.GetValue()[i]);
for (CmdFiles::FileNameIterator it = addFiles.FileNameBegin(); it != addFiles.FileNameEnd(); ++it)
{
librarian.AddFile(*(*it));
}
for (CmdFiles::FileNameIterator it = replaceFiles.FileNameBegin(); it != replaceFiles.FileNameEnd(); ++it)
{
librarian.ReplaceFile(*(*it));
}
if (modified)
if (!librarian.SaveLibrary())
{
std::cout << "Error writing library file" << std::endl;
return 1;
}
return 0;
}
开发者ID:bencz,项目名称:OrangeC,代码行数:56,代码来源:LibMain.cpp
示例8: ASSERT
bool CNotAddedFilesDlg::AddFile(LPCTSTR szFileName, UINT nResourceString)
{
CString strMessage;
if (!strMessage.LoadString(nResourceString))
{
ASSERT(false);
return AddFile(szFileName, _T("???"));
}
else
return AddFile(szFileName, strMessage);
}
开发者ID:quinzio,项目名称:renameit,代码行数:11,代码来源:NotAddedFilesDlg.cpp
示例9: AddFile
void CMainWnd::AddFile2(LPTSTR pszPath, LPTSTR pszFile, LPTSTR pszTitle)
{
if (IsValidStream(pszFile)) {
AddFile(pszFile, pszTitle);
return;
}
TCHAR szFile[MAX_PATH];
wsprintf(szFile, _T("%s\\%s"), pszPath, pszFile);
AddFile(szFile, pszTitle);
}
开发者ID:v-zaburdaev,项目名称:Gsplayer2,代码行数:11,代码来源:MainWndPls.cpp
示例10: Generate
// Generate
//------------------------------------------------------------------------------
bool ToolManifest::Generate( const Node * mainExecutable, const Dependencies & dependencies )
{
m_Files.Clear();
m_TimeStamp = 0;
m_Files.SetCapacity( 1 + dependencies.GetSize() );
// unify "main executable" and "extra files"
// (loads contents of file into memory, and creates hashes)
if ( !AddFile( mainExecutable ) )
{
return false; // AddFile will have emitted error
}
for ( size_t i=0; i<dependencies.GetSize(); ++i )
{
const FileNode & n = *( dependencies[ i ].GetNode()->CastTo< FileNode >() );
if ( !AddFile( &n ) )
{
return false; // AddFile will have emitted error
}
}
// create a hash for the whole tool chain
const size_t numFiles( m_Files.GetSize() );
const size_t memSize( numFiles * sizeof( uint32_t ) * 2 );
uint32_t * mem = (uint32_t *)ALLOC( memSize );
uint32_t * pos = mem;
for ( size_t i=0; i<numFiles; ++i )
{
const File & f = m_Files[ i ];
// file contents
*pos = f.m_Hash;
++pos;
// file name & sub-path (relative to remote folder)
AStackString<> relativePath;
GetRemoteFilePath( (uint32_t)i, relativePath, false ); // false = don't use full path
*pos = xxHash::Calc32( relativePath );
++pos;
}
m_ToolId = xxHash::Calc64( mem, memSize );
FREE( mem );
// update time stamp (most recent file in manifest)
for ( size_t i=0; i<numFiles; ++i )
{
const File & f = m_Files[ i ];
ASSERT( f.m_TimeStamp ); // should have had an error before if the file was missing
m_TimeStamp = Math::Max( m_TimeStamp, f.m_TimeStamp );
}
return true;
}
开发者ID:ClxS,项目名称:fastbuild,代码行数:55,代码来源:ToolManifest.cpp
示例11: sett
void SpringDebugReport::AddVFSFile( const wxString& fn, const wxString& id )
{
wxString dir = sett().GetCurrentUsedDataDir() + wxFileName::GetPathSeparator();
AddFile( dir + fn, id );
return;//TODO: wtf is there a return here?
wxArrayString res = usync().FindFilesVFS( fn );
if ( res.Count() > 0 ) {
AddFile( res[0], id );
wxLogError( _T("SpringDebugReport: file found: "), res[0].c_str() );
}
else
wxLogError( _T("SpringDebugReport: file not found: "), fn.c_str() );
}
开发者ID:johnjianfang,项目名称:springlobby,代码行数:13,代码来源:crashreport.cpp
示例12: CmdStringParse
/*
* Parse the command string contained in the current context.
*/
void CmdStringParse( OPT_STORAGE *cmdOpts, int *itemsParsed )
/***********************************************************/
{
int ch;
char * filename;
for( ;; ) {
/*** Find the start of the next item ***/
CmdScanWhitespace();
ch = GetCharContext();
if( ch == '\0' ) break;
MarkPosContext(); /* mark start of switch */
/*** Handle switches, command files, and input files ***/
if( ch == '-' || ch == '/' ) { /* switch */
if( OPT_PROCESS( cmdOpts ) != 0 ) {
cmd_line_error();
}
} else if( ch == '@' ) { /* command file */
filename = CmdScanFileNameWithoutQuotes();
PushContext();
if( OpenFileContext( filename ) ) {
FatalError( "Cannot open '%s'.", filename );
}
FreeMem( filename );
CmdStringParse( cmdOpts, itemsParsed );
PopContext();
} else if( ch == '"' ) { /* quoted option or file name */
ch = GetCharContext();
if( ch == '-' ) {
Quoted = 1;
if( OPT_PROCESS( cmdOpts ) != 0 ) {
cmd_line_error();
}
} else {
UngetCharContext();
UngetCharContext();
filename = CmdScanFileName();
AddFile( TYPE_DEFAULT_FILE, filename );
FreeMem( filename );
}
} else { /* input file */
UngetCharContext();
filename = CmdScanFileName();
AddFile( TYPE_DEFAULT_FILE, filename );
FreeMem( filename );
}
(*itemsParsed)++;
}
CloseContext();
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:54,代码来源:parse.c
示例13: SetMarkFile
/*** SetMarkFile - Change markfile
*
* Purpose:
*
* Changes to a new markfile.
*
* Input:
* val - String after the 'markfile' switch
*
* Output:
*
* Returns Error string if error, NULL otherwise
*
* Notes:
*
* We:
*
* UNDONE:o Magically ensure that the current markfile is up to date and
* saved to disk. This means, at the very least, that there
* can be no dirty files.
*
* o Remove the current markfile from the file list.
*
* o Read in the new markfile.
*
* o Invalidate all current marks. This is just marking them
* invalid in the PFILE.
*
*
*************************************************************************/
char *
SetMarkFile (
char *val
) {
REGISTER PFILE pFile;
buffer tmpval;
pathbuf pathname;
strcpy ((char *) tmpval, val);
if (NULL == CanonFilename (tmpval, pathname)) {
sprintf (buf, "'%s': name is malformed", tmpval);
return buf;
}
if (!(pFile = FileNameToHandle (pathname, NULL))) {
pFile = AddFile (pathname);
}
if (!TESTFLAG(FLAGS(pFile), REAL) && !FileRead (pathname, pFile, FALSE)) {
RemoveFile (pFile);
sprintf (buf, "'%s' - %s", pathname, error());
return buf;
}
pFileMark = pFile;
for (pFile = pFileHead; pFile; pFile = pFile->pFileNext) {
if (!TESTFLAG(FLAGS(pFile), FAKE)) {
RSETFLAG (FLAGS(pFile), VALMARKS);
}
}
return NULL;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:65,代码来源:mark.c
示例14: AddFileAndParents
unsigned short int AddFileAndParents(boost::filesystem::path p, unsigned short int parent, std::string prefix, file_list& files)
{
if(!boost::filesystem::exists(p))
{
std::cerr << "Could not open " << p.string() << std::endl;
return parent;
}
boost::filesystem::path base;
for(boost::filesystem::path::iterator it = p.begin(); it != p.end(); ++it)
{
if(base.empty())
{
base = *it;
}
else
{
std::string name = base.string() + "/" + it->string();
base = boost::filesystem::path(name);
}
parent = AddFile(base, parent, prefix, files);
}
return parent;
}
开发者ID:thekidder,项目名称:taffy,代码行数:25,代码来源:walker.cpp
示例15:
std::unique_ptr<Project> JsonImporter::ImportProject(FileManager& fileManager, const filesystem::path& projectFile)
{
auto json = internal::ParseJsonFile(fileManager.GetFileSystem(), projectFile);
if (internal::IsValidProject(json))
{
auto project = std::make_unique<Project>();
project->SetName(json["project"]);
project->SetFile(projectFile);
for (auto& config : json["configs"])
{
project->AddConfiguration(internal::ImportConfig(config));
}
for (auto& filePath : json["files"])
{
project->AddFile(fileManager.GetOrCreateFile(filePath));
}
return project;
}
return nullptr;
}
开发者ID:eparayre,项目名称:blueprint,代码行数:26,代码来源:JsonImporter.cpp
示例16: FileSource
FileSourceZip::FileSourceZip(FileSourceFS &fs, const std::string &zipPath) : FileSource(zipPath), m_archive(0)
{
mz_zip_archive *zip = static_cast<mz_zip_archive*>(std::calloc(1, sizeof(mz_zip_archive)));
FILE *file = fs.OpenReadStream(zipPath);
if (!mz_zip_reader_init_file_stream(zip, file, 0)) {
Output("FileSourceZip: unable to open '%s'\n", zipPath.c_str());
std::free(zip);
return;
}
mz_zip_archive_file_stat zipStat;
Uint32 numFiles = mz_zip_reader_get_num_files(zip);
for (Uint32 i = 0; i < numFiles; i++) {
if (mz_zip_reader_file_stat(zip, i, &zipStat)) {
bool is_dir = mz_zip_reader_is_file_a_directory(zip, i);
if (!mz_zip_reader_is_file_encrypted(zip, i)) {
std::string fname = zipStat.m_filename;
if ((fname.size() > 1) && (fname[fname.size()-1] == '/')) {
fname.resize(fname.size() - 1);
}
AddFile(zipStat.m_filename, FileStat(i, zipStat.m_uncomp_size,
MakeFileInfo(fname, is_dir ? FileInfo::FT_DIR : FileInfo::FT_FILE)));
}
}
}
m_archive = static_cast<void*>(zip);
}
开发者ID:Ikesters,项目名称:pioneer,代码行数:29,代码来源:FileSourceZip.cpp
示例17: CreateTrd
//=============================================================================
// eFdd::ReadScl
//-----------------------------------------------------------------------------
bool eFdd::ReadScl(const void* data, size_t data_size)
{
if(data_size < 9)
return false;
const byte* buf = (const byte*)data;
if(memcmp(data, "SINCLAIR", 8) || int(data_size) < 9 + (0x100 + 14)*buf[8])
return false;
CreateTrd();
int size = 0;
for(int i = 0; i < buf[8]; ++i)
{
size += buf[9 + 14 * i + 13];
}
if(size > 2544)
{
eUdi::eTrack::eSector* s = GetSector(0, 0, 9);
SectorDataW(s, 0xe5, size); // free sec
UpdateCRC(s);
}
const byte* d = buf + 9 + 14 * buf[8];
for(int i = 0; i < buf[8]; ++i)
{
if(!AddFile(buf + 9 + 14*i, d))
return false;
d += buf[9 + 14*i + 13]*0x100;
}
return true;
}
开发者ID:open-develop,项目名称:unrealspeccyp,代码行数:32,代码来源:fdd.cpp
示例18: DeleteAll
void FWadCollection::InitMultipleFiles (TArray<FString> &filenames)
{
int numfiles;
// open all the files, load headers, and count lumps
DeleteAll();
numfiles = 0;
for(unsigned i=0;i<filenames.Size(); i++)
{
int baselump = NumLumps;
AddFile (filenames[i]);
}
NumLumps = LumpInfo.Size();
if (NumLumps == 0)
{
I_FatalError ("W_InitMultipleFiles: no files found");
}
RenameNerve();
RenameSprites();
FixMacHexen();
// [RH] Set up hash table
FirstLumpIndex = new uint32_t[NumLumps];
NextLumpIndex = new uint32_t[NumLumps];
FirstLumpIndex_FullName = new uint32_t[NumLumps];
NextLumpIndex_FullName = new uint32_t[NumLumps];
InitHashChains ();
LumpInfo.ShrinkToFit();
Files.ShrinkToFit();
}
开发者ID:emileb,项目名称:gzdoom,代码行数:32,代码来源:w_wad.cpp
示例19: while
LRESULT UploadQueueFrame::onItemChanged(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& /*bHandled*/) {
HTREEITEM userNode = ctrlQueued.GetSelectedItem();
while(userNode) {
ctrlList.DeleteAllItems();
UserItem* ui = reinterpret_cast<UserItem *>(ctrlQueued.GetItemData(userNode));
if(ui) {
auto users = UploadManager::getInstance()->getUploadQueue();
auto it = find_if(users.begin(), users.end(), [&](const UserPtr& u) { return u == ui->u; });
if(it != users.end()) {
ctrlList.SetRedraw(FALSE);
ctrlQueued.SetRedraw(FALSE);
for(auto i = it->files.cbegin(); i != it->files.cend(); ++i) {
AddFile(*i);
}
ctrlList.resort();
ctrlList.SetRedraw(TRUE);
ctrlQueued.SetRedraw(TRUE);
ctrlQueued.Invalidate();
updateStatus();
return 0;
}
} else {
LoadAll();
}
userNode = ctrlQueued.GetNextSiblingItem(userNode);
}
return 0;
}
开发者ID:Dimetro83,项目名称:DC_DDD,代码行数:29,代码来源:UploadQueueFrame.cpp
示例20: ParseDirectory
//--------------------------------------------------------------------------------
bool CFileIndexSubSystem::ParseDirectory(CString sPath, CWriteLock& lock)
{
WIN32_FIND_DATA data;
CFindFileHandle hand = ::FindFirstFile(sPath + "\\*.*", &data);
if(! hand.IsValid())
return false;
CFileIndexDirObject* pDir;
CFileIndexFileObject* pFile;
for(;;)
{
if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if(data.cFileName[0] != '.')
ParseDirectory(sPath + '\\' + data.cFileName, lock);
}
else
AddFile(sPath, data.cFileName, pDir, pFile, lock);
if(! ::FindNextFile(hand, &data))
break;
}
return true;
}
开发者ID:moosethemooche,项目名称:Certificate-Server,代码行数:28,代码来源:FileIndexSubSystem.cpp
注:本文中的AddFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论