GeoGet

Complete geocaching solutions

User Tools

Site Tools


user:skript:structstring

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:skript:structstring [2010/09/08 12:09] gorduser:skript:structstring [2021/05/02 19:01] (current) – [Stažení] mikrom
Line 1: Line 1:
 ====== StructString ====== ====== StructString ======
-Knihovna pro manipulaci se strukturovaným stringem. Umožňuje tak jednoduše ukládaá a vybírat podle klíčového slova hodnoty z jediného textového řetězu, který svým formátem tak trochu připomíná sled standardních XML tagů.+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 ===== ===== Autor =====
-**[[http://www.geocaching.com/profile/?u=medwyn_cz|medwyn_cz]], elektronická(zavináč)adresa(tečka)cz** +|**[[http://www.geocaching.com/profile/?u=medwyn_cz|medwyn_cz]], [[mailto:medwyn@seznam.cz|medwyn_cz]]** | ~~PAYPAL business="kopecky@klfree.net" message="Prispevek na skript: StructString"~~ | 
-   +Pokud se Vám knihovna líbíkliknutím na tlačítko Donate můžete přispět na její vývoj. 
-Spoluautorkterý to sem nacpal:  + 
-   +//Nekamarádíte se s PayPalem? Napište mi [[mailto:medwyn@seznam.cz|email]] a domluvíme se na jiném způsobu, třeba převodu na účet.// 
-**[[http://www.geocaching.com/profile/?u=gordici|Gord]], [[mailto:gord@atlas.cz|Gord]]**  + 
- +Na specifikaci požadovaných funkcí se podílel i **[[http://www.geocaching.com/profile/?u=gordici|Gord]]**  
 + 
 +===== Automatická instalace ===== 
 +~~GEOGET_INSTALL~~
  
 ===== Popis ===== ===== Popis =====
-Knihovna poskytuje funkce pro práci se strukturovanými textovými řetězi ve tvaru+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.
  
-<code> +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ě
-<name1="value1"/><name2="value2"/><name3="value3"/>... +
-</code>+
  
 +==== 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 **&quote&**
 +   * výskyty **CRLF** jsou zakódovány jako **&CrLf&**   
  
-==== Ukázka ==== +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í.
-FIXME Pokud je to možné a vhodné, měl by popis obsahovat i snímky obrazovek - jak vypadají ovládací dialogy skriptu, jak vypadají výstupy exportu a podobně.+
  
-===== Instalace ===== +=== Obecný příklad === 
-Knihovna se instaluje standardním postupem jako balíček pomocí Správce pluginů.+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 === 
 +<code delphi>function StructStringGetList(structString: String): TStrings;</code> 
 +   * Function returns StringList of values name1,value1,name2,value2,name3,value3 ... 
 +   
 +<code delphi>function StructStringDecode(str : String) : String;</code> 
 +   * Function decodes string from structString code 
 + 
 +<code delphi>function StructStringEncode(str : String) : String;</code> 
 +   * Function encodes string into structString code 
 + 
 +=== Nastavování hodnot === 
 +<code delphi>procedure StructStringListSetMultipleValues(name : String; value : TStrings ; var structStringList :TStrings; overwrite: boolean);</code> 
 +   * Function sets values of given name in the given structStringList. If overwrite is true, all other values of given name will be deleted before 
 + 
 +<code delphi>procedure StructStringListSetValue(name,value : String; var structStringList : TStrings; overwrite : boolean);</code> 
 +   * Function sets value of given name in the given structStringList. If overwrite is true, all other values of given name will be deleted before 
 + 
 +<code delphi>procedure StructStringSetMultipleValues(name : String; value :TStrings; var structString: String; overwrite: boolean);</code> 
 +   * Function sets values of given name in the given structString. If overwrite is true, all other values of given name will be deleted before 
 + 
 +<code delphi>procedure StructStringSetValue(name,value : String; var structString : String; overwrite: boolean);</code> 
 +   * 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 === 
 +<code delphi>function StructStringContains(name,value,structString : String; regex : boolean) : boolean;</code> 
 +   * Does the structString contain the given value? If regex is true, value parameter is handled as regular expression 
 + 
 +<code delphi>function StructStringContainsName(name,structString: String) : boolean;</code> 
 +   * Does the structString contain value of the given name? 
 + 
 +<code delphi>function StructStringListContains(name,value : String; structStringList : TStrings; regex : boolean) : boolean;</code> 
 +   * Does the structStringList contain the given value? If regex is true, value parameter is handled as regular expression 
 + 
 +<code delphi>function StructStringListContainsName(name: String; structStringList : TStrings) : boolean;</code> 
 +   * Does the structStringList contain value of the given name?        
 + 
 +=== Získání uložených hodnot === 
 +<code delphi>function StructStringGetMultipleValues(name,structString : String): TStrings;</code> 
 +   * Function returns StringList of all values of given name in given structString. Values must be decoded using StructStringDecode before use 
 + 
 +<code delphi>function StructStringGetString(structStringList: TStrings) : String;</code> 
 +   * Function returns structString of values from structStringList 
 + 
 +<code delphi>function StructStringGetValue(name,structString : String) : String;</code> 
 +   * Function returns value of first occurence of value of given name in given structString 
 + 
 +<code delphi>function StructStringListGetMultipleValues(name : String;structStringList : TStrings): TStrings;</code> 
 +   * Function returns StringList of all values of given name in given structStringList. Values must be decoded using StructStringDecode before use 
 + 
 +<code delphi>function StructStringListGetValue(name : String;structStringList : TStrings) : String;</code> 
 +   * Function returns value of first occurence of value of given name in given structStringList 
 + 
 +=== Mazání hodnot === 
 +<code delphi>procedure StructStringDeleteMultipleValues(name : String; var structString : String);</code> 
 +   * Function deletes all values of given name in given structString 
 +       
 +<code delphi>procedure StructStringDeleteValue(name, value : String; var structString : String);</code> 
 +   * Function deletes all values of given name and value in given structString  
 +  
 +<code delphi>procedure StructStringListDeleteMultipleValues(name : String; var structStringList :TStrings);</code> 
 +   * Function deletes all values of given name in given structStringList  
 + 
 +<code delphi>procedure StructStringListDeleteValue(name, value : String; var structStringList : TStrings);</code> 
 +   * Function deletes all values of given name and value in given structStringList 
 + 
 +===== Seznam skriptů, které používají tuto knihovnu ===== 
 +{{topic>uses_structstring}} 
 + 
 +Pokud jste narazili na skript, který knihovnu používá, ale není zde uveden, kontaktujte, prosím, autory.
  
 ===== Stažení ===== ===== Stažení =====
-<box round 95% #DEE7EC+<WRAP round download
-:!: Stáhnout nejaktuálnější verzi: ~~DOWNLOAD structstring-*.gip highest~~ +Stáhnout aktuální verzi: ~~DOWNLOAD structstring-*.gip highest~~ 
-</box>+</WRAP>
  
 ==== Seznam dostupných verzí ==== ==== Seznam dostupných verzí ====
-{{filelist>structstring:*.[gz]ip&style=table&tableheader=1&tableshowdate=1&sort=mtime}}+{{filelist>structstring:*.gip&style=table&tableheader=1&tableshowdate=1&sort=mtime}}
  
-==== Changelog ==== +===== Seznam změn =====       
-=== 1.(2010/09/07 23:00) === +=== 1.1.1 (2010/01/23 16:00) === 
-   Úvodní verze           +   Upravena instalace - do samostaneho adresare v lib\ 
-=== 1.1 (2010/09/07 23:00) === +   doplněna možnost použití knihovny jako **unit**
-   První verze dostupná jako **gip**          +
  
-<hidden onHidden=":!: **Zobrazit změny ve starších verzích**" onVisible="Skrýt změny ve starších verzích"> +=== 1.(2010/10/04 12:00) === 
-=== 0.(Datum) === +   První verze dostupná jako instalační balíček **gip**           
-   Případné dřívější verze. Pokud je seznam změn příliš dlouhý, je vhodné starší verze skrýt pomocí tagu hidden. Pro jejich zobrazení bude muset uživatel kliknout na tlačířko **Zobrazit změny ve starších verzích**  + 
-</hidden>+=== 1.0 (2010/09/07 23:00) === 
 +   * Úvodní verze
  
-{{tag>skript lib}}+{{tag>author_medwyn skript lib}}
user/skript/structstring.1283940587.txt.gz · Last modified: 2010/09/08 00:00 (external edit)