本文整理汇总了C++中CPath函数的典型用法代码示例。如果您正苦于以下问题:C++ CPath函数的具体用法?C++ CPath怎么用?C++ CPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CECID
CKnownFile::CKnownFile(CEC_SharedFile_Tag *tag) : CECID(tag->ID())
{
Init();
SetFileName(CPath(tag->FileName()));
m_abyFileHash = tag->FileHash();
SetFileSize(tag->SizeFull());
m_AvailPartFrequency.insert(m_AvailPartFrequency.end(), m_iPartCount, 0);
m_iUpPriorityEC = tag->Prio();
m_AICHMasterHash = tag->GetAICHHash();
m_filePath = CPath(tag->FilePath());
}
开发者ID:dreamerc,项目名称:amule,代码行数:12,代码来源:KnownFile.cpp
示例2: CPath
CPath CPath::JoinPaths(const CPath& other) const
{
if (!IsOk()) {
return CPath(other);
} else if (!other.IsOk()) {
return CPath(*this);
}
CPath joinedPath;
// DeepCopy shouldn't be needed, as JoinPaths results in the creation of a new string.
joinedPath.m_printable = ::JoinPaths(m_printable, other.m_printable);
joinedPath.m_filesystem = ::JoinPaths(m_filesystem, other.m_filesystem);
return joinedPath;
}
开发者ID:dreamerc,项目名称:amule,代码行数:15,代码来源:Path.cpp
示例3: CPath
engine_t CMediaFormats::GetEngine(CString path) const
{
path.Trim().MakeLower();
if (!m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) {
return m_iRtspHandler;
}
CString ext = CPath(path).GetExtension();
ext.MakeLower();
if (!ext.IsEmpty()) {
if (path.Find(_T("rtsp://")) == 0) {
if (ext == _T(".ram") || ext == _T(".rm") || ext == _T(".ra")) {
return RealMedia;
}
if (ext == _T(".qt") || ext == _T(".mov")) {
return QuickTime;
}
}
for (size_t i = 0; i < GetCount(); i++) {
const CMediaFormatCategory& mfc = GetAt(i);
if (mfc.FindExt(ext)) {
return mfc.GetEngineType();
}
}
}
if (m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0) {
return m_iRtspHandler;
}
return DirectShow;
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:34,代码来源:MediaFormats.cpp
示例4: dlg
void CPPageExternalFilters::OnAddRegistered()
{
CRegFilterChooserDlg dlg(this);
if (dlg.DoModal() == IDOK) {
while (!dlg.m_filters.IsEmpty()) {
if (FilterOverride* f = dlg.m_filters.RemoveHead()) {
CAutoPtr<FilterOverride> p(f);
CString name = f->name;
if (f->type == FilterOverride::EXTERNAL) {
if (!CPath(MakeFullPath(f->path)).FileExists()) {
name += _T(" <not found!>");
}
}
int i = m_filters.AddString(name);
m_filters.SetItemDataPtr(i, m_pFilters.AddTail(p));
m_filters.SetCheck(i, 1);
if (dlg.m_filters.IsEmpty()) {
m_filters.SetCurSel(i);
OnLbnSelchangeList1();
}
SetModified();
}
}
}
}
开发者ID:avdbg,项目名称:MPC-BE,代码行数:30,代码来源:PPageExternalFilters.cpp
示例5: CPath
void QtSE::addFolder( void )
{
QString activeFilePath = activeProjectItem->getFullPath( CPath( QDir::currentPath() ).getPath( true ) );
QDir dir( activeFilePath );
if( dir.exists() )
{
bool ok = false;
QString name = QInputDialog::getText( this , this->windowTitle() , "Directory Name:" , QLineEdit::Normal , "" , &ok );
if( ok )
{
if( UTIL_validateFileName( name , false ) )
{
if( dir.mkdir( name ) )
{
CProjectTreeItem *item = new CProjectTreeItem( CProjectTreeItem::dir , activeProjectItem , QStringList( name ) );
activeProjectItem->setExpanded( true );
}
else
QMessageBox::warning( this , this->windowTitle() , "Unable to add directory." );
}
else
QMessageBox::warning( this , this->windowTitle() , "Invalid directory name." );
}
}
else
QMessageBox::warning( this , this->windowTitle() , "Base path does not exist." );
}
开发者ID:zekin,项目名称:QtShaderEditor,代码行数:29,代码来源:QtSE.cpp
示例6: SettingsDir
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
{
stdstr SettingsFile, OrigSettingsFile;
for (int i = 0; i < 100; i++)
{
OrigSettingsFile = SettingsFile;
if (!g_Settings->LoadStringVal(SupportFile_Settings,SettingsFile) && i > 0)
{
break;
}
if (SettingsFile == OrigSettingsFile)
{
break;
}
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
}
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
if (!SettingsDir.DirectoryExists())
{
SettingsDir.DirectoryCreate();
}
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
}
m_SettingsIniFile->SetAutoFlush(false);
m_UseRegistry = g_Settings->LoadBool(Setting_UseFromRegistry);
}
开发者ID:aschwant,项目名称:project64,代码行数:31,代码来源:SettingsType-Application.cpp
示例7: CPath
void CFriendList::LoadList()
{
CPath metfile = CPath(theApp->ConfigDir + wxT("emfriends.met"));
if (!metfile.FileExists()) {
return;
}
CFile file;
try {
if ( file.Open(metfile) ) {
if ( file.ReadUInt8() /*header*/ == MET_HEADER ) {
uint32 nRecordsNumber = file.ReadUInt32();
for (uint32 i = 0; i < nRecordsNumber; i++) {
CFriend* Record = new CFriend();
Record->LoadFromFile(&file);
m_FriendList.push_back(Record);
Notify_ChatUpdateFriend(Record);
}
}
} else {
AddLogLineN(_("Failed to open friend list file 'emfriends.met' for reading!"));
}
} catch (const CInvalidPacket& e) {
AddDebugLogLineC(logGeneral, wxT("Invalid entry in friend list, file may be corrupt: ") + e.what());
} catch (const CSafeIOException& e) {
AddDebugLogLineC(logGeneral, wxT("IO error while reading 'emfriends.met': ") + e.what());
}
}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:30,代码来源:FriendList.cpp
示例8: wxImageList
void CDirectoryTreeCtrl::Init()
{
// already done ?
if (m_IsInit) {
return;
}
m_IsInit = true;
// init image(s)
wxImageList* images = new wxImageList(16, 16);
images->Add(wxBitmap(amuleSpecial(1)));
images->Add(wxBitmap(amuleSpecial(2)));
// Gives wxTreeCtrl ownership of the list
AssignImageList(images);
// Create an empty root item, which we can
// safely append when creating a full path.
m_root = AddRoot(wxEmptyString, IMAGE_FOLDER, -1,
new CItemData(CPath()));
if (!m_IsRemote) {
#ifndef __WXMSW__
AddChildItem(m_root, CPath(wxT("/")));
#else
// this might take awhile, so change the cursor
::wxSetCursor(*wxHOURGLASS_CURSOR);
// retrieve bitmask of all drives available
uint32 drives = GetLogicalDrives();
drives >>= 1;
for (char drive = 'C'; drive <= 'Z'; drive++) {
drives >>= 1;
if (! (drives & 1)) { // skip non existant drives
continue;
}
wxString driveStr = CFormat(wxT("%c:")) % drive;
uint32 type = GetDriveType(driveStr + wxT("\\"));
// skip removable/undefined drives, share only fixed or remote drives
if ((type == 3 || type == 4) // fixed drive / remote drive
&& CPath::DirExists(driveStr)) {
AddChildItem(m_root, CPath(driveStr));
}
}
::wxSetCursor(*wxSTANDARD_CURSOR);
#endif
}
开发者ID:geekt,项目名称:amule,代码行数:47,代码来源:DirectoryTreeCtrl.cpp
示例9: CombinePath
static CString CombinePath(CPath p, CString fn)
{
if (fn.Find(':') >= 0 || fn.Find(_T("\\")) == 0) {
return fn;
}
p.Append(CPath(fn));
return (LPCTSTR)p;
}
开发者ID:Azpidatziak,项目名称:mpc-hc,代码行数:8,代码来源:PlayerPlaylistBar.cpp
示例10: Name
bool CEC_Category_Tag::Apply()
{
bool ret = theApp->glob_prefs->UpdateCategory(GetInt(), Name(), CPath(Path()), Comment(), Color(), Prio());
if (!ret) {
GetTagByName(EC_TAG_CATEGORY_PATH)->SetStringData(theApp->glob_prefs->GetCatPath(GetInt()).GetRaw());
}
return ret;
}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:8,代码来源:ECSpecialMuleTags.cpp
示例11: while
CPath CPath::add(CEdge* edge)
{
size_t departure = edge->e_departure;
while(departure < p_arrival_time)
departure += edge->e_interval;
departure += edge->e_duration;
return CPath(departure);
}
开发者ID:oshch,项目名称:graph,代码行数:8,代码来源:bus.hpp
示例12: WriteTrace
void CSettingTypeApplication::Initialize(const char * /*AppName*/)
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(), "");
if (!BaseDir.DirectoryExists())
{
WriteTrace(TraceAppInit, TraceDebug, "BaseDir does not exist. Doing nothing.");
WriteTrace(TraceAppInit, TraceDebug, "Done");
return;
}
stdstr SettingsFile, OrigSettingsFile;
for (int i = 0; i < 100; i++)
{
OrigSettingsFile = SettingsFile;
if (!g_Settings->LoadStringVal(SupportFile_Settings, SettingsFile) && i > 0)
{
break;
}
if (SettingsFile == OrigSettingsFile)
{
break;
}
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
}
#ifdef _WIN32
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(), "");
#else
CPath SettingsDir(CPath(SettingsFile).GetDirectory(), "");
#endif
if (!SettingsDir.DirectoryExists())
{
SettingsDir.DirectoryCreate();
}
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
}
m_SettingsIniFile->SetAutoFlush(false);
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
开发者ID:JunielKatarn,项目名称:Project64CI,代码行数:44,代码来源:SettingsType-Application.cpp
示例13: assert
void CLogic::handle_new( CServer &server, CCommandSource source )
{
/* add connections in host if needed */
for( const INode *ancestor = &m_node; ancestor; ancestor = ancestor->get_parent() )
{
const node_map &siblings = server.get_siblings( *ancestor );
for( node_map::const_iterator i = siblings.begin(); i != siblings.end(); i++ )
{
const INode *sibling = i->second;
if( sibling != ancestor && CGuidHelper::guids_are_equal(sibling->get_interface_definition().get_module_guid(), get_connection_interface_guid( server ) ) )
{
/* found a connection which might target the new node */
const INodeEndpoint *source_path = sibling->get_node_endpoint( endpoint_source_path );
const INodeEndpoint *target_path = sibling->get_node_endpoint( endpoint_target_path );
assert( source_path && target_path );
const INodeEndpoint *source_endpoint = server.find_node_endpoint( CPath( *source_path->get_value() ), ancestor->get_parent() );
const INodeEndpoint *target_endpoint = server.find_node_endpoint( CPath( *target_path->get_value() ), ancestor->get_parent() );
if( source_endpoint && target_endpoint )
{
internal_id source_node_id = CNode::downcast( &source_endpoint->get_node() )->get_id();
internal_id target_node_id = CNode::downcast( &target_endpoint->get_node() )->get_id();
if( m_node.get_id() == source_node_id || m_node.get_id() == target_node_id )
{
if( source_endpoint->get_endpoint_definition().is_audio_stream() && source_endpoint->get_endpoint_definition().get_stream_info()->get_direction() == CStreamInfo::OUTPUT )
{
if( target_endpoint->get_endpoint_definition().is_audio_stream() && target_endpoint->get_endpoint_definition().get_stream_info()->get_direction() == CStreamInfo::INPUT )
{
/* create connection in host */
connect_audio_in_host( server, *source_endpoint, *target_endpoint, true );
}
}
}
}
}
}
}
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:43,代码来源:logic.cpp
示例14: GetCurrentProcessId
bool pjutil::TerminatedExistingExe()
{
bool bTerminated = false;
bool AskedUser = false;
DWORD pid = GetCurrentProcessId();
HANDLE nSearch = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (nSearch != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 lppe;
memset(&lppe, 0, sizeof(PROCESSENTRY32));
lppe.dwSize = sizeof(PROCESSENTRY32);
stdstr ModuleName = CPath(CPath::MODULE_FILE).GetNameExtension();
if (Process32First(nSearch, &lppe))
{
do
{
if (_stricmp(lppe.szExeFile, ModuleName.c_str()) != 0 ||
lppe.th32ProcessID == pid)
{
continue;
}
if (!AskedUser)
{
AskedUser = true;
int res = MessageBox(NULL, stdstr_f("%s currently running\n\nTerminate pid %d now?", ModuleName.c_str(), lppe.th32ProcessID).c_str(), stdstr_f("Terminate %s",ModuleName.c_str()).c_str(), MB_YESNO | MB_ICONEXCLAMATION);
if (res != IDYES)
{
break;
}
}
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, lppe.th32ProcessID);
if (hHandle != NULL)
{
if (TerminateProcess(hHandle, 0))
{
bTerminated = true;
}
else
{
MessageBox(NULL, stdstr_f("Failed to terminate pid %d", lppe.th32ProcessID).c_str(), stdstr_f("Terminate %s failed!",ModuleName.c_str()).c_str(), MB_YESNO | MB_ICONEXCLAMATION);
}
CloseHandle(hHandle);
}
} while (Process32Next(nSearch, &lppe));
}
CloseHandle(nSearch);
}
return bTerminated;
}
开发者ID:Watilin,项目名称:project64,代码行数:52,代码来源:Util.cpp
示例15: MempakPath
void CMempak::LoadMempak(int32_t Control, bool Create)
{
stdstr MempakName;
MempakName.Format("%s_Cont_%d", g_Settings->LoadStringVal(Game_GameName).c_str(), Control + 1);
CPath MempakPath(g_Settings->LoadStringVal(Directory_NativeSave).c_str(), stdstr_f("%s.mpk", MempakName.c_str()).c_str());
if (g_Settings->LoadBool(Setting_UniqueSaveDir))
{
MempakPath.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
}
#ifdef _WIN32
MempakPath.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
#endif
if (!Create && !MempakPath.Exists())
{
if (!m_Formatted[Control])
{
CMempak::Format(Control);
m_Formatted[Control] = true;
}
m_SaveExists[Control] = false;
return;
}
if (!MempakPath.DirectoryExists())
{
MempakPath.DirectoryCreate();
}
bool formatMempak = !MempakPath.Exists();
m_MempakHandle[Control].Open(MempakPath, CFileBase::modeReadWrite | CFileBase::modeNoTruncate | CFileBase::modeCreate);
m_MempakHandle[Control].SeekToBegin();
if (formatMempak)
{
if (!m_Formatted[Control])
{
CMempak::Format(Control);
m_Formatted[Control] = true;
}
m_MempakHandle[Control].Write(m_Mempaks[Control], 0x8000);
}
else
{
m_MempakHandle[Control].Read(m_Mempaks[Control], 0x8000);
m_Formatted[Control] = true;
}
}
开发者ID:Azimer,项目名称:project64,代码行数:50,代码来源:Mempak.cpp
示例16: ExplodeEsc
void CFavoriteOrganizeDlg::OnLvnGetInfoTipList(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVGETINFOTIP pGetInfoTip = reinterpret_cast<LPNMLVGETINFOTIP>(pNMHDR);
CAtlList<CString> args;
ExplodeEsc(m_sl[m_tab.GetCurSel()].GetAt((POSITION)m_list.GetItemData(pGetInfoTip->iItem)), args, _T(';'));
CString path = args.RemoveTail();
// Relative to drive value is always third. If less args are available that means it is not included.
int rootLength = (args.GetCount() == 3 && args.RemoveTail() != _T("0")) ? CPath(path).SkipRoot() : 0;
StringCchCopy(pGetInfoTip->pszText, pGetInfoTip->cchTextMax, path.Mid(rootLength));
*pResult = 0;
}
开发者ID:JanChou,项目名称:mpc-hc,代码行数:14,代码来源:FavoriteOrganizeDlg.cpp
示例17: m_pMainFrame
CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort)
: m_pMainFrame(pMainFrame)
, m_nPort(nPort)
{
m_webroot = CPath(GetProgramPath());
const CAppSettings& s = AfxGetAppSettings();
CString WebRoot = s.strWebRoot;
WebRoot.Replace('/', '\\');
WebRoot.Trim();
CPath p(WebRoot);
if (WebRoot.Find(_T(":\\")) < 0 && WebRoot.Find(_T("\\\\")) < 0) {
m_webroot.Append(WebRoot);
} else {
m_webroot = p;
}
m_webroot.Canonicalize();
m_webroot.MakePretty();
if (!m_webroot.IsDirectory()) {
m_webroot = CPath();
}
CAtlList<CString> sl;
Explode(s.strWebServerCGI, sl, ';');
POSITION pos = sl.GetHeadPosition();
while (pos) {
CAtlList<CString> sl2;
CString ext = Explode(sl.GetNext(pos), sl2, '=', 2);
if (sl2.GetCount() < 2) {
continue;
}
m_cgi[ext] = sl2.GetTail();
}
m_ThreadId = 0;
m_hThread = ::CreateThread(nullptr, 0, StaticThreadProc, (LPVOID)this, 0, &m_ThreadId);
}
开发者ID:Armada651,项目名称:mpc-hc,代码行数:37,代码来源:WebServer.cpp
示例18: WXUNUSED
void CFileDetailDialog::OnBnClickedApply(wxCommandEvent& WXUNUSED(evt))
{
CPath fileName = CPath(CastChild(IDC_FILENAME, wxTextCtrl)->GetValue());
if (fileName.IsOk() && (fileName != m_file->GetFileName())) {
if (theApp->sharedfiles->RenameFile(m_file, fileName)) {
FindWindow(IDC_FNAME)->SetLabel(MakeStringEscaped(m_file->GetFileName().GetPrintable()));
FindWindow(IDC_METFILE)->SetLabel(m_file->GetFullName().GetPrintable());
resetValueForFilenameTextEdit();
Layout();
}
}
}
开发者ID:dreamerc,项目名称:amule,代码行数:15,代码来源:FileDetailDialog.cpp
示例19: CPath
bool CKnownFileList::Init()
{
CFile file;
CPath fullpath = CPath(theApp->ConfigDir + m_filename);
if (!fullpath.FileExists()) {
// This is perfectly normal. The file was probably either
// deleted, or this is the first time running aMule.
return false;
}
if (!file.Open(fullpath)) {
AddLogLineC(CFormat(_("WARNING: %s cannot be opened.")) % m_filename);
return false;
}
try {
uint8 version = file.ReadUInt8();
if ((version != MET_HEADER) && (version != MET_HEADER_WITH_LARGEFILES)) {
AddLogLineC(_("WARNING: Known file list corrupted, contains invalid header."));
return false;
}
wxMutexLocker sLock(list_mut);
uint32 RecordsNumber = file.ReadUInt32();
AddDebugLogLineN(logKnownFiles, CFormat(wxT("Reading %i known files from file format 0x%2.2x."))
% RecordsNumber % version);
for (uint32 i = 0; i < RecordsNumber; i++) {
CScopedPtr<CKnownFile> record;
if (record->LoadFromFile(&file)) {
AddDebugLogLineN(logKnownFiles,
CFormat(wxT("Known file read: %s")) % record->GetFileName());
Append(record.release());
} else {
AddLogLineC(_("Failed to load entry in known file list, file may be corrupt"));
}
}
AddDebugLogLineN(logKnownFiles, wxT("Finished reading known files"));
return true;
} catch (const CInvalidPacket& e) {
AddLogLineC(_("Invalid entry in known file list, file may be corrupt: ") + e.what());
} catch (const CSafeIOException& e) {
AddLogLineC(CFormat(_("IO error while reading %s file: %s")) % m_filename % e.what());
}
return false;
}
开发者ID:tmphuang6,项目名称:amule,代码行数:48,代码来源:KnownFileList.cpp
示例20: WXUNUSED
void CSharedFilesCtrl::OnRename( wxCommandEvent& WXUNUSED(event) )
{
int item = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
if ( item != -1 ) {
CKnownFile* file = (CKnownFile*)GetItemData(item);
wxString strNewName = ::wxGetTextFromUser(
_("Enter new name for this file:"),
_("File rename"), file->GetFileName().GetPrintable());
CPath newName = CPath(strNewName);
if (newName.IsOk() && (newName != file->GetFileName())) {
theApp->sharedfiles->RenameFile(file, newName);
}
}
}
开发者ID:donkey4u,项目名称:donkeyseed,代码行数:16,代码来源:SharedFilesCtrl.cpp
注:本文中的CPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论