Personal tools
Namespaces

Variants
Actions

Category:Libniftyprefs

From NiftyWiki
Jump to: navigation, search
Home Documentation Download Support Showroom Links
lightweight library to handle preferences for arbitrary (tree) objects using XML Flattr-badge-large.png


Features

  • uses libxml
  • include external files using XInclude
  • "modelless" - snapshot objects on-the-fly


Abstract

Libniftyprefs provides functionality to load, save and process persistant preferences as XML data. Just register one or more "object classes" where you define a object-to-preferences function and a preferences-to-object function for that class of objects. Then you can pass the (void *) pointer of your object together with the printable name of the object-class to generate a "XML snapshot" of that object. You can also pass XML preferences of an object to receive a freshly generated object.


Installation

Debian

If not done, yet:

  • import archive key (Fingerprint: 895D 8086 8FEF 100C DA82 0393 16CC 4680 AA46 5E22):
wget -qO - http://debian.niftylight.de/archive.key | sudo apt-key add -
  • register niftylight package source in /etc/apt/sources.list:
deb http://debian.niftylight.de/ unstable main
deb-src http://debian.niftylight.de/ unstable main
  • update
sudo apt-get update


to install, run:

sudo apt-get install libniftyprefs


Gentoo

Emerge layman if you don't have it already.

emerge -va layman

Add the niftyled overlay (if you don't have already)

layman -f -o http://gentoo.niftylight.de/layman.xml -a niftyled

Emerge:

emerge --autounmask-write niftyprefs


Compile manually

Prerequisites

to compile from sources:

  • compiler e.g. gcc
  • autotools (autoconf, autoheader, ...)
  • niftylog + dev headers
  • libxml2 + dev headers

to run:


Get sources

Git: git clone git://github.com/niftylight/niftyprefs.git
ZIP-Archive: https://github.com/niftylight/niftyprefs/zipball/master
Browse: github.com.


Compile

If your OS doesn't include the default install prefix, you might have to do that yourself before compiling:

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
export LD_LIBRARY_PATH="/usr/local/lib"
export PATH="${PATH}:/usr/local/bin"


to compile & install, cd into the source directory and run:

autoreconf -is
mkdir build
cd build
../configure
make
sudo make install


If you don't want to install to the default location (/usr/local), you can choose a different install prefix, e.g.:

./configure --prefix=/usr


To freshly rebuild a previously built tree, do (you can skip this if you just checked out the sources):

make maintainer-clean
or just remove all contents of the build directory and repeat the previous steps.


See additional compile time options by running:

./configure --help


Usage

add

#include "<niftyprefs.h>"

to your source and compile like:

gcc -o yourprog yourprog.c `pkg-config --cflags --libs niftyprefs`


Further documentation


Issues

Please report anything via the issue tracker.


Changes

This category currently contains no pages or media.