using namespace std;
using namespace libconfig;
// This example reads the configuration file 'example.cfg' and displays
// some of its contents.
int main(int argc, char **argv)
{
Config cfg;
// Read the file. If there is an error, report it and exit.
try
{
cfg.readFile("example.cfg");
}
catch(const FileIOException &fioex)
{
std::cerr << "I/O error while reading file." << std::endl;
return(EXIT_FAILURE);
}
catch(const ParseException &pex)
{
std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
<< " - " << pex.getError() << std::endl;
return(EXIT_FAILURE);
}
// Get the store name.
try
{
string name = cfg.lookup("name");
cout << "Store name: " << name << endl << endl;
}
catch(const SettingNotFoundException &nfex)
{
cerr << "No 'name' setting in configuration file." << endl;
}
const Setting& root = cfg.getRoot();
// Output a list of all books in the inventory.
try
{
const Setting &books = root["inventory"]["books"];
int count = books.getLength();
cout << setw(30) << left << "TITLE" << " "
<< setw(30) << left << "AUTHOR" << " "
<< setw(6) << left << "PRICE" << " "
<< "QTY"
<< endl;
for(int i = 0; i < count; ++i)
{
const Setting &book = books[i];
// Only output the record if all of the expected fields are present.
string title, author;
double price;
int qty;
if(!(book.lookupValue("title", title)
&& book.lookupValue("author", author)
&& book.lookupValue("price", price)
&& book.lookupValue("qty", qty)))
continue;
cout << setw(30) << left << title << " "
<< setw(30) << left << author << " "
<< '$' << setw(6) << right << price << " "
<< qty
<< endl;
}
cout << endl;
}
catch(const SettingNotFoundException &nfex)
{
// Ignore.
}
// Output a list of all books in the inventory.
try
{
const Setting &movies = root["inventory"]["movies"];
int count = movies.getLength();
cout << setw(30) << left << "TITLE" << " "
<< setw(10) << left << "MEDIA" << " "
<< setw(6) << left << "PRICE" << " "
<< "QTY"
<< endl;
for(int i = 0; i < count; ++i)
{
const Setting &movie = movies[i];
// Only output the record if all of the expected fields are present.
string title, media;
double price;
int qty;
if(!(movie.lookupValue("title", title)
&& movie.lookupValue("media", media)
&& movie.lookupValue("price", price)
&& movie.lookupValue("qty", qty)))
continue;
cout << setw(30) << left << title << " "
<< setw(10) << left << media << " "
<< '$' << setw(6) << right << price << " "
<< qty
<< endl;
}
cout << endl;
}
catch(const SettingNotFoundException &nfex)
{
// Ignore.
}
return(EXIT_SUCCESS);
}
// eof
pan class='deletions'>-7/+47
|
B+E enhanced port detection
|
|
uh-oh... the last CVS log message messed up things a lot...
|
|
added '-W' to CFLAGS
changed all C++ comments to C ones ('//' => '/* */')
cleaned up a lot of signed/unsigned mistakes
|
|
support for Beckmann+Egle Compact Terminals
some mostly cosmetic changes in the MatrixOrbital and USBLCD driver
added debugging to the generic serial driver
fixed a bug in the generic text driver where icons could be drawn outside
the display bounds
|
|
minor bugfix
|
|
ChangeLog updated
|
|
'const'ified the whole source
|
|
compiler warning in image driver fixed
bar bug in USBLCD driver fixed
|
|
changed plugin_netdev to use the new fast hash model
|
|
hash handling rewritten to solve performance issues
|
|
debug widgets changed (thanks to Andy Baxter)
|
|
splash screen for T6963 driver
|
|
splash screen for X11 driver (and generic graphic driver)
|
|
autoconf/automake updates
|
|
sample debugging widgets added
|
|
added test plugin from Andy Baxter
|
|
do not display end splash screen if quiet=1
|
|
Cwlinux splash screen fixed
USBLCD splash screen fixed
plugin_i2c qprintf("%f") replaced with snprintf()
|
|
chancged splash screen again
|
|
splash screen for all text-based display drivers
|
|
splash screen for HD44780
|
|
prepared support for startup splash screen
|
|
extended contrast range for Crystalfontz
|
|
added i2c_sensors example to lcd4linux.conf.sample
|
|
added documentation tree
|
|
fixed models listing for Beckmann+Egle driver
some cosmetic changes
|
|
some Fixme's processed
documented some code
|
|
made README.Plugins and plugin_sample up to date.
|
|
some cleanups in the MatrixOrbital driver
|
|
fixed lots of bugs in the Cwlinux driver
do not emit EAGAIN error on the first retry
made plugin_i2c_sensors a bit less 'chatty'
moved init and exit functions to the bottom of plugin_pop3
|
|
added NULL display driver (for debugging/profiling purposes)
added backlight/contrast initialisation for matrixOrbital
added Backlight initialisation for Cwlinux
|
|
ChangeLog update
|
|
fixed symlink security issue with the image driver
|
|
fixed possible bugs with user-defined chars (clear high bits)
thanks to Andy Baxter for debugging the MilfordInstruments driver!
|
|
fixed bug in Milford Instruments driver which drew extra graphics chars in
odd places when drawing double bars. (the display doesn't like it if you put
the escape character 0xfe inside a define char sequence).
|
|
Crystalfontz 631 driver finished
|
|
fixed a compiler issue with drv_Image.c (thanks to Frank Stratmann)
|
|
M50530: reset parport signals on exit
plugin_ppp: ppp() has two parameters, not three
lcd4linux.conf.sample: diskstats() corrected
|
|
bug in plugin_diskstats fixed
|
|
added plugin_diskstats.c
|
|
Status and Changelog Update
|