confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Confuse-devel] libconfuse 2.5 and CFGF_MULTI


From: Martin Hedenfalk
Subject: Re: [Confuse-devel] libconfuse 2.5 and CFGF_MULTI
Date: Mon, 10 Jan 2005 15:27:55 +0100
User-agent: Mozilla Thunderbird 0.8 (X11/20041012)

No, you must use a string list. The CFGF_MULTI flag only applies to sections.

If you define stringproperty as a string list, you can use the += syntax:

section "test" {
  stringproperty = "this"
  stringproperty += "that"
  stringproperty += "other"
}

The first occurance of stringproperty = "this" will overwrite any default value and set the string list to one element ("this"). The other assignment will add the values to the string list, resulting in a cfg_size() of 3.

/martin

Simon Morris wrote:
Hi, Is it possible to determine if an option has been set multiple times
within a section?


for example:

section "test" {
       stringproperty = "this"
       stringproperty = "that"
       stringproperty = "other"
}

I would like to know that there are 3 values for the "stringproperty"
option in this section, and act accordingly.

I tried attaching CFGF_MULTI to the option, and checking the option
size, but it is always one, and defined as the last value parsed
("other")

I'll just use a string list if this isn't possible but it would suit
my system better to do the above just now.

Many thanks,
Simon


_______________________________________________
Confuse-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/confuse-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]