这篇教程C++ strPath函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中strPath函数的典型用法代码示例。如果您正苦于以下问题:C++ strPath函数的具体用法?C++ strPath怎么用?C++ strPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了strPath函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: strPathsize_t AXmlElement::find(const AString& path, AXmlElement::CONST_CONTAINER& result) const{ AString strAttribute; AString strPath(path); bool leadingSlash = false; if ('/' == strPath.at(0)) { leadingSlash = true; //a_Signals that slash leads the path so much include current name } //a_Remove the leading name (which should be this element's name) LIST_AString listPath; strPath.split(listPath, '/'); if (leadingSlash) { if (0 == listPath.size()) { //a_ "/" selects current node result.push_back(this); return 1; } else if (0 != listPath.front().compare(m_Name)) { //a_First token MUST be the name of this element if / leads AString str("Absolute path must start with the name of the current root element: root=/"); str.append(m_Name); str.append(" while path="); str.append(path); ATHROW_EX(this, AException::ProgrammingError, str); } } else if (0 == listPath.size()) { //a_ "/" selects current node result.push_back(this); return 1; } else { //a_Relative path implies this node is first listPath.push_front(m_Name); } return _const_find(listPath, result);}
开发者ID:achacha,项目名称:AOS,代码行数:46,
示例2: strPathBOOL KFunction::DeleteFolder(LPCTSTR szPath){ BOOL bReturn = FALSE; BOOL bRetCode = FALSE; CString strPath(szPath); KFunction::PathAddBackslash(strPath); bRetCode = _DeleteFolder(strPath); if (!bRetCode) goto Exit0; bReturn = TRUE;Exit0: log_w(L"KFunction::DeleteFolder return:%d, path:%s/n", bReturn, strPath); return bReturn;}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:18,
示例3: ASSERT/* * Get directory part of a filename. */CTFileName CTFileName::FileDir() const{ ASSERT(IsValid()); // make a temporary copy of string CTFileName strPath(*this); // find last backlash in it char *pPathBackSlash = strrchr( strPath.str_String, '//'); // if there is no backslash if( pPathBackSlash == NULL) { // return emptystring as directory return( CTFileName("")); } // set end of string after where the backslash was pPathBackSlash[1] = 0; // return a copy of temporary string return( CTFileName( strPath));}
开发者ID:rdrago,项目名称:LCSource,代码行数:21,
示例4: operatorvoid operator()( const char* name ) const { if ( !extension_equal( path_get_extension( name ), "game" ) ) { return; } StringOutputStream strPath( 256 ); strPath << mPath << name; globalOutputStream() << strPath.c_str() << '/n'; xmlDocPtr pDoc = xmlParseFile( strPath.c_str() ); if ( pDoc ) { mGames.push_front( new CGameDescription( pDoc, name ) ); xmlFreeDoc( pDoc ); } else { globalErrorStream() << "XML parser failed on '" << strPath.c_str() << "'/n"; }}
开发者ID:Triang3l,项目名称:netradiant,代码行数:18,
示例5: strPathint CDevCmn::fnLDCtrl_Initialize(){ int nReturn = FALSE; int nRegFlag = FALSE; CString strPath(""); CString strYYMMDD(""); char szTemp[1024];MsgDump(TRACE_CODE_MODE, "Log", __FILE__, __LINE__, "fnLDCtrl_Initialize()"); if (fnAPL_GetDefineDevice(DEV_RDCTRL)) { nReturn = fnDll_ConnectRpcLock(); if(nReturn == TRUE) { Delay_Msg(100); if(fnLDCtrl_GetDeviceStatus() != NORMAL) nReturn = FALSE; else { Delay_Msg(200); fnLDCtrl_SetTimeWatchdogRpc(0); // Regstry Setting Delay_Msg(200); fnLDCtrl_Ch1TimeResetRpc(0); // Regstry Setting Delay_Msg(200); fnLDCtrl_Ch2TimeResetRpc(0); // Regstry Setting Delay_Msg(200); fnLDCtrl_EnableWatchdogRpc(0); if(!m_pDevCmn->fnLDCtrl_GetKeyCount()) { fnLDCtrl_SetKeytableFile(0, "51515150"); fnLDCtrl_GetErrorCode(szTemp); MsgDump(TRACE_CODE_MODE, "Log", __FILE__, __LINE__, "fnLDCtrl_Initialize():[%s]", szTemp); } } } } MsgDump(TRACE_CODE_MODE, "Log", __FILE__, __LINE__, "fnLDCtrl_Initialize():return(%d)", nReturn); return nReturn;}
开发者ID:u9330028,项目名称:GIT_SW_PJ,代码行数:44,
示例6: GetDatavoid GetData(QList<ItemObject* > &data){ QString strPath(":/MyImages/folder.png"); for(int i=0;i<5;i++) { ItemObject* item=new ItemObject(); item->setName("name"+QString::number(i)); item->setDesc("desc"+QString::number(i)); item->setMyIcon(strPath); for(int j=0;j<i+1;j++) { ItemObject* child=new ItemObject(item); child->setName("child "+QString::number(j)); child->setMyIcon(strPath); item->appendChild(child); } data.append(item); }}
开发者ID:lpxxn,项目名称:MyQtMVDemo,代码行数:19,
示例7: testPathAppendbool testPathAppend(TCHAR *path, TCHAR *append){ TCHAR cPath[MAX_PATH]; generic_string strPath(path); generic_string strAppend(append); _tcscpy_s(cPath, MAX_PATH, path); BOOL strRet = PathAppend(strPath, strAppend); BOOL charRet = PathAppend(cPath, append); if (strRet != charRet || strPath != cPath) { _tprintf(_T("Testing |%s| append |%s| String (ours) |%s| returned %d Char (system) |%s| returned %d/r/n"), path, append, strPath.c_str(), strRet, cPath, charRet); } return ((strRet == charRet) && (strPath == cPath));}
开发者ID:bruderstein,项目名称:npp-community,代码行数:19,
示例8: sizeof bool VDirAdapter::isDots() const { if (m_hFindFile == INVALID_HANDLE_VALUE) return false; if (!m_bExtractName) {#ifdef UNICODE char szPath[512] = {0}; ::WideCharToMultiByte(CP_UTF8, 0, m_FindFileData.cFileName, MAX_PATH, szPath, sizeof(szPath), nullptr, nullptr); VString strPath(szPath);#else VString strPath = m_FindFileData.cFileName;#endif extractFileName(strPath, m_strName, m_strTitle); } return ((m_FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (m_strName == "." || m_strName == "..")); }
开发者ID:asnwerear,项目名称:Demo,代码行数:19,
示例9: BEHAVIAC_ASSERTCPathID::CPathID(const char* path, bool doNotFromat){ BEHAVIAC_ASSERT(path); if (doNotFromat) { behaviac::string strPath(path); strPath = make_lower(strPath); SetContentPrivate(strPath.c_str());#ifdef BEHAVIAC_ENABLE_ASSERTS CPathID pathId(path); BEHAVIAC_ASSERT(GetUniqueID() == pathId.GetUniqueID());#endif // #ifdef BEHAVIAC_ENABLE_ASSERTS } else { SetContent(path); }}
开发者ID:CodeBees,项目名称:behaviac,代码行数:19,
示例10: GetCurrentDirectoryBOOL CRunMacroDlg::OnInitDialog() { CDialog::OnInitDialog(); // Clear any existing data m_CMacroList.ResetContent(); // Find all files in the current directory with the // macro file extension, ".mac". TCHAR szCurrentDir[_MAX_PATH+1]; GetCurrentDirectory(_MAX_PATH,szCurrentDir); CString strPath(szCurrentDir); if ( strPath[strPath.GetLength()-1] != '//' ) { // The directory doesn't end with a backslash, // so we add one now. strPath += '//'; } // if CString strFile = strPath + "*.mac"; WIN32_FIND_DATA wfd; HANDLE hSearchHandle = FindFirstFile(strFile,&wfd); if ( hSearchHandle != INVALID_HANDLE_VALUE ) { // Pull first filename CString strFileTitle(wfd.cFileName); strFileTitle = strFileTitle.Left(strFileTitle.Find(".")); int iItem = m_CMacroList.AddString(strFileTitle); while ( FindNextFile(hSearchHandle,&wfd) ) { // While we have more files... strFileTitle = wfd.cFileName; strFileTitle = strFileTitle.Left(strFileTitle.Find(".")); m_CMacroList.AddString(strFileTitle); } // while // Close our search handle FindClose(hSearchHandle); } // if // Make sure no macro files are selected... m_CMacroList.SetCurSel(-1); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE}
开发者ID:sergedeh,项目名称:andycad,代码行数:43,
示例11: GetParentDirstd::string GetParentDir(const char *szPath){ std::string strPath(szPath); EnsureNotTerminated(strPath); size_t nPos = strPath.find_last_of(PATH_DELIMITERS); if(nPos > 0) strPath = strPath.substr(0, nPos); else strPath = "";#ifdef _WIN32 EnsureTerminated(strPath, '//');#else EnsureTerminated(strPath, '/');#endif return strPath;}
开发者ID:ellysh,项目名称:notecase,代码行数:19,
示例12: strPathHTREEITEM CTreePropSheet::CreatePageTreeItem(LPCTSTR lpszPath, HTREEITEM hParent /* = TVI_ROOT */){ CString strPath(lpszPath); CString strTopMostItem(SplitPageTreePath(strPath)); // Check if an item with the given text does already exist HTREEITEM hItem = NULL; HTREEITEM hChild = m_pwndPageTree->GetChildItem(hParent); while (hChild) { if (m_pwndPageTree->GetItemText(hChild) == strTopMostItem) { hItem = hChild; break; } hChild = m_pwndPageTree->GetNextItem(hChild, TVGN_NEXT); } // If item with that text does not already exist, create a new one // MORPH START tabbed options [leuk_he] if (strTopMostItem != "Multi user" && strTopMostItem != "NT Service" ) { // MORPH leuk_he:run as ntservice v1.. // MORPH END tabbed options [leuk_he] if (!hItem) { hItem = m_pwndPageTree->InsertItem(strTopMostItem, hParent); m_pwndPageTree->SetItemData(hItem, (DWORD_PTR)-1); if (!strPath.IsEmpty() && m_bTreeImages && m_DefaultImages.GetSafeHandle()) // set folder image m_pwndPageTree->SetItemImage(hItem, m_Images.GetImageCount()-2, m_Images.GetImageCount()-2); } if (!hItem) { // ASSERT(FALSE); //MORPH tabbed options return NULL; } } // Morph tabbed options. if (strPath.IsEmpty()) return hItem; else return CreatePageTreeItem(strPath, hItem);}
开发者ID:e1z0,项目名称:sMule,代码行数:42,
示例13: GetCustomDataWint WINAPI GetCustomDataW(const wchar_t *FilePath, wchar_t **CustomData){ *CustomData = NULL; const wchar_t* pszSlash = wcsrchr(FilePath, L'//'); if (!pszSlash || pszSlash <= FilePath) return FALSE; if (pszSlash[1] == 0) return FALSE; // Если хотят диз именно для папки - то нужно без слеша string strPath(FilePath, pszSlash-FilePath); // оптимизацией чтения диз-файла занимается сам diz if (diz.Read(strPath) == 0) { // Если диз пустой - сразу выходим return FALSE; } const wchar_t* pszDiz = diz.GetDizTextAddr(pszSlash+1, L"", 0/*???*/); //if (!pszDiz || pszDiz[0] == 0) -- ConvertNameToShort занимает очень много времени //{ // string strShort; // ConvertNameToShort(FilePath, strShort); // pszDiz = diz.GetDizTextAddr(pszSlash+1, strShort, 0/*???*/); //} if (!pszDiz || pszDiz[0] == 0) { return FALSE; } size_t nLen = wcslen(pszDiz)+1; *CustomData = (wchar_t*)malloc(nLen*2); wcscpy(*CustomData, pszDiz); // Заменить некоторые символы wchar_t* pszTab = wcspbrk(*CustomData, L"/t"); while (pszTab) { *pszTab = L' '; pszTab = wcspbrk(pszTab+1, L"/t"); } return TRUE;}
开发者ID:CS-svnmirror,项目名称:conemu,代码行数:42,
示例14: cooMatrixfromFile// This function reads the file at the given filepath, and returns the sparse// matrix in the COO struct.template< typename T > intcooMatrixfromFile( std::vector< int >& row_indices, std::vector< int >& col_indices, std::vector< T >& values, const char* filePath ){ // Check that the file format is matrix market; the only format we can read right now // This is not a complete solution, and fails for directories with file names etc... // TODO: Should we use boost filesystem? std::string strPath( filePath ); if( strPath.find_last_of( '.' ) != std::string::npos ) { std::string ext = strPath.substr( strPath.find_last_of( '.' ) + 1 ); if( ext != "mtx" ) return 1; } else return 1; MatrixMarketReader< T > mm_reader; if( mm_reader.MMReadFormat( filePath ) ) return 2; int m = mm_reader.GetNumRows( ); int n = mm_reader.GetNumCols( ); int nnz = mm_reader.GetNumNonZeroes( ); row_indices.clear( ); col_indices.clear( ); values.clear( ); row_indices.reserve( m ); col_indices.reserve( n ); values.reserve( nnz ); Coordinate< T >* coords = mm_reader.GetUnsymCoordinates( ); for( int c = 0; c < nnz; ++c ) { row_indices.push_back( coords[ c ].x ); col_indices.push_back( coords[ c ].y ); values.push_back( coords[ c ].val ); } return 0;}
开发者ID:nagyist,项目名称:clSPARSE,代码行数:44,
示例15: FileNameFromPath std::string FileNameFromPath(const char* lpszPath) { if (NULL == lpszPath || NULL == *lpszPath) return (""); std::string strPath(lpszPath); std::string::iterator iter; for (iter = strPath.begin(); iter < strPath.end(); iter++) { if (('//') == *iter) *iter = ('/'); } std::string::size_type nPos = strPath.rfind(('/')); if (nPos != std::string::npos) strPath = strPath.substr(nPos + 1); return strPath; }
开发者ID:uvbs,项目名称:myduilib,代码行数:20,
示例16: _T// 返回指定路径字符串的文件名和扩展名tstring CPath::GetFileName(LPCTSTR lpszPath){ if (NULL == lpszPath || NULL == *lpszPath) return _T(""); tstring strPath(lpszPath); tstring::iterator iter; for (iter = strPath.begin(); iter < strPath.end(); iter++) { if (_T('//') == *iter) *iter = _T('/'); } tstring::size_type nPos = strPath.rfind(_T('/')); if (nPos != tstring::npos) strPath = strPath.substr(nPos+1); return strPath;}
开发者ID:longlinht,项目名称:DirectUI,代码行数:21,
|