Interface
Setting and getting properties
PropertyFiles.Properties
— Type.Properties()
Constructor for the Properties
type.
PropertyFiles.setprop
— Function.setprop(prop::Properties, key::String, value::String)
Puts a property into the property-dictionary. Only String
keys and values can be used.
setprop(prop::Properties, key::String, value)
Puts a property into the property-dictionary. The string()
constructor is used to convert non-string values to string. The property-dictionary is not returned.
PropertyFiles.getprop
— Function.getprop(prop::Properties, key::String, default::Union{String,Nothing}=nothing)
Return the value stored for the given key or the given default value, if there's no such key. If the key does not exists and no default value is given, nothing
will be returned.
PropertyFiles.getprop!
— Function.getprop!(prop::Properties, key::String, default::String)
Return the value stored for the given key. If there's no such key, add the key=>default
pair to the property-dictionary. See Base.get!
.
Storing and loading files
PropertyFiles.store
— Function.store(prop::Properties, filename, comment::Union{String,Nothing})
Store the property-dictionary in a text file called filename
. Additional comment can be added, that will be written to the beginning of the file.
store(prop::Properties, filename)
Store the property-dictionary in a text file called filename
.
PropertyFiles.load
— Function.load(filename)
Load filename
propertyfile into a property-dictionary.
Overloads from Base
There are a couple of functions that are overloaded for the Properties
type. Their documentation can be found here.
Base.haskey
— Function.haskey(prop::Properties, key::String)
Check if the property-dictionary has the given key. See Base.haskey
.
Base.delete!
— Function.delete!(prop::Properties, key::String)
Delete the pair identified by the given key. See Base.delete!
.
Base.keys
— Function.keys(prop::Properties)
Return all keys stored in the property-dictionary. See Base.keys
.
Base.values
— Function.values(prop::Properties)
Return all values stored in the property-dictionary. See Base.values
.
Base.pairs
— Function.pairs(prop::Properties)
Return an iterator over key => value
pairs. See Base.pairs
.
Base.sizehint!
— Function.function sizehint!(prop::Properties, n::Integer)
From the Base
docs: "Suggest that collection prop
reserve capacity for at least n
elements. This can improve performance."
Base.keytype
— Function.keytype(prop::Properties)
Return type of prop
's keys. From it's definition it is always String
.
Base.valtype
— Function.valtype(prop::Properties)
Return type of prop
's values. From it's definition it is always String
.