本文整理匯總了C++中AddFile函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddFile函數的具體用法?C++ AddFile怎麽用?C++ AddFile使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddFile函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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() );
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}