Hi all,

I had a need for a "mini properties database" in an app which is using
Scintilla, and decided that the Scintilla one is up to the task -
especially with its macro expansion/replacement capabilities. :)

As it happens, the Scintilla API only makes the SET side of things
visible, so I added SCI_GETPROPERTY, SCI_GETPROPERTYEXPANDED and SCI_GETPROPERTYINT functions. Here are "Scintilla-style" writeups for each:

SCI_GETPROPERTY(const char *key, char *value)

Look up and copy the value of the property named by "key" to buffer
"value" (or return "" if no such property exists).  Return the number
of chars copied - NOT including the terminating NUL.  If you are
unsure of the space requirements of the returned value, pass in a 0
for "value", and the required space (WITHOUT the terminating NUL) will
be returned.

SCI_GETPROPERTYEXPANDED(const char *key, char *value)

Functions the same as SCI_GETPROPERTY, except that the returned string
will have all defined macro expansion/replacement performed.

SCI_GETPROPERTYINT(const char *key, int default)

Look up the property named "key", and if found, attempt to interpret the associated [expanded] value as an integer and return it; if NOT found, return the value passed as "default".

A note on my implementation: as Scintilla currently classifies
SCI_SETPROPERTY as one of the functions conditionally included by
SCI_LEXER, I have added the above three functions to this same grouping. But given that [at least] I see these as being useful independent of lexers, one (i.e., Neil) might want to consider moving all FOUR of the Scintilla "properties" functions out of this grouping - or not.

Note that the above seemed to be the minimum additional functions;
like SciTE, client apps still get to define and implement their own
"persistence" (loading and saving) functionality using these as a base
- but at least now they CAN - with this patched Scintilla. Also, it *is* true that SCI_GETPROPERTYINT is not *required* - but it is convenient, and will be part of this patch unless Neil wants to hold the [API] line at only two added API functions. :)

A zip containing ScintillaBase.cxx and Scintilla.h may be found at

http://www.rftp.com/getprops.zip

Comments?

Robert Roessler
[EMAIL PROTECTED]
http://www.rftp.com


_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to