Interface

Interface

Setting and getting properties

Properties()

Constructor for the Properties type.

source
PropertyFiles.setpropFunction.
setprop(prop::Properties, key::String, value::String)

Puts a property into the property-dictionary. Only String keys and values can be used.

source
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.

source
PropertyFiles.getpropFunction.
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.

source
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!.

source

Storing and loading files

PropertyFiles.storeFunction.
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.

source
store(prop::Properties, filename)

Store the property-dictionary in a text file called filename.

source
PropertyFiles.loadFunction.
load(filename)

Load filename propertyfile into a property-dictionary.

source

Overloads from Base

There are a couple of functions that are overloaded for the Properties type. Their documentation can be found here.

Base.haskeyFunction.
haskey(prop::Properties, key::String)

Check if the property-dictionary has the given key. See Base.haskey.

source
Base.delete!Function.
delete!(prop::Properties, key::String)

Delete the pair identified by the given key. See Base.delete!.

source
Base.keysFunction.
keys(prop::Properties)

Return all keys stored in the property-dictionary. See Base.keys.

source
Base.valuesFunction.
values(prop::Properties)

Return all values stored in the property-dictionary. See Base.values.

source
Base.pairsFunction.
pairs(prop::Properties)

Return an iterator over key => value pairs. See Base.pairs.

source
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."

source
Base.keytypeFunction.
keytype(prop::Properties)

Return type of prop's keys. From it's definition it is always String.

source
Base.valtypeFunction.
valtype(prop::Properties)

Return type of prop's values. From it's definition it is always String.

source