System.Net.URLClient.TURI

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

  TURI = record
  private
    FScheme: string;
    FUsername: string;
    FPassword: string;
    FHost: string;
    FPort: Integer;
    FPath: string;
    FQuery: string;
    FParams: TURIParameters;
    FFragment: string;
  private type
    TEncType = (URLEnc, FormEnc);
  private type
    TSchemeDecomposeProc = procedure(const AURIStr: string;
      Pos, Limit, SlashCount: Integer) of object;
  private
    procedure DecomposeBaseScheme(const AURIStr: string;
      Pos, Limit, SlashCount: Integer);
    procedure DecomposeNoAuthorityScheme(const AURIStr: string;
      Pos, Limit, SlashCount: Integer);
  private
    function IsMailtoScheme: Boolean;
    function IsSchemeNoAuthority: Boolean;
    function IsValidPort: Boolean;
    function GetDefaultPort(const AScheme: string): Integer;
    procedure ParseParams(Encode: Boolean = False);
    function FindParameterIndex(const AName: string): Integer;
    function GetParameter(const I: Integer): TURIParameter;
    function GetParameterByName(const AName: string): string;
    procedure SetParameter(const I: Integer; const Value: TURIParameter);
    procedure SetParameterByName(const AName: string; const Value: string);
    function GetQuery: string;
    procedure DecomposeURI(const AURIStr: string; ARaiseNoSchema: Boolean);
    procedure SetScheme(const Value: string);
    procedure SetUserName(const Value: string);
    procedure SetPassword(const Value: string);
    procedure SetHost(const Value: string);
    procedure SetPath(const Value: string);
    procedure SetQuery(const Value: string);
    procedure SetParams(const Value: TURIParameters);
  public const
    SCHEME_HTTP = 'http'; // DO NOT LOCALIZE
    SCHEME_HTTPS = 'https'; // DO NOT LOCALIZE
    SCHEME_MAILTO = 'mailto'; // DO NOT LOCALIZE
    SCHEME_NEWS = 'news'; // DO NOT LOCALIZE
    SCHEME_TEL = 'tel'; // DO NOT LOCALIZE
    SCHEME_URN = 'urn'; // DO NOT LOCALIZE
  public
    constructor Create(const AURIStr: string);
    function ToString: string;
    procedure ComposeURI(const AScheme, AUsername, APassword, AHostname: string; APort: Integer; const APath: string;
      const AParams: TURIParameters; const AFragment: string);
    procedure AddParameter(const AName, AValue: string); overload;
    procedure AddParameter(const AParameter: TURIParameter); overload; inline;
    procedure DeleteParameter(AIndex: Integer); overload;
    procedure DeleteParameter(const AName: string); overload;
    class function URLEncode(const AValue: string; SpacesAsPlus: Boolean = False): string; static; deprecated 'Use TNetEncoding.URL.Encode';
    class function URLDecode(const AValue: string; PlusAsSpaces: Boolean = False): string; static; deprecated 'Use TNetEncoding.URL.Decode';
    function Encode: string;
    class function UnicodeToIDNA(const AHostName: string): string; static;
    class function IDNAToUnicode(const AHostName: string): string; static;
    class function PathRelativeToAbs(const RelPath: string; const Base: TURI): string; static;
    class function FixupForREST(const AURL: string): string; static;
    property Parameter[const I: Integer]: TURIParameter read GetParameter write SetParameter;
    property ParameterByName[const AName: string]: string read GetParameterByName write SetParameterByName;
    property Scheme: string read FScheme write SetScheme;
    property Username: string read FUsername write SetUserName;
    property Password: string read FPassword write SetPassword;
    property Host: string read FHost write SetHost;
    property Port: Integer read FPort write FPort;
    property Path: string read FPath write SetPath;
    property Query: string read FQuery write SetQuery;
    property Params: TURIParameters read FParams write SetParams;
    property Fragment: string read FFragment write FFragment;
  end;

C++

struct DECLSPEC_DRECORD TURI
{
private:
    enum class DECLSPEC_DENUM TEncType : unsigned char { URLEnc, FormEnc };
    typedef void __fastcall (__closure *TSchemeDecomposeProc)(const System::UnicodeString AURIStr, int Pos, int Limit, int SlashCount);
private:
    System::UnicodeString FScheme;
    System::UnicodeString FUsername;
    System::UnicodeString FPassword;
    System::UnicodeString FHost;
    int FPort;
    System::UnicodeString FPath;
    System::UnicodeString FQuery;
#ifndef _WIN64
    System::DynamicArray<TNameValuePair> FParams;
#else /* _WIN64 */
    System::TArray__1<TNameValuePair> FParams;
#endif /* _WIN64 */
    System::UnicodeString FFragment;
    void __fastcall DecomposeBaseScheme(const System::UnicodeString AURIStr, int Pos, int Limit, int SlashCount);
    void __fastcall DecomposeNoAuthorityScheme(const System::UnicodeString AURIStr, int Pos, int Limit, int SlashCount);
    bool __fastcall IsMailtoScheme();
    bool __fastcall IsSchemeNoAuthority();
    bool __fastcall IsValidPort();
    int __fastcall GetDefaultPort(const System::UnicodeString AScheme);
    void __fastcall ParseParams(bool Encode = false);
    int __fastcall FindParameterIndex(const System::UnicodeString AName);
    TNameValuePair __fastcall GetParameter(const int I);
    System::UnicodeString __fastcall GetParameterByName(const System::UnicodeString AName);
    void __fastcall SetParameter(const int I, const TNameValuePair &Value);
    void __fastcall SetParameterByName(const System::UnicodeString AName, const System::UnicodeString Value);
    System::UnicodeString __fastcall GetQuery();
    void __fastcall DecomposeURI(const System::UnicodeString AURIStr, bool ARaiseNoSchema);
    void __fastcall SetScheme(const System::UnicodeString Value);
    void __fastcall SetUserName(const System::UnicodeString Value);
    void __fastcall SetPassword(const System::UnicodeString Value);
    void __fastcall SetHost(const System::UnicodeString Value);
    void __fastcall SetPath(const System::UnicodeString Value);
    void __fastcall SetQuery(const System::UnicodeString Value);
#ifndef _WIN64
    void __fastcall SetParams(const System::DynamicArray<TNameValuePair> Value);
#else /* _WIN64 */
    void __fastcall SetParams(const System::TArray__1<TNameValuePair> Value);
#endif /* _WIN64 */
public:
    #define TURI_SCHEME_HTTP L"http"
    #define TURI_SCHEME_HTTPS L"https"
    #define TURI_SCHEME_MAILTO L"mailto"
    #define TURI_SCHEME_NEWS L"news"
    #define TURI_SCHEME_TEL L"tel"
    #define TURI_SCHEME_URN L"urn"
    __fastcall TURI(const System::UnicodeString AURIStr);
    System::UnicodeString __fastcall ToString();
#ifndef _WIN64
    void __fastcall ComposeURI(const System::UnicodeString AScheme, const System::UnicodeString AUsername, const System::UnicodeString APassword, const System::UnicodeString AHostname, int APort, const System::UnicodeString APath, const System::DynamicArray<TNameValuePair> AParams, const System::UnicodeString AFragment);
#else /* _WIN64 */
    void __fastcall ComposeURI(const System::UnicodeString AScheme, const System::UnicodeString AUsername, const System::UnicodeString APassword, const System::UnicodeString AHostname, int APort, const System::UnicodeString APath, const System::TArray__1<TNameValuePair> AParams, const System::UnicodeString AFragment);
#endif /* _WIN64 */
    void __fastcall AddParameter(const System::UnicodeString AName, const System::UnicodeString AValue)/* overload */;
    void __fastcall AddParameter(const TNameValuePair &AParameter)/* overload */;
    void __fastcall DeleteParameter(int AIndex)/* overload */;
    void __fastcall DeleteParameter(const System::UnicodeString AName)/* overload */;
    static System::UnicodeString __fastcall URLEncode _DEPRECATED_ATTRIBUTE1("Use TNetEncoding.URL.Encode") (const System::UnicodeString AValue, bool SpacesAsPlus = false);
    static System::UnicodeString __fastcall URLDecode _DEPRECATED_ATTRIBUTE1("Use TNetEncoding.URL.Decode") (const System::UnicodeString AValue, bool PlusAsSpaces = false);
    System::UnicodeString __fastcall Encode();
    static System::UnicodeString __fastcall UnicodeToIDNA(const System::UnicodeString AHostName);
    static System::UnicodeString __fastcall IDNAToUnicode(const System::UnicodeString AHostName);
    static System::UnicodeString __fastcall PathRelativeToAbs(const System::UnicodeString RelPath, const TURI &Base);
    static System::UnicodeString __fastcall FixupForREST(const System::UnicodeString AURL);
    __property TNameValuePair Parameter[const int I] = {read=GetParameter, write=SetParameter};
    __property System::UnicodeString ParameterByName[const System::UnicodeString AName] = {read=GetParameterByName, write=SetParameterByName};
    __property System::UnicodeString Scheme = {read=FScheme, write=SetScheme};
    __property System::UnicodeString Username = {read=FUsername, write=SetUserName};
    __property System::UnicodeString Password = {read=FPassword, write=SetPassword};
    __property System::UnicodeString Host = {read=FHost, write=SetHost};
    __property int Port = {read=FPort, write=FPort};
    __property System::UnicodeString Path = {read=FPath, write=SetPath};
    __property System::UnicodeString Query = {read=FQuery, write=SetQuery};
#ifndef _WIN64
    __property System::DynamicArray<TNameValuePair> Params = {read=FParams, write=SetParams};
#else /* _WIN64 */
    __property System::TArray__1<TNameValuePair> Params = {read=FParams, write=SetParams};
#endif /* _WIN64 */
    __property System::UnicodeString Fragment = {read=FFragment, write=FFragment};
    TURI() {}
};

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
record
struct
public
System.Net.URLClient.pas
System.Net.URLClient.hpp
System.Net.URLClient System.Net.URLClient

Beschreibung

Record-Typ zum Zusammensetzen/Zerlegen eines URI aus seinen/in seine Bestandteile.

TURI ist ein Record-Typ zum Zusammensetzen/Zerlegen eines URI aus seinen/in seine Bestandteile.

Siehe auch