ini.man 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. [vset VERSION 0.3]
  2. [comment {-*- tcl -*- doctools manpage}]
  3. [manpage_begin inifile n [vset VERSION]]
  4. [moddesc {Parsing of Windows INI files}]
  5. [titledesc {Parsing of Windows INI files}]
  6. [category {Text processing}]
  7. [require Tcl 8.2]
  8. [require inifile [opt [vset VERSION]]]
  9. [description]
  10. This package provides an interface for easy manipulation of Windows INI files.
  11. [para]
  12. [list_begin definitions]
  13. [call [cmd ::ini::open] [arg file] [opt "[option -encoding] [arg encoding]"] [opt [arg access]]]
  14. Opens an INI file and returns a handle that is used by other commands.
  15. [arg access] is the same as the first form (non POSIX) of the [const open]
  16. command, with the exception that mode [const a] is not supported. The
  17. default mode is [const r+].
  18. [para] The default [arg encoding] is the system encoding.
  19. [call [cmd ::ini::close] [arg ini]]
  20. Close the specified handle. If any changes were made and not written by
  21. [const commit] they are lost.
  22. [call [cmd ::ini::commit] [arg ini]]
  23. Writes the file and all changes to disk. The sections are written in
  24. arbitrary order. The keys in a section are written in alphabetical
  25. order. If the ini was opened in read only mode an error will be thrown.
  26. [call [cmd ::ini::revert] [arg ini]]
  27. Rolls all changes made to the inifile object back to the last
  28. committed state.
  29. [call [cmd ::ini::filename] [arg ini]]
  30. Returns the name of the file the [arg ini] object is associated with.
  31. [call [cmd ::ini::sections] [arg ini]]
  32. Returns a list of all the names of the existing sections in the file handle
  33. specified.
  34. [call [cmd ::ini::keys] [arg ini] [arg section]]
  35. Returns a list of all they key names in the section and file specified.
  36. [call [cmd ::ini::get] [arg ini] [arg section]]
  37. Returns a list of key value pairs that exist in the section and file specified.
  38. [call [cmd ::ini::exists] [arg ini] [arg section] [opt [arg key]]]
  39. Returns a boolean value indicating the existance of the specified section as a
  40. whole or the specified key within that section.
  41. [call [cmd ::ini::value] [arg ini] [arg section] [arg key] [opt [arg default]]]
  42. Returns the value of the named key and section. If specified,
  43. the default value will be returned if the key does not exist. If the key does
  44. not exist and no default is specified an error will be thrown.
  45. [call [cmd ::ini::set] [arg ini] [arg section] [arg key] [arg value]]
  46. Sets the value of the key in the specified section. If the section does not
  47. exist then a new one is created.
  48. [call [cmd ::ini::delete] [arg ini] [arg section] [opt [arg key]]]
  49. Removes the key or the entire section and all its keys. A section is not
  50. automatically deleted when it has no remaining keys.
  51. [call [cmd ::ini::comment] [arg ini] [arg section] [opt [arg key]] [opt [arg text]]]
  52. Reads and modifies comments for sections and keys. To write a section comment use an
  53. empty string for the [arg key]. To remove all comments use an empty string for [arg text].
  54. [arg text] may consist of a list of lines or one single line. Any embedded newlines in
  55. [arg text] are properly handled. Comments may be written to nonexistant
  56. sections or keys and will not return an error. Reading a comment from a nonexistant
  57. section or key will return an empty string.
  58. [call [cmd ::ini::commentchar] [opt char]]
  59. Reads and sets the comment character. Lines that begin with this character are treated as
  60. comments. When comments are written out each line is preceded by this character. The default
  61. is [const \;].
  62. [list_end]
  63. [vset CATEGORY inifile]
  64. [include ../doctools2base/include/feedback.inc]
  65. [manpage_end]