All Projects → ezequieljuliano → PropertiesFile4Delphi

ezequieljuliano / PropertiesFile4Delphi

Licence: Apache-2.0 license
Library for managing configuration files with key-value syntax

Programming Languages

pascal
1382 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to PropertiesFile4Delphi

Lychee
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.
Stars: ✭ 102 (+500%)
Mutual labels:  mapping, properties
profig
Powerful configuration management for Scala (JSON, properties, command-line arguments, and environment variables)
Stars: ✭ 25 (+47.06%)
Mutual labels:  configuration, properties
go-contrib
Helper for Log configuration, Mixin for properties with fangs
Stars: ✭ 20 (+17.65%)
Mutual labels:  configuration, properties
goconfig
.gitconfig syntax parser
Stars: ✭ 15 (-11.76%)
Mutual labels:  configuration, properties
Konf
A type-safe cascading configuration library for Kotlin/Java/Android, supporting most configuration formats
Stars: ✭ 225 (+1223.53%)
Mutual labels:  configuration, properties
Confucius
A lightweight Java configuration library
Stars: ✭ 51 (+200%)
Mutual labels:  configuration, properties
easy-props
The simple, stupid properties library for Java
Stars: ✭ 76 (+347.06%)
Mutual labels:  configuration, properties
Konfig
Simple config properties API for Kotlin
Stars: ✭ 249 (+1364.71%)
Mutual labels:  configuration, properties
javaproperties
Python library for reading & writing Java .properties files
Stars: ✭ 20 (+17.65%)
Mutual labels:  configuration, properties
swiss-army
Ansible-driven configuration management for maintaining a preferred environment (base system and app dotfiles / configurations)
Stars: ✭ 44 (+158.82%)
Mutual labels:  configuration
jsfiddle-github
JSFiddle implementation for interactive JavaScript examples.
Stars: ✭ 16 (-5.88%)
Mutual labels:  mapping
leafmap
A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
Stars: ✭ 1,299 (+7541.18%)
Mutual labels:  mapping
dot-emacs
Emacs configuration
Stars: ✭ 23 (+35.29%)
Mutual labels:  configuration
wordpress-geo-mashup
Official repository for Geo Mashup, the plugin that makes WordPress into a GeoCMS. Documentation:
Stars: ✭ 60 (+252.94%)
Mutual labels:  mapping
slamkit
SLAM Kit
Stars: ✭ 28 (+64.71%)
Mutual labels:  mapping
climatecontrol
Python library for loading settings and config data from files and environment variables
Stars: ✭ 20 (+17.65%)
Mutual labels:  configuration
dotfiles
An elegant way to manage dotfiles, commands, completions, configurations for terminal players.
Stars: ✭ 27 (+58.82%)
Mutual labels:  configuration
GMT.jl
Generic Mapping Tools Library Wrapper for Julia
Stars: ✭ 148 (+770.59%)
Mutual labels:  mapping
SemanticExtraSpecialProperties
Provides extra special properties to Semantic MediaWiki.
Stars: ✭ 24 (+41.18%)
Mutual labels:  properties
r-geo-course
An introductory course on using R for geographic data visualisation and analysis (in Russian).
Stars: ✭ 18 (+5.88%)
Mutual labels:  mapping

Properties File For Delphi

The PropertiesFile4Delphi consists of a library for handling key=value format configuration files.

About The Project

Many times, for various reasons, it is necessary to parameterize the application starting from a configuration mechanism. In Delphi is common to use INI files to store the settings, but working with these files is a bit repetitive and unproductive. The API PropertiesFile4Delphi facilitates this work with configuration files replacing the use of INI files. It is an API to manage simple text files, which are written with the key=value syntax, storing a unique key per line.

Key Features

  • Store and load data via simplified interface;
  • Map configuration files to simplified classes.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

To use this library an updated version of Delphi IDE (XE or higher) is required.

Installation

Clone the repo

git clone https://github.com/ezequieljuliano/PropertiesFile4Delphi.git

Add the "Search Path" of your IDE or your project the following directories:

PropertiesFile4Delphi\src

Usage

Create or edit configuration files by declaring a variable of type IPropertiesFile and using the TPropertiesFileStorage implementation:

Saving a Properties File

uses
  
  PropertiesFile,
  PropertiesFile.Storage;

procedure Save;
var
  propertiesFile: IPropertiesFile;
begin
  propertiesFile := TPropertiesFileStorage.Create;
  propertiesFile.PropertyItem['app.title'] := 'Properties File For Delphi';
  propertiesFile.PropertyItem['app.version'] := '1.0.0';
  propertiesFile.SaveToFile('application.properties');
end;

Loading a Properties File

uses
  
  PropertiesFile,
  PropertiesFile.Storage;

procedure Load;
var
  propertiesFile: IPropertiesFile;
begin
  propertiesFile := TPropertiesFileStorage.Create;
  propertiesFile.LoadFromFile('application.properties');
  Self.Caption := propertiesFile.PropertyItem['app.title'] + '-' + propertiesFile.PropertyItem['app.version'];
end;

Mapping Support and Configuration Classes

PropertiesFile4Delphi library provides a set of mapping classes. This way you can work directly with classes rather than getting manipulating files in your source code. The first step to using the configuration mechanism in an application is to create a specific class to store the desired parameters and write it down with [PropertiesFile] and inherit TPropertiesFileObject class.

Mapping example:

uses
  
  PropertiesFile.Mapping;

type

  [PropertiesFile('security.properties')]
  TSecurityConfig = class(TPropertiesFileObject)
  private
    [NotNull]
    [PropertyItem('username')]
    fUsername: string;

    [NotNull]
    [PropertyItem('password')]
    fPassword: string;
  public
    property Username: string read fUsername write fUsername;
    property Password: string read fPassword write fPassword;
  end;

When the class is destroyed the file is automatically saved:

procedure Load;
var
  securityConfig: TSecurityConfig;
begin
  securityConfig := TSecurityConfig.Create;
  try
    securityConfig.Username := 'admin';
    securityConfig.Password := 'admin';
  finally
    securityConfig.Free;
  end;
end;

When instantiating the class the data is loaded:

procedure Login;
var
  securityConfig: TSecurityConfig;
begin
  securityConfig := TSecurityConfig.Create;
  try
    Login(securityConfig.Username, securityConfig.Password);
  finally
    securityConfig.Free;
  end;
end;

Supported field mappings:

  • PropertyItem: alias field definition;
  • NotNull: mandatory field definition;
  • Ignore: Fields that should be ignored;
  • ReadOnly: Fields that are read-only (can be applied at class level).

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the APACHE LICENSE. See LICENSE for more information.

Contact

To contact us use the options:

Project Link

https://github.com/ezequieljuliano/PropertiesFile4Delphi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].