Skip to content

Use string values in linkactions

This MR replaces all occurrences of GooString* by std::string in several LinkAction implementations. Incidentally, it replaces various shallow copies in convertLinkActionToLink by deep copies, which should fix issues we currently have with !409 (merged).

There is one open design issue: using pointers allows to have the concept of an "invalid string", whereas using string values does not. The patch currently introduces additional bool flags to mark validity. But there are alternatives:

  • Decide that the empty string is the invalid string. This seems to be done implicitly in various places, but I don't know whether we can make that an official policy.
  • Use something like std::optional. But that is C++17---is it possible to use that at all?

(BTW: LinkGoTo really calls for something like std::variant, but that is C++17, too).

Edited by Oliver Sander

Merge request reports