KDSoap icon indicating copy to clipboard operation
KDSoap copied to clipboard

kdwsdl2cpp generates invalid identifiers for special characters in enum values

Open flyx opened this issue 6 months ago • 0 comments

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.

flyx avatar Aug 07 '25 14:08 flyx