當前位置: 首頁>>代碼示例>>C++>>正文


C++ AddFile函數代碼示例

本文整理匯總了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;
}
開發者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


注:本文中的AddFile函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。