Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ExpandLib

Author:
Jasper van de Gronde

Introduction

ExpandLib is a "library" that makes it possible (if not very easy) to use expandable strings in your programs, like the ones used to specify what the title should look like in the playlist. Only this program supports more advanced strings, using named variables and commands, it even supports different variable types (standard are normal strings and lists of normal strings, but it isn't hard to create other types).

The syntax is similar to that used by the NullSoft Vorbis input plugin. An example: #if(${title};${album}\\\\${artist} - #fpad(${tracknumber};2;0) - ${title};${path} - ${filename}). It would output something like this: Beautifull album\Great artist - 04 - The fourth incredible track. Or if ${title} was undefined: Some kind of path - Some filename. Of course the program using ExpandLib will have to fill-in all these variables, but that's not difficult.

Usage

To use ExpandLib in your program:
  1. Make sure the expandlib directory is in your include path, or the directory one level up.
  2. Include (expandlib/)expandlib-expandable.h, as well as any vartype headers you want to use (normally you would at least want expandlib-vartype-text.h)
  3. Make an expandable object and fill it with a string to be expanded
  4. Create an expandresults object (to give to the expandto function).
  5. Create a map of variables using the expander::expandable::FVarMapType type, and fill it
  6. Call expander::expandable::expandto
  7. Repeat the previous two steps for every set of variables, you don't need to recreate any objects, just reset them and/or refill them

Generated on Tue Feb 4 17:24:13 2003 for ExpandLib by doxygen1.3-rc2