]> git.phdru.name Git - m_lib.git/blob - README-flad.txt
Use int() instead of atoi() for Py3 compatibility
[m_lib.git] / README-flad.txt
1
2                  Flat ASCII Database and config files modules
3
4    FLAD is family of modules for manipulating Flat ASCII Databases.
5 Flat ASCII Database is just a text file with strucrured information. For
6 example, flad/fladm modules operates on the following files:
7
8    # Global comment/header for the entire file
9    # It is possible to insert empty line after header
10
11    Name: Orion
12    Type: URL
13    URL: http://www.orion.web/
14
15    Name: NRSC
16    Type: Med domain
17    Domain type: N/A
18
19    Well, I hope you get the idea. The database is just a list of records;
20 records are key/value pairs separated by key_sep (flad/fladm/fladc default is
21 ": ", fladw default is "=", but this can be easyly changed); records are
22 usually separated by empty line (fladw use different syntax).
23
24 COPYRIGHT and LEGAL ISSUES
25    The software is copyrighted and free. All  programs  copyrighted by
26 PhiloSoft Design. Programs are provided "as-is", without any kind of
27 warranty.
28    #include "disclaimer.h"
29
30 -------------------------------- flad --------------------------------
31
32    flad.py defines the base object, Flad. The object is real FLADatabase,
33 and it serves as parent for most FLAD objects. This object provides
34 framework for checking (during append/insert operations) every record. The
35 module itself is not using it, but fladm (see below) make use of the
36 feature.
37    The database is a list (UserList, actually) of records, where every
38 record is just a dictionary mapping keys to values. Keys and values are
39 just strings (this is not enforced; loading from file create a dictionaries
40 of string, after loading user can add/change values; but storing to file
41 routines are expecting string values again).
42
43 -------------------------------- fladm -------------------------------
44
45    fladm.py defines the object Flad_WithMustKeys. This is inherently FLAD
46 with restriction. User should define two set of keys - keys that must be in
47 every record, and keys that can be. If there are no "must" keys - "other"
48 keys don't matter. If there are "must" keys, but not "other" keys - every
49 "must" key must be in every record, but any record can contain any key. If
50 there are both "must" keys and "other" keys - every record must contain all
51 "must" keys and some or all of "other" keys, but not other. To create
52 database with only "must" keys, make "other" keys empty list - []!
53
54 -------------------------------- fladc -------------------------------
55
56    fladc.py defines the object Flad_Conf. This is FLAD object to manipulate
57 config files. Config file is just a FLAD file with EXACTLY one record - one
58 dictionary of properties, that can be used to query and store properties.
59 The resulting dictionary can be saved as FLAD file.
60
61 -------------------------------- fladw -------------------------------
62
63    fladw.py defines object Flad_WIni to retrieve, manipulate and store
64 WIN.INI-like files.
65    General rules for the object is the same - there are routines to load it
66 from file and store back, but algorithms are quite different. Records are
67 sections; sections are separated by section names - [section_name], e.g.
68    Every record in Flad_WIni is tuple
69 (section_name_string, [list_of_comments_and_keys], {dict_of_key-to-value_mapping}).
70    There are procedures to add/remove sections, add/del/change/query key values.