亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pathfunc.pas

?? 源代碼
?? PAS
字號:
unit PathFunc;

{
  Inno Setup
  Copyright (C) 1997-2004 Jordan Russell
  Portions by Martijn Laan
  For conditions of distribution and use, see LICENSE.TXT.

  This unit provides some path-related, MBCS-aware functions.

  These functions should always be used in lieu of their SysUtils counterparts
  since they aren't MBCS-aware on Delphi 2, and sometimes not MBCS-aware on
  Delphi 6 and 7 either (see QC#5096).

  $jrsoftware: issrc/Components/PathFunc.pas,v 1.18 2004/07/31 23:41:07 jr Exp $
}

interface

function AddBackslash(const S: String): String;
function CharLength(const S: String; const Index: Integer): Integer;
function CharCompare(const S1, S2: PChar): Boolean;
function PathChangeExt(const Filename, Extension: String): String;
function PathCompare(const S1, S2: String): Integer;
function PathDrivePartLength(const Filename: String): Integer;
function PathExpand(const Filename: String): String;
function PathExtractDir(const Filename: String): String;
function PathExtractDrive(const Filename: String): String;
function PathExtractExt(const Filename: String): String;
function PathExtractName(const Filename: String): String;
function PathExtractPath(const Filename: String): String;
function PathLastChar(const S: String): PChar;
function PathLastDelimiter(const Delimiters, S: string): Integer;
function PathLowercase(const S: String): String;
function PathPos(Ch: Char; const S: String): Integer;
function PathRemoveExtraBackslashes(const S: String): String;
function PathStrScan(const S: PChar; const C: Char): PChar;
function RemoveBackslash(const S: String): String;
function RemoveBackslashUnlessRoot(const S: String): String;

implementation

uses
  Windows, SysUtils;

{
  Some notes:
  1. Whenever possible I try to use CharNext() and friends instead of checking
     for lead bytes, just in case these functions or Windows itself support
     UTF-8 some day.
}

function AddBackslash(const S: String): String;
{ Returns S plus a trailing backslash, unless S is an empty string or already
  ends in a backslash. }
begin
  Result := S;
  if (Result <> '') and (PathLastChar(Result)^ <> '\') then
    Result := Result + '\';
end;

function CharLength(const S: String; const Index: Integer): Integer;
{ Returns the length of the character at Index in S.
  Note: Nulls are treated as characters with a length of 1. }
var
  P: PChar;
begin
  P := @S[Index];
  if P^ = #0 then
    Result := 1
  else
    Result := CharNext(P) - P;
end;

function CharCompare(const S1, S2: PChar): Boolean;
{ Compares two first characters, and returns True if they are equal. }
var
  N, I: Integer;
begin
  N := CharNext(S1) - S1;
  if N = CharNext(S2) - S2 then begin
    for I := 0 to N-1 do begin
      if S1[I] <> S2[I] then begin
        Result := False;
        Exit;
      end;
    end;
    Result := True;
  end else
    Result := False;
end;

function PathChangeExt(const Filename, Extension: String): String;
{ Takes Filename, removes any existing extension, then adds the extension
  specified by Extension and returns the resulting string. }
var
  I: Integer;
begin
  I := PathLastDelimiter('.\:', Filename);
  if (I = 0) or (Filename[I] <> '.') then
    I := Maxint;
  Result := Copy(Filename, 1, I - 1) + Extension;
end;

function PathCompare(const S1, S2: String): Integer;
{ Compares two filenames, and returns 0 if they are equal. }
begin
  Result := AnsiCompareStr(PathLowercase(S1), PathLowercase(S2));
end;

function PathDrivePartLength(const Filename: String): Integer;
{ Returns length of the drive portion of Filename (either 'x:' or
  '\\server\share'), or 0 if there is no drive portion.
  Note: This is MBCS-safe, unlike the Delphi's ExtractFileDrive function.
  (Computer and share names can include multi-byte characters!) }
var
  Len, I, C: Integer;
begin
  Len := Length(Filename);

  { x: }
  if Len > 0 then begin
    I := CharLength(Filename, 1) + 1;
    if (Len >= I) and (Filename[I] = ':') then begin
      Result := I;
      Exit;
    end;
  end;

  { \\server\share }
  if (Len >= 2) and (Filename[1] = '\') and (Filename[2] = '\') then begin
    I := 3;
    C := 0;
    while I <= Len do begin
      if Filename[I] = '\' then begin
        Inc(C);
        if C >= 2 then
          Break;
      end;
      Inc(I, CharLength(Filename, I));
    end;
    Result := I - 1;
    Exit;
  end;

  Result := 0;
end;

function PathExpand(const Filename: String): String;
{ Like Delphi's ExpandFileName, but does proper error checking. }
var
  Res: Integer;
  FilePart: PChar;
  Buf: array[0..4095] of Char;
begin
  DWORD(Res) := GetFullPathName(PChar(Filename), SizeOf(Buf), Buf, FilePart);
  if (Res > 0) and (Res < SizeOf(Buf)) then
    SetString(Result, Buf, Res)
  else
    Result := Filename;
end;

function PathExtractDir(const Filename: String): String;
{ Like PathExtractPath, but strips any trailing backslash, unless the resulting
  path is the root directory of a drive (i.e. 'C:\' or '\'). }
var
  I: Integer;
begin
  I := PathLastDelimiter('\:', Filename);
  if (I > 1) and (Filename[I] = '\') and
     not (CharPrev(Pointer(Filename), @Filename[I])^ in ['\', ':']) then
    Dec(I);
  Result := Copy(FileName, 1, I);
end;

function PathExtractDrive(const Filename: String): String;
{ Returns the drive portion of Filename (either 'x:' or '\\server\share'),
  or an empty string if there is no drive portion. }
var
  L: Integer;
begin
  L := PathDrivePartLength(Filename);
  if L = 0 then
    Result := ''
  else
    Result := Copy(Filename, 1, L);
end;

function PathExtractExt(const Filename: String): String;
{ Returns the extension portion of the last component of Filename (e.g. '.txt')
  or an empty string if there is no extension. }
var
  I: Integer;
begin
  I := PathLastDelimiter('.\:', Filename);
  if (I > 0) and (Filename[I] = '.') then
    Result := Copy(Filename, I, Maxint)
  else
    Result := '';
end;

function PathExtractName(const Filename: String): String;
{ Returns the filename portion of Filename (e.g. 'filename.txt'). If Filename
  ends in a backslash or colon, the result will be an empty string.
  This function is essentially the opposite of PathExtractPath. }
var
  I: Integer;
begin
  I := PathLastDelimiter('\:', Filename);
  Result := Copy(Filename, I + 1, Maxint);
end;

function PathExtractPath(const Filename: String): String;
{ Returns the path portion of Filename (e.g. 'c:\dir\'). If Filename contains
  no backslash or colon, the result will be an empty string.
  This function is essentially the opposite of PathExtractName. }
var
  I: Integer;
begin
  I := PathLastDelimiter('\:', Filename);
  Result := Copy(Filename, 1, I);
end;

function PathLastChar(const S: String): PChar;
{ Returns pointer to last character in the string. Is MBCS-aware. Returns nil
  if the string is empty. }
begin
  if S = '' then
    Result := nil
  else
    Result := CharPrev(Pointer(S), @S[Length(S)+1]);
end;

function PathLastDelimiter(const Delimiters, S: string): Integer;
{ Returns the index of the last occurrence in S of one of the characters in
  Delimiters, or 0 if none were found.
  Note: S is allowed to contain null characters. }
var
  P, E: PChar;
begin
  Result := 0;
  if (S = '') or (Delimiters = '') then
    Exit;
  P := Pointer(S);
  E := @P[Length(S)];
  while P < E do begin
    if P^ <> #0 then begin
      if StrScan(Pointer(Delimiters), P^) <> nil then
        Result := (P - Pointer(S)) + 1;
      P := CharNext(P);
    end
    else
      Inc(P);
  end;
end;

function PathLowercase(const S: String): String;
{ Converts the specified path name to lowercase }
var
  I, L: Integer;
begin
  if (Win32Platform <> VER_PLATFORM_WIN32_NT) and
     (GetSystemMetrics(SM_DBCSENABLED) <> 0) then begin
    { Japanese Windows 98's handling of double-byte Roman characters in
      filenames is case sensitive, so we can't change the case of double-byte
      characters. (Japanese Windows NT/2000 is case insensitive.) Based on code
      from AnsiLowerCaseFileName. }
    Result := S;
    L := Length(Result);
    I := 1;
    while I <= L do begin
      if Result[I] in ['A'..'Z'] then begin
        Inc(Byte(Result[I]), 32);
        Inc(I);
      end
      else
        Inc(I, CharLength(Result, I));
    end;
  end
  else
    Result := AnsiLowerCase(S);
end;

function PathPos(Ch: Char; const S: String): Integer;
{ This is an MBCS-aware Pos function.
  Note: This function cannot search past null characters. }
var
  P: PChar;
begin
  Result := 0;
  if S <> '' then begin
    P := PathStrScan(Pointer(S), Ch);
    if P <> nil then
      Result := (P - Pointer(S)) + 1;
  end;
end;

function PathRemoveExtraBackslashes(const S: String): String;
{ Returns S minus any superfluous backslashes. For example, if S is
  'C:\\\some\\path', it returns 'C:\some\path'. Does not remove a double
  backslash at the beginning of the string, since that signifies a UNC path. }  
var
  I: Integer;
begin
  Result := S;
  I := 1;
  while I < Length(Result) do begin
    if (Result[I] = '\') and (Result[I+1] = '\') and (I > 1) then
      Delete(Result, I+1, 1)
    else
      Inc(I, CharLength(Result, I));
  end;
end;

function PathStrScan(const S: PChar; const C: Char): PChar;
{ Returns pointer to first occurrence of C in S, or nil if there are no
  occurrences. Like StrScan, but MBCS-aware.
  Note: As with StrScan, specifying #0 for the search character is legal. }
begin
  Result := S;
  while Result^ <> C do begin
    if Result^ = #0 then begin
      Result := nil;
      Break;
    end;
    Result := CharNext(Result);
  end;
end;

function RemoveBackslash(const S: String): String;
{ Removes the trailing backslash from the string, if one exists }
begin
  Result := S;
  if (Result <> '') and (PathLastChar(Result)^ = '\') then
    SetLength(Result, Length(Result)-1);
end;

function RemoveBackslashUnlessRoot(const S: String): String;
{ Removes the trailing backslash from the string, if one exists and does
  not specify a root directory of a drive (i.e. 'C:\' or '\') }
var
  L: Integer;
  P: PChar;
begin
  Result := S;
  L := Length(Result);
  if L < 2 then
    Exit;
  P := CharPrev(Pointer(S), @S[L+1]);
  if (P^ = '\') and (CharPrev(Pointer(S), P)^ <> ':') then
    SetLength(Result, L-1);
end;

end.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品免费看| 成人h动漫精品一区二| 99国产精品视频免费观看| 91精品国产综合久久福利软件| 中文字幕精品—区二区四季| 蜜桃一区二区三区四区| 日本高清不卡在线观看| 日本一区二区不卡视频| 久久超碰97中文字幕| 欧美日韩久久久久久| 亚洲欧美日韩成人高清在线一区| 国产精品一区二区三区乱码| 欧美一区二区三区男人的天堂| 亚洲精品乱码久久久久| 国产精华液一区二区三区| 日韩一区二区免费在线电影| 亚洲午夜精品网| 91视频在线观看| 国产精品女上位| 国产成人亚洲精品狼色在线 | 男人的j进女人的j一区| 欧美亚州韩日在线看免费版国语版| 中文字幕一区二区三区在线观看 | 天天免费综合色| 色婷婷久久久综合中文字幕| 国产精品萝li| 成人一区二区三区中文字幕| 久久久美女艺术照精彩视频福利播放| 爽好多水快深点欧美视频| 欧美日韩中文字幕精品| 一区二区三区日韩在线观看| 色久综合一二码| 亚洲欧美日韩国产另类专区| 色综合久久久久综合体| 亚洲美女区一区| 一本一本大道香蕉久在线精品| 国产精品成人午夜| av高清不卡在线| 亚洲欧美日韩在线播放| 91网站黄www| 亚洲精品大片www| 色婷婷综合视频在线观看| 亚洲精品自拍动漫在线| 色视频一区二区| 亚洲五码中文字幕| 欧美精品v国产精品v日韩精品| 亚洲成人在线网站| 91精品国产麻豆| 极品瑜伽女神91| 久久久www成人免费无遮挡大片| 国产激情视频一区二区在线观看 | 日韩一区二区在线看片| 美女一区二区视频| 欧美tk丨vk视频| 国产一区二区三区免费| 国产日韩一级二级三级| 不卡的av在线| 一区二区三区色| 3atv在线一区二区三区| 久久99国产精品免费| 国产午夜亚洲精品羞羞网站| 99久久精品国产毛片| 亚洲在线观看免费视频| 欧美一区二区三区色| 国产精品一线二线三线精华| 欧美国产日韩a欧美在线观看| 91啪亚洲精品| 日韩不卡一区二区三区| 久久久久久毛片| 99久久er热在这里只有精品15| 一区二区三区四区高清精品免费观看| 欧美日韩久久久| 国产一本一道久久香蕉| 国产精品夫妻自拍| 欧美调教femdomvk| 理论电影国产精品| 中文字幕中文字幕一区二区| 欧美无乱码久久久免费午夜一区| 狂野欧美性猛交blacked| 久久久久久久电影| 色哟哟日韩精品| 久久99久久99| 亚洲欧美日韩中文字幕一区二区三区 | 日本 国产 欧美色综合| 久久久久亚洲蜜桃| 91福利视频在线| 久久91精品国产91久久小草| 国产精品国产三级国产专播品爱网| 欧美性生活久久| 国内精品久久久久影院薰衣草| 成人欧美一区二区三区1314| 91精品国产91热久久久做人人| 大美女一区二区三区| 亚洲va欧美va天堂v国产综合| 国产午夜精品理论片a级大结局| 在线欧美小视频| 国产九色精品成人porny | 中文字幕一区在线观看视频| 91.com视频| aaa国产一区| 蜜臀av一区二区在线免费观看| 中文字幕亚洲区| 日韩午夜av一区| 色欧美片视频在线观看在线视频| 久久精品国产77777蜜臀| 亚洲女厕所小便bbb| 精品国产一区二区国模嫣然| 色悠久久久久综合欧美99| 国产专区综合网| 亚洲高清免费观看高清完整版在线观看| 精品国产免费人成在线观看| 91久久久免费一区二区| 国产精品一卡二| 视频在线观看一区| 亚洲免费在线电影| 中文字幕 久热精品 视频在线 | 99久久精品久久久久久清纯| 精品一区二区三区在线观看| 亚洲成人免费看| 亚洲日本va午夜在线影院| 久久久亚洲国产美女国产盗摄| 欧美日韩成人在线| 色哟哟一区二区三区| 成人性生交大合| 国产在线播放一区三区四| 婷婷中文字幕综合| 亚洲色图第一区| 国产精品美女久久久久高潮| 欧美精品一区二区三区在线播放| 欧美日韩大陆一区二区| 在线视频欧美区| 91美女片黄在线观看| 高清视频一区二区| 国产美女在线观看一区| 日本欧美在线观看| 日韩精品1区2区3区| 亚洲成人先锋电影| 亚洲伊人色欲综合网| 亚洲视频一区二区免费在线观看| 欧美高清在线一区| 久久综合网色—综合色88| 日韩一区二区三区免费观看| 欧美美女喷水视频| 欧美日韩国产123区| 欧美区一区二区三区| 欧美日韩中文另类| 欧美日韩综合在线免费观看| 欧美日韩一区国产| 欧美日本一区二区三区四区| 欧美日韩黄视频| 欧美日韩国产美女| 欧美精品久久一区二区三区| 欧美日韩精品一区视频| 欧美日韩国产精品自在自线| 欧美久久久久免费| 在线综合视频播放| 日韩三级.com| 精品福利二区三区| 久久久午夜精品理论片中文字幕| 欧美电视剧在线看免费| 精品国产精品网麻豆系列| 欧美成人a在线| 久久日一线二线三线suv| 久久久久久久久伊人| 亚洲国产电影在线观看| 亚洲欧美一区二区在线观看| 综合久久一区二区三区| 亚洲香蕉伊在人在线观| 日日欢夜夜爽一区| 看国产成人h片视频| 国产毛片精品视频| 成人av影视在线观看| 一本久道中文字幕精品亚洲嫩| 在线观看日韩国产| 91精品国产免费久久综合| 26uuu国产电影一区二区| 国产视频一区二区在线观看| 国产精品国产三级国产普通话蜜臀 | 一区二区中文字幕在线| 亚洲精品国产a久久久久久| 亚洲一本大道在线| 日韩精品成人一区二区在线| 极品少妇一区二区三区精品视频 | 国产一区二区三区精品视频| 国产成人精品亚洲午夜麻豆| 99久久er热在这里只有精品15| 91国偷自产一区二区使用方法| 欧美日本国产视频| 久久久精品欧美丰满| 亚洲精品自拍动漫在线| 日本成人中文字幕在线视频| 国产精品一区不卡| 日本韩国欧美在线| 欧美成人综合网站| 国产精品福利影院| 午夜视频在线观看一区| 国产在线精品一区二区夜色| 91丨九色porny丨蝌蚪| 91麻豆精品国产91| 欧美国产视频在线|