这篇教程C++ wcspbrk函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wcspbrk函数的典型用法代码示例。如果您正苦于以下问题:C++ wcspbrk函数的具体用法?C++ wcspbrk怎么用?C++ wcspbrk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wcspbrk函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetContentDataWintptr_t WINAPI GetContentDataW(struct GetContentDataInfo *Info){ if (!Info) return FALSE; LPCWSTR FilePath = Info->FilePath; wchar_t** CustomData = NULL; for (size_t i = 0; i < Info->Count; i++) { if (!fsf.LStricmp(Info->Names[i], L"diz") || !fsf.LStricmp(Info->Names[i], L"C0")) { CustomData = (wchar_t**)(Info->Values + i); } } if (!FilePath || !CustomData) return FALSE; 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:Maximus5,项目名称:FarPlugins,代码行数:57,
示例2: wcspbrkbool CBackgroundInfo::PollBackgroundFile(){ bool lbChanged = false; if (gpSet->isShowBgImage && ms_BgImage[0] && ((GetTickCount() - nBgModifiedTick) > BACKGROUND_FILE_POLL) && wcspbrk(ms_BgImage, L"%//.")) // только для файлов! { WIN32_FIND_DATA fnd = {0}; HANDLE hFind = FindFirstFile(ms_BgImage, &fnd); if (hFind != INVALID_HANDLE_VALUE) { if (fnd.ftLastWriteTime.dwHighDateTime != ftBgModified.dwHighDateTime || fnd.ftLastWriteTime.dwLowDateTime != ftBgModified.dwLowDateTime) { //NeedBackgroundUpdate(); -- поставит LoadBackgroundFile, если у него получится файл открыть lbChanged = LoadBackgroundFile(false); nBgModifiedTick = GetTickCount(); } FindClose(hFind); } } return lbChanged;}
开发者ID:ForNeVeR,项目名称:ConEmu,代码行数:26,
示例3: string &QuoteSpace(string &strStr){ if (wcspbrk(strStr, Opt.strQuotedSymbols) ) InsertQuote(strStr); return strStr;}
开发者ID:alexlav,项目名称:conemu,代码行数:7,
示例4: efile_altnameposix_errno_t efile_altname(ErlNifEnv *env, const efile_path_t *path, ERL_NIF_TERM *result) { ErlNifBinary result_bin; ASSERT_PATH_FORMAT(path); if(is_path_root(path)) { /* Root paths can't be queried so we'll just return them as they are. */ if(!enif_alloc_binary(path->size, &result_bin)) { return ENOMEM; } sys_memcpy(result_bin.data, path->data, path->size); } else { WIN32_FIND_DATAW data; HANDLE handle; WCHAR *name_buffer; int name_length; /* Reject path wildcards. */ if(wcspbrk(&((const WCHAR*)path->data)[LP_PREFIX_LENGTH], L"?*")) { return ENOENT; } handle = FindFirstFileW((const WCHAR*)path->data, &data); if(handle == INVALID_HANDLE_VALUE) { return windows_to_posix_errno(GetLastError()); } FindClose(handle); name_length = wcslen(data.cAlternateFileName); if(name_length > 0) { name_buffer = data.cAlternateFileName; } else { name_length = wcslen(data.cFileName); name_buffer = data.cFileName; } /* Include NUL-terminator; it will be removed after normalization. */ name_length += 1; if(!enif_alloc_binary(name_length * sizeof(WCHAR), &result_bin)) { return ENOMEM; } sys_memcpy(result_bin.data, name_buffer, name_length * sizeof(WCHAR)); } if(!normalize_path_result(&result_bin)) { enif_release_binary(&result_bin); return ENOMEM; } (*result) = enif_make_binary(env, &result_bin); return 0;}
开发者ID:HansN,项目名称:otp,代码行数:60,
示例5: updateFILE *wfopen(const wchar_t *filename, const wchar_t *mode){ if(!mode || !filename || !*filename) return NULL; //_D(SysLog("fopen: filename[%s], mode[%s] strpbrk%c=NULL", // filename, mode, strpbrk(mode, "rwa")?'!':'=')); if(wcspbrk(mode, L"rwa")==NULL) return NULL; DWORD dwDesiredAccess=0, dwCreationDistribution=0; BOOL R, W, A; R=W=A=FALSE;/*r Open for reading only.w Create for writing. If a file by that name already exists, it will be overwritten.a Append; open for writing at end-of-file or create for writing if the file does not exist.r+ Open an existing file for update (reading and writing).w+ Create a new file for update (reading and writing). If a file by that name already exists, it will be overwritten.a+ Open for append; open (or create if the file does not exist) for update at the end of the file.*/ if(wcschr(mode, L'r')) { //_D(SysLog("r - GENERIC_READ")); dwDesiredAccess|=GENERIC_READ; dwCreationDistribution=OPEN_EXISTING; R=TRUE; } if(wcschr(mode, L'w')) { //_D(SysLog("w - GENERIC_WRITE")); dwDesiredAccess|=GENERIC_WRITE; dwCreationDistribution=CREATE_ALWAYS; W=TRUE; } if(wcschr(mode, L'a')) { //_D(SysLog("a - GENERIC_WRITE")); dwDesiredAccess|=GENERIC_WRITE; dwCreationDistribution=OPEN_ALWAYS; A=TRUE; } if(wcschr(mode, L'+')) { //_D(SysLog("+++")); dwDesiredAccess|=GENERIC_WRITE; dwCreationDistribution=CREATE_ALWAYS; if(R) dwDesiredAccess|=GENERIC_WRITE; if(W) dwDesiredAccess|=GENERIC_READ; } HANDLE hFile=CreateFile(filename, dwDesiredAccess, FILE_SHARE_READ, NULL, dwCreationDistribution, 0, NULL); //_D(SysLog("hFile%c=INVALID_HANDLE_VALUE", hFile==INVALID_HANDLE_VALUE?'=':'!')); if(hFile==INVALID_HANDLE_VALUE) return NULL; if(A) fseek((FILE *)hFile, 0, SEEK_END); return (FILE *)hFile;};
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:60,
示例6: ArgStrLen/** * Get the length that the string will take and takes into account the * additional length if the string needs to be quoted and if characters need to * be escaped. */static int ArgStrLen(const wchar_t *s){ int backslashes = 0; int i = wcslen(s); BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr; // Only add doublequotes if the string contains a space or a tab BOOL addDoubleQuotes = wcspbrk(s, L" /t") != nullptr; if (addDoubleQuotes) { i += 2; // initial and final duoblequote } if (hasDoubleQuote) { while (*s) { if (*s == '//') { ++backslashes; } else { if (*s == '"') { // Escape the doublequote and all backslashes preceding the doublequote i += backslashes + 1; } backslashes = 0; } ++s; } } return i;}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:36,
示例7: string &QuoteSpace(string &strStr){ if (wcspbrk(strStr, Global->Opt->strQuotedSymbols) ) InsertQuote(strStr); return strStr;}
开发者ID:CyberShadow,项目名称:FAR,代码行数:7,
示例8: QuoteSpacewchar_t* QuoteSpace(wchar_t *Str){ if (wcspbrk(Str, Global->Opt->strQuotedSymbols) ) InsertQuote(Str); return Str;}
开发者ID:CyberShadow,项目名称:FAR,代码行数:7,
示例9: _ASSERTEbool CBackgroundInfo::LoadBackgroundFile(bool abShowErrors){ // Пустой путь - значит БЕЗ обоев if (!*ms_BgImage) { return true; } //_ASSERTE(gpConEmu->isMainThread()); _ASSERTE(gpConEmu->isMainThread()); bool lRes = false; BY_HANDLE_FILE_INFORMATION inf = {0}; BITMAPFILEHEADER* pBkImgData = NULL; if (wcspbrk(ms_BgImage, L"%//.") == NULL) { // May be "Solid color" COLORREF clr = (COLORREF)-1; if (GetColorRef(ms_BgImage, &clr)) { pBkImgData = CreateSolidImage(clr, 128, 128); } } if (!pBkImgData) { wchar_t* exPath = ExpandEnvStr(ms_BgImage); if (!exPath || !*exPath) { if (abShowErrors) { wchar_t szError[MAX_PATH*2]; DWORD dwErr = GetLastError(); _wsprintf(szError, SKIPLEN(countof(szError)) L"Can't expand environment strings:/r/n%s/r/nError code=0x%08X/r/nImage loading failed", ms_BgImage, dwErr); MBoxA(szError); } return false; } pBkImgData = LoadImageEx(exPath, inf); } if (pBkImgData) { ftBgModified = inf.ftLastWriteTime; nBgModifiedTick = GetTickCount(); //NeedBackgroundUpdate(); //MSectionLock SBG; SBG.Lock(&mcs_BgImgData); SafeFree(mp_BgImgData); mb_IsBackgroundImageValid = true; mp_BgImgData = pBkImgData; lRes = true; } return lRes;}
开发者ID:G-VAR,项目名称:ConEmu,代码行数:60,
示例10: QuoteSpacewchar_t* WINAPI QuoteSpace(wchar_t *Str){ if (wcspbrk(Str, Opt.strQuotedSymbols) ) InsertQuote(Str); return Str;}
开发者ID:alexlav,项目名称:conemu,代码行数:7,
示例11: IsQuotationNeededbool IsQuotationNeeded(LPCWSTR pszPath){ bool bNeeded = false; if (pszPath) { bNeeded = (wcspbrk(pszPath, QuotationNeededChars) != 0); } return bNeeded;}
开发者ID:DreamersStudio,项目名称:ConEmu,代码行数:9,
示例12: FindFirstFileW/* Replace the last part of the path to long name. We try to avoid to call FindFirstFileW() since it takes long time.*/static inline size_treplace_to_long_name(wchar_t **wfullpath, size_t size, size_t buffer_size){ WIN32_FIND_DATAW find_data; HANDLE find_handle; /* Skip long name conversion if the path is already long name. Short name is 8.3 format. http://en.wikipedia.org/wiki/8.3_filename This check can be skipped for directory components that have file extensions longer than 3 characters, or total lengths longer than 12 characters. http://msdn.microsoft.com/en-us/library/windows/desktop/aa364980(v=vs.85).aspx */ size_t const max_short_name_size = 8 + 1 + 3; size_t const max_extension_size = 3; size_t path_len = 1, extension_len = 0; wchar_t *pos = *wfullpath; if (size == 3 && pos[1] == L':' && pos[2] == L'//' && pos[3] == L'/0') { /* root path doesn't need short name expansion */ return size; } /* skip long name conversion if path contains wildcard characters */ if (wcspbrk(pos, L"*?")) { return size; } pos = *wfullpath + size - 1; while (!IS_DIR_SEPARATOR_P(*pos) && pos != *wfullpath) { if (!extension_len && *pos == L'.') { extension_len = path_len - 1; } if (path_len > max_short_name_size || extension_len > max_extension_size) { return size; } path_len++; pos--; } find_handle = FindFirstFileW(*wfullpath, &find_data); if (find_handle != INVALID_HANDLE_VALUE) { size_t trail_pos = pos - *wfullpath + IS_DIR_SEPARATOR_P(*pos); size_t file_len = wcslen(find_data.cFileName); size_t oldsize = size; FindClose(find_handle); size = trail_pos + file_len; if (size > (buffer_size ? buffer_size-1 : oldsize)) { wchar_t *buf = ALLOC_N(wchar_t, (size + 1)); wcsncpy(buf, *wfullpath, trail_pos); if (!buffer_size) xfree(*wfullpath); *wfullpath = buf; }
开发者ID:gferguson-gd,项目名称:ruby,代码行数:61,
示例13: mainint __cdecl main(int argc, char *argv[]){ WCHAR *string; WCHAR *key1; WCHAR *key2; WCHAR key3[] = {0}; WCHAR *result; if (PAL_Initialize(argc, argv)) { return FAIL; } string = convert("foo bar baz bar"); key1 = convert("z "); key2 = convert("Q"); result = wcspbrk(string, key1); if (result != string + 3) { Fail("ERROR: Got incorrect result in scanning /"%s/" with the set /"%s/"./n" "Expected to get pointer to %#p, got %#p/n", convertC(string), convertC(key1), string + 3, result); } result = wcspbrk(string, key2); if (result != NULL) { Fail("ERROR: Got incorrect result in scanning /"%s/" with the set /"%s/"./n" "Expected to get pointer to %#p, got %#p/n", convertC(string), convertC(key2), NULL, result); } result = wcspbrk(string, key3); if (result != NULL) { Fail("ERROR: Got incorrect result in scanning /"%s/" with the set /"%s/"./n" "Expected to get pointer to %#p, got %#p/n", convertC(string), convertC(key3), NULL, result); } PAL_Terminate(); return PASS;}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:44,
示例14: mainint main( void ){ TESTCASE( wcspbrk( wabcde, L"x" ) == NULL ); TESTCASE( wcspbrk( wabcde, L"xyz" ) == NULL ); TESTCASE( wcspbrk( wabcdx, L"x" ) == &wabcdx[4] ); TESTCASE( wcspbrk( wabcdx, L"xyz" ) == &wabcdx[4] ); TESTCASE( wcspbrk( wabcdx, L"zyx" ) == &wabcdx[4] ); TESTCASE( wcspbrk( wabcde, L"a" ) == &wabcde[0] ); TESTCASE( wcspbrk( wabcde, L"abc" ) == &wabcde[0] ); TESTCASE( wcspbrk( wabcde, L"cba" ) == &wabcde[0] ); return TEST_RESULTS;}
开发者ID:DavideD,项目名称:BizHawk,代码行数:12,
示例15: wcfixmodestatic wchar_t * wcfixmode(const wchar_t *mode){ static wchar_t wcfixedmode[6]; wcfixedmode[4] = L'/0'; wcsncpy(wcfixedmode, mode, 4); if (!wcspbrk(wcfixedmode, L"bt")) { wcscat(wcfixedmode, L"t"); } return wcfixedmode;}
开发者ID:nirvananoob,项目名称:r-source,代码行数:10,
示例16: 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,
示例17: PathWordBreakProc//---------------------------------------------------------------------------// Windows algorithm is as follows (tested on W2k):// right:// is_delimiter(current)// false:// right(left(current) + 1)// true:// right(right(current) + 1)// left:// right(left(current) + 1)int CALLBACK PathWordBreakProc(wchar_t * Ch, int Current, int Len, int Code){ int Result; UnicodeString ACh(Ch, Len); if (Code == WB_ISDELIMITER) { // we return negacy of what WinAPI docs says Result = !IsPathWordDelimiter(ACh[Current + 1]); } else if (Code == WB_LEFT) { // skip consecutive delimiters while ((Current > 0) && IsPathWordDelimiter(ACh[Current])) { Current--; } Result = ACh.SubString(1, Current - 1).LastDelimiter(PathWordDelimiters); } else if (Code == WB_RIGHT) { if (Current == 0) { // will be called again with Current == 1 Result = 0; } else { const wchar_t * P = wcspbrk(ACh.c_str() + Current - 1, PathWordDelimiters); if (P == NULL) { Result = Len; } else { Result = P - ACh.c_str() + 1; // skip consecutive delimiters while ((Result < Len) && IsPathWordDelimiter(ACh[Result + 1])) { Result++; } } } } else { assert(false); Result = 0; } return Result;}
开发者ID:seebigsea,项目名称:winscp,代码行数:62,
示例18: MkDirDlgProcintptr_t WINAPI MkDirDlgProc(HANDLE hDlg,intptr_t Msg,intptr_t Param1,void* Param2){ switch (Msg) { case DN_LISTCHANGE: { if (Param1 == MKDIR_COMBOBOX_LINKTYPE) { SendDlgMessage(hDlg, DM_ENABLE, MKDIR_EDIT_LINKPATH, ToPtr(Param2 != 0)); } } break; case DN_CLOSE: { if (Param1==MKDIR_OK) { string strDirName=reinterpret_cast<LPCWSTR>(SendDlgMessage(hDlg,DM_GETCONSTTEXTPTR,MKDIR_EDIT,0)); Opt.MultiMakeDir=(SendDlgMessage(hDlg,DM_GETCHECK,MKDIR_CHECKBOX,0)==BSTATE_CHECKED); // это по поводу создания одиночного каталога, который // начинается с пробела! Чтобы ручками не заключать // такой каталог в кавычки if (Opt.MultiMakeDir && !wcspbrk(strDirName,L";,/"")) { QuoteSpaceOnly(strDirName); } // нужно создать только ОДИН каталог if (!Opt.MultiMakeDir) { // уберем все лишние кавычки Unquote(strDirName); // возьмем в кавычки, т.к. могут быть разделители InsertQuote(strDirName); } UserDefinedList* pDirList=reinterpret_cast<UserDefinedList*>(SendDlgMessage(hDlg,DM_GETDLGDATA,0,0)); if (!pDirList->Set(strDirName)) { Message(MSG_WARNING,1,MSG(MWarning),MSG(MIncorrectDirList),MSG(MOk)); return FALSE; } } } break; default: break; } return DefDlgProc(hDlg,Msg,Param1,Param2);}
开发者ID:shmuz,项目名称:Spring,代码行数:52,
示例19: expand_namesint expand_names( int argc, LPWSTR argv[] ){ HANDLE fh; WIN32_FIND_DATA fd; LPWSTR path, name; int first; int keep; int i; for (i = 0; i < globbed; ++i) free( glob[i] ); globbed = 0; for (i = 0; i < argc; ++i) { if (*argv[i] == '/0') continue; wcscpy( glob_name, argv[i] ); keep = (all && !recurse && glob_name == glob_path && wcspbrk( glob_name, L"*?" ) == NULL); fh = FindFirstFile( glob_path, &fd ); if (fh == INVALID_HANDLE_VALUE) { if (keep) add_name(); continue; } for (path = name = glob_name; *path; ++path) if (*path == '//' || *path == '/') name = path + 1; first = globbed; do { if (fd.dwFileAttributes & (hidden | FILE_ATTRIBUTE_DIRECTORY)) { if (keep) add_name(); continue; } wcscpy( name, fd.cFileName ); add_name(); } while (FindNextFile( fh, &fd )); FindClose( fh ); qsort( glob + first, globbed - first, sizeof(LPWSTR), glob_sort ); } return (globbed != 0);}
开发者ID:AlexRee,项目名称:Detect-It-Easy,代码行数:52,
示例20: ATF_TC_BODYATF_TC_BODY(wcspbrk, tc){ static const wchar_t s[] = L"abcdefghijklmnop"; ATF_CHECK_EQ(wcspbrk(s, L""), NULL); ATF_CHECK_EQ(wcspbrk(s, L"qrst"), NULL); ATF_CHECK_EQ(wcspbrk(s, L"a"), s); ATF_CHECK_EQ(wcspbrk(s, L"b"), s + 1); ATF_CHECK_EQ(wcspbrk(s, L"ab"), s); ATF_CHECK_EQ(wcspbrk(s, L"cdef"), s + 2); ATF_CHECK_EQ(wcspbrk(s, L"fedc"), s + 2);}
开发者ID:2asoft,项目名称:freebsd,代码行数:12,
示例21: strdelim/* return next token in configuration line */wchar_t *strdelim(wchar_t **s){ wchar_t *old; int wspace = 0; if (*s == NULL) return (NULL); old = *s; *s = wcspbrk(*s, WHITESPACE QUOTE "="); if (*s == NULL) return (old); if (*s[0] == L'/"') { wmemmove(*s, *s + 1, wcslen(*s)); /* move nul too */ /* Find matching quote */ if ((*s = wcspbrk(*s, QUOTE)) == NULL) { return (NULL); /* no matching quote */ } else { *s[0] = L'/0'; return (old); } } /* Allow only one '=' to be skipped */ if (*s[0] == L'=') wspace = 1; *s[0] = L'/0'; /* Skip any extra whitespace after first token */ *s += wcsspn(*s + 1, WHITESPACE) + 1; if (*s[0] == L'=' && !wspace) *s += wcsspn(*s + 1, WHITESPACE) + 1; return (old);}
开发者ID:tamentis,项目名称:prwd,代码行数:39,
示例22: matchbool match(const wchar *pattern,const wchar *string,bool ForceCase){ for (;; ++string) { wchar stringc=touppercw(*string,ForceCase); wchar patternc=touppercw(*pattern++,ForceCase); switch (patternc) { case 0: return(stringc==0); case '?': if (stringc == 0) return(false); break; case '*': if (*pattern==0) return(true); if (*pattern=='.') { if (pattern[1]=='*' && pattern[2]==0) return(true); const wchar *dot=wcschr(string,'.'); if (pattern[1]==0) return (dot==NULL || dot[1]==0); if (dot!=NULL) { string=dot; if (wcspbrk(pattern,L"*?")==NULL && wcschr(string+1,'.')==NULL) return(mwcsicompc(pattern+1,string+1,ForceCase)==0); } } while (*string) if (match(pattern,string++,ForceCase)) return(true); return(false); default: if (patternc != stringc) { // Allow "name." mask match "name" and "name./" match "name/". if (patternc=='.' && (stringc==0 || stringc=='//' || stringc=='.')) return(match(pattern,string,ForceCase)); else return(false); } break; } }}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:49,
示例23: wcspbrkbool CmdArg::IsPossibleSwitch() const{ // Nothing to compare? if (IsEmpty()) return false; if ((ms_Val[0] != L'-') && (ms_Val[0] != L'/')) return false; // We do not care here about "-new_console:..." or "-cur_console:..." // They are processed by RConStartArgsEx // But ':' removed from checks, because otherwise ConEmu will not warn // on invalid usage of "-new_console:a" for example // Also, support smth like "-inside=/eCD /d %1" LPCWSTR pszDelim = wcspbrk(ms_Val+1, L"=:"); LPCWSTR pszInvalids = wcspbrk(ms_Val+1, L"///|.&<>^"); if (pszInvalids && (!pszDelim || (pszInvalids < pszDelim))) return false; // Well, looks like a switch (`-run` for example) return true;}
开发者ID:Maximus5,项目名称:ConEmu,代码行数:24,
示例24: IsNameUsablebool IsNameUsable(const wchar *Name){#ifndef _UNIX if (Name[0] && Name[1] && wcschr(Name+2,':')!=NULL) return false; for (const wchar *s=Name;*s!=0;s++) { if ((uint)*s<32) return false; if ((*s==' ' || *s=='.') && IsPathDiv(s[1])) return false; }#endif return *Name!=0 && wcspbrk(Name,L"?*<>|/"")==NULL;}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:15,
示例25: wcspbrk/* * @implemented */int CHString::FindOneOf(LPCWSTR lpszCharSet) const{ WCHAR *Found; // Let's use appropriate helper Found = wcspbrk(m_pchData, lpszCharSet); // We have to return a position, so compute it if (Found) { return (Found - m_pchData); } // Otherwise, return no position return -1;}
开发者ID:RPG-7,项目名称:reactos,代码行数:18,
示例26: ValidateMountpoint// =========================================================================// Returns TRUE if the mountpoint specified is a valid mountpoint which may// be usedBOOL ValidateMountpoint( HWND hWnd, WCHAR* mountpoint, BOOL SkipExistsCheck, BOOL silent){ BOOL retval = FALSE; if (wcslen(mountpoint) == 0) { if (!(silent)) { MsgError(hWnd, _("Please specify a mountpoint")); } } else if (wcscmp(RESERVED_MOUNTPOINT, mountpoint) == 0) { if (!(silent)) { MsgError(hWnd, _("The mountpoint specified is reserved; please enter a different mountpoint")); } } else if (wcspbrk(mountpoint, RESERVED_MOUNTPOINT_CHARS) != NULL) { if (!(silent)) { MsgError(hWnd, _("The mountpoint specified includes a invalid character; please enter a different mountpoint")); } } else if ( (!(SkipExistsCheck)) && (GetFileAttributes(mountpoint) != INVALID_FILE_ATTRIBUTES) ) { if (!(silent)) { MsgError(hWnd, _("The mountpoint specified already exists; please enter a different mountpoint")); } } else { // Everything OK retval = TRUE; } return retval;}
开发者ID:Cristo-Conklin,项目名称:LibreCrypt,代码行数:51,
示例27: Sanitize//-------------------------------------------------------------------------------------LPWSTR Sanitize(LPWSTR szString, WCHAR cReplace = L'-'){ //strip off invalid characters for a filename static LPCWSTR szInvalidCharacters = L"///:*?/"<>|"; LPWSTR pPos; while ((pPos = wcspbrk(szString, szInvalidCharacters)) != NULL) *pPos = cReplace; //trim trailing spaces pPos = szString + wcslen(szString) - 1; while (pPos >= szString && (*pPos == L' ' || *pPos == L'/t')) *pPos-- = L'/0'; //trim leading spaces pPos = szString; while (*pPos == L' ' || *pPos == L'/t') pPos++; return pPos;}
开发者ID:EBNull,项目名称:wphf-reloaded,代码行数:18,
示例28: NextLine// Returns 0 if succeeded, otherwise the error codeint NextLine(const wchar_t** asLines, CEStr &rsLine, NEXTLINEFLAGS Flags /*= NLF_TRIM_SPACES|NLF_SKIP_EMPTY_LINES*/){ if (!asLines || !*asLines) return CERR_CMDLINEEMPTY; const wchar_t* psz = *asLines; //const wchar_t szSpaces[] = L" /t"; //const wchar_t szLines[] = L"/r/n"; //const wchar_t szSpacesLines[] = L" /t/r/n"; if ((Flags & (NLF_TRIM_SPACES|NLF_SKIP_EMPTY_LINES)) == (NLF_TRIM_SPACES|NLF_SKIP_EMPTY_LINES)) psz = SkipNonPrintable(psz); else if (Flags & NLF_TRIM_SPACES) while (*psz == L' ' || *psz == L'/t') psz++; else if (Flags & NLF_SKIP_EMPTY_LINES) while (*psz == L'/r' || *psz == L'/n') psz++; if (!*psz) { *asLines = psz; return CERR_CMDLINEEMPTY; } const wchar_t* pszEnd = wcspbrk(psz, L"/r/n"); if (!pszEnd) { pszEnd = psz + lstrlen(psz); } const wchar_t* pszTrim = pszEnd; if (*pszEnd == L'/r') pszEnd++; if (*pszEnd == L'/n') pszEnd++; if (Flags & NLF_TRIM_SPACES) { while ((pszTrim > psz) && ((*(pszTrim-1) == L' ') || (*(pszTrim-1) == L'/t'))) pszTrim--; } _ASSERTE(pszTrim >= psz); rsLine.Set(psz, pszTrim-psz); psz = pszEnd; *asLines = psz; return 0;}
开发者ID:DreamersStudio,项目名称:ConEmu,代码行数:47,
示例29: wexpandint wexpand(wchar_t* name, int expand_wildcards){ wchar_t* s; WIN32_FIND_DATAW fd; HANDLE hFile; BOOLEAN first = TRUE; wchar_t buffer[256]; uintptr_t pos; if (expand_wildcards && (s = wcspbrk(name, L"*?"))) { hFile = FindFirstFileW(name, &fd); if (hFile != INVALID_HANDLE_VALUE) { while(s != name && *s != L'/' && *s != L'//') s--; pos = s - name; if (*s == L'/' || *s == L'//') pos++; wcsncpy(buffer, name, pos); do { if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { wcscpy(&buffer[pos], fd.cFileName); if (wadd(_wcsdup(buffer)) < 0) { FindClose(hFile); return -1; } first = FALSE; } } while(FindNextFileW(hFile, &fd)); FindClose(hFile); } } if (first) { if (wadd(name) < 0) return -1; } else free(name); return 0;}
开发者ID:GYGit,项目名称:reactos,代码行数:46,
注:本文中的wcspbrk函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wcsrchr函数代码示例 C++ wcsncpyz函数代码示例 |