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: Tue, 11 Jan 2005 09:12:39 +0100
User-agent: Mozilla Thunderbird 0.8 (X11/20041012)

Ah, my mistake. The syntax is
stringproperty = {"this"}
stringproperty += {"that"}
stringproperty += {"other", "foo", "bar"}

/martin


Simon Morris wrote:
Hello again Martin,
I just tried the syntax you suggested for a string list property, but
it wouldn't work as the parser complained "missing opening brace for
option 'stringproperty' "
I am using version 2.5 of libconfuse, and my section option flags are
simply CFGF_NODEFAULT.
Could it be related to the fact that this is an option within a section?

Many thanks/best regards,
Simon

On Mon, 10 Jan 2005 15:27:55 +0100, Martin Hedenfalk
<address@hidden> wrote:

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]