This is an old revision of the document!
Table of Contents
StructString
Knihovna pro manipulaci se strukturovaným řetězcem. Umožňuje jednoduše ukládat a vybírat podle klíčového slova hodnoty z jediného textového řetězce, který svým formátem tak trochu připomíná sled standardních XML tagů.
Autor
Pokud se Vám knihovna líbí, kliknutím na tlačítko Donate můžete přispět na její vývoj.
Spoluautor
Automatická instalace
|
Instalaci doplňku spustíte kliknutím na tlačítko vlevo. Následně budete v prostředí GeoGetu provedeni instalačním procesem. Pro zajištění této funkce je třeba mít na počítači již
nainstalovaný a
spuštěný program GeoGet
.
|
Popis
Knihovna je určena pro vývojáře skriptů. Sama neposkytuje žádnou funkčnost pro GeoGet. Pomocí knihovny můžete ukládat informace do řetězců podobným způsobem, jako byste je ukládali do databáze. S řetězci poté můžete pracovat pomocí připravených metod.
Užití knihovny je vhodné, pokud potřebujete ukládat do tagu ke keši velké množství informací a informace dále upravovat, dotazovat se na jejich přítomnost a hodnotu a podobně.
Reprezentace řetězce uvnitř knihovny
Knihovna se strukturovanými řetězci vnitřně pracuje jako se seznamem (TStrings).
Pro zajištění správné funkčnosti takovéto implementace jsou při ukládání do seznamu některé hodnoty kódovány
- výskyty “ jsou zakódovány jako "e&
- výskyty CRLF jsou zakódovány jako &CrLf&
Ve většině případů se o toto kódování postará knihovna sama. V určitých situacích (viz dokumentace jednotlivých procedur a funkcí) je však třeba, aby zakódování/dekódovaní zajistil sám její uživatel pomocí předpřipravených funkcí.
Obecný příklad
Příklad strukturovaného řetězce a jeho reprezentace pomocí seznamu
- structString: <name1=“value1”/><name2=“value2”/><name3=“value3”/>…
- structStringList: name1,value1,name2,value2,name3,value3…
Konkrétní příklad
Příklad strukturovaného řetězce a jeho reprezentace pomocí seznamu
- structString: <owner=“medwyn_cz”/><owner=“gord”/><project=“StructString”/>
- structStringList: owner,medwyn_cz,owner,gord,project,StructString
Dostupné funkce
Obecné funkce
function StructStringGetList(structString: String): TStrings;
- Function returns StringList of values name1,value1,name2,value2,name3,value3 …
function StructStringDecode(str : String) : String;
- Function decodes string from structString code
function StructStringEncode(str : String) : String;
- Function encodes string into structString code
Nastavování hodnot
procedure StructStringListSetMultipleValues(name : String; value : TStrings ; var structStringList :TStrings; overwrite: boolean);
- Function sets values of given name in the given structStringList. If overwrite is true, all other values of given name will be deleted before
procedure StructStringListSetValue(name,value : String; var structStringList : TStrings; overwrite : boolean);
- Function sets value of given name in the given structStringList. If overwrite is true, all other values of given name will be deleted before
procedure StructStringSetMultipleValues(name : String; value :TStrings; var structString: String; overwrite: boolean);
- Function sets values of given name in the given structString. If overwrite is true, all other values of given name will be deleted before
procedure StructStringSetValue(name,value : String; var structString : String; overwrite: boolean);
- Function sets value of given name in the given structString. If overwrite is true, all other values of given name will be deleted before
Test obsahu
function StructStringContains(name,value,structString : String; regex : boolean) : boolean;
- Does the structString contain the given value? If regex is true, value parameter is handled as regular expression
function StructStringContainsName(name,structString: String) : boolean;
- Does the structString contain value of the given name?
function StructStringListContains(name,value : String; structStringList : TStrings; regex : boolean) : boolean;
- Does the structStringList contain the given value? If regex is true, value parameter is handled as regular expression
function StructStringListContainsName(name: String; structStringList : TStrings) : boolean;
- Does the structStringList contain value of the given name?
Získání uložených hodnot
function StructStringGetMultipleValues(name,structString : String): TStrings;
- Function returns StringList of all values of given name in given structString. Values must be decoded using StructStringDecode before use
function StructStringGetString(structStringList: TStrings) : String;
- Function returns structString of values from structStringList
function StructStringGetValue(name,structString : String) : String;
- Function returns value of first occurence of value of given name in given structString
function StructStringListGetMultipleValues(name : String;structStringList : TStrings): TStrings;
- Function returns StringList of all values of given name in given structStringList. Values must be decoded using StructStringDecode before use
function StructStringListGetValue(name : String;structStringList : TStrings) : String;
- Function returns value of first occurence of value of given name in given structStringList
Mazání hodnot
procedure StructStringDeleteMultipleValues(name : String; var structString : String);
- Function deletes all values of given name in given structString
procedure StructStringDeleteValue(name, value : String; var structString : String);
- Function deletes all values of given name and value in given structString
procedure StructStringListDeleteMultipleValues(name : String; var structStringList :TStrings);
- Function deletes all values of given name in given structStringList
procedure StructStringListDeleteValue(name, value : String; var structStringList : TStrings);
- Function deletes all values of given name and value in given structStringList
Stažení
Seznam dostupných verzí
Filename | Filesize | Last modified |
---|---|---|
structstring-1.1.1.gip | 3.1 KiB | 2011/01/23 00:00 |
structstring-1.1.gip | 11.4 KiB | 2010/10/04 00:00 |
Seznam změn
1.0 (2010/09/07 23:00)
- Úvodní verze
1.1 (2010/10/04 12:00)
- První verze dostupná jako instalační balíček gip