Skip to content

How to add string condition matching judgment to the. stg template? If I add this syntax, it will report an error; Without this condition, the template can be generated normally. I am not very familiar with ST syntax. Can you help me solve this problem #483

@Eternity1987

Description

@Eternity1987
$if(struct.scopedname.first()=="shm_msgs")$`
// Skip NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT for shm_msgs namespace
$else$
#ifndef SWIG
#include <nlohmann/json.hpp>
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT($struct.name$,$\n$$struct.members:{m |$m.name$}; separator=", "$)
#endif
$endif$

or

$if(someflag)$
#include <nlohmann/json.hpp>
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT($struct.name$,$\n$$struct.members:{m |$m.name$}; separator=", "$)
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions