Skip to content

kdwsdl2cpp generates invalid identifiers for special characters in enum values #321

Description

@flyx

Given this enum type:

        <xs:simpleType name="unit_enum">
		<xs:restriction base="xs:string">
			<xs:maxLength value="4"/>
			<xs:enumeration value="cm"/>
			<xs:enumeration value="m³/s"/>
			<xs:enumeration value="h"/>
			<xs:enumeration value="km/h"/>
			<xs:enumeration value="kW"/>
			<xs:enumeration value="m/s"/>
			<xs:enumeration value="mm/h"/>
			<xs:enumeration value="°C"/>
		</xs:restriction>
	</xs:simpleType>

kdwsdl2cpp generates the following:

class NTS__Unit_enum
{
public:
    enum Type {
        Cm, 
        M³_s, 
        H, 
        Km_h, 
        KW, 
        M_s, 
        Mm_h, 
        °C
    };


public:
    NTS__Unit_enum( const Type &type );
    void setType( Type type );
    NTS__Unit_enum::Type type() const;
    operator Type() const;
    QString stringValue() const;
    KDSoapValue serialize( const QString& valueName ) const;
    void deserialize( const KDSoapValue& mainValue );
    NTS__Unit_enum();
    ~NTS__Unit_enum();

private:
    Type mType;
};

Neither ³ nor ° are valid within C++ identifiers. kdwsdl2cpp should replace or drop them in some way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions