Make constant array accessible from different places

Michael Warner michael.warner.ut at gmail.com
Fri Aug 28 17:06:10 UTC 2020


Regina Henschel wrote:
> Hi all,
>
> I need some technical help.
>
> I have a constant array
> const std::pair<OUString, OUString> aApiToLabelFooPairs[] =
> {
>     {"LineStyle", "LabelBorderStyle"},
>    etc.
> }
>
> for to map draw object fill and line property names to data-label 
> related properties of series and points in a chart on ODF import.
>
> I need it in SchXMLSeries2Context::setStylesToSeries and in 
> SchXMLSeries2Context::setStylesToDataPoints.
>
> I have not worked on export yet, so I don't know whether it will be 
> needed on export too.
>
> Where to put this array and how?
>
> I can put it separately from the SchXMLSeries2Context methods into the 
> file SchXMLSeries2Context.cxx. Would that be "static" or not?
>
> Better place?
>
> Kind regards
> Regina

I'm still kind of new to this project, so I don't know if there is some 
kind of convention that applies. But for something like this, I would 
normally make it a private static const field of the class.


More information about the LibreOffice mailing list