Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 20:45

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



LibConfig++ lists auslesen

Discussion on LibConfig++ lists auslesen within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1

 
マルコ's Avatar
 
elite*gold: 1329
Join Date: Jun 2009
Posts: 1,873
Received Thanks: 960
LibConfig++ lists auslesen

Hey,

ich habe ein kleines Problem. Ich benutze LibConfig (C++ Variante), um ein Config File einzulesen. In dem Config File gibt es Lists. Leider finde ich keine Möglichkeit, diese anzusprechen, um sie nachher mit einer foreach-Schleife durchzuarbeiten.

Eine List im Config File kann z.B. so aussehen:
Code:
inventory =
{
  books = ( { title  = "Treasure Island";
              author = "Robert Louis Stevenson";
              price  = 29.99;
              qty    = 5; },
            { title  = "Snow Crash";
              author = "Neal Stephenson";
              price  = 9.99;
              qty    = 8; }
          );
};
In diesem Beispiel würde ich gerne ['inventory']['books'] zurück bekommen und die Liste auslesen.
In den Beispielen ist nur beschrieben, wie ich neue Einträge zur Liste hinzufüge.
マルコ is offline  
Old 11/13/2012, 17:24   #2
 
elite*gold: 5
Join Date: Sep 2006
Posts: 385
Received Thanks: 218
Kenne die Lib nicht, aber in der Doku steht doch wie das geht.

Gegeben ist . Ganz oben findest du die Liste "window". In der Doku wird das wie folgt angesprochen:

Code:
long width = config.lookup("application.window.size.w");
Oder mit überladenen [] Operator:

Code:
Settings& settings = config.lookup("application.window");
const char* title = settings["title"];
Ziemlich straight forward.
Nightblizard is offline  
Old 11/13/2012, 20:59   #3

 
マルコ's Avatar
 
elite*gold: 1329
Join Date: Jun 2009
Posts: 1,873
Received Thanks: 960
nja. Window ist eine Group. Und hat lauter einzelne Parameter drin. Ich weiß nicht, wie das mit dem von mir geposteten Beispiel funktionieren soll.
Code:
config.lookup("inventory.books.title")
ist nämlich absolut nicht eindeutig!
マルコ is offline  
Old 11/13/2012, 21:33   #4
 
elite*gold: 5
Join Date: Sep 2006
Posts: 385
Received Thanks: 218
Achso, das ist imr vorhin gar nicht aufgefallen, dass das mehrere Einträge hat.
Aber auch das ist im operator [] Teil beschrieben.
Code:
Settings& settings = config.lookup("inventory.books");
const char* title = settings[0]["title"];
Das dürfte es sein.
Nightblizard is offline  
Thanks
1 User
Old 11/13/2012, 22:30   #5

 
マルコ's Avatar
 
elite*gold: 1329
Join Date: Jun 2009
Posts: 1,873
Received Thanks: 960
Ich probiers morgen mal aus.

EDIT: Joa, es funzt! Scheint, als ob ich das irgendwo übersehen hätte^^

Vielen Dank!
マルコ is offline  
Reply

Tags
c++, libconfig, lists


Similar Threads Similar Threads
WTB Lists ( EU 3 - Urzark )
09/10/2012 - Archlord Trading - 1 Replies
Hi ! as a title say i want to buy: - Armor of Benicement 0/3 or stoned - lvl 80 HH staff - chromatic wave staff - empty or ashtalled or scioned or ... price here or pm me
Anyone Got Lists?
01/26/2010 - CO2 Private Server - 3 Replies
hey i was wondering if anyone here has, or has a link to a list or lists containing NPC ID's, Monster ID's, Map ID's etc.. and before anyone says i've already searched :P but havent come across anything! thanks guys :)
More skill lists
06/09/2008 - Lineage 2 - 3 Replies
i neeed more skil lists to my char at elite private server i saw a video in youtube and some orc guy had 3 skil list same time at screen hwo plz tell me ?:confused:
Lists of NPC's
02/03/2008 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 2 Replies
Adrian Alexis Benjamin Bernard Charles Daniel Dennis Gabriel Gustav Rookie Maze
Any new price lists?
04/07/2007 - Conquer Online 2 - 3 Replies
Does any1 have a new price list that they can post? This would be very helpful. The price lists on the conquer forum vary way too much. There is alot of confusion and debate on prices. If any1 can help then +k to them.



All times are GMT +1. The time now is 20:46.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.