SomeRanDev / reflaxe.CPP

An alternative C++ target for Haxe that generates dependent-less, GC-less C++17 code.
MIT License
72 stars 5 forks source link

namespace wrong #24

Closed sonygod closed 1 year ago

sonygod commented 1 year ago
package cxx.std.chrono;

import cxx.Auto;

@:cxxStd
@:cppStd
@:nativeName("steady_clock")
@:include("chrono",true)
@:valueType
extern class SteadyClock {
    public static function now(): IAuto;

will generate

auto now = cxx::std::chrono::steady_clock::now();  //cxx:: wrong!

//should be

auto now =std::chrono::steady_clock::now(); 
SomeRanDev commented 1 year ago

In this case, you probably want to use @:native or @:nativeTypeCode.

@:nativeName was a meta I specifically added to retain the Haxe namespaces. But if you use @:native("std::chrono::steady_clock"), that should do the trick!

You can also use @:nativeTypeCode to inject type arguments, check out: https://github.com/RobertBorghese/reflaxe.CPP/blob/main/std/cxx/std/chrono/TimePoint.hx

sonygod commented 1 year ago

yeah.

package cxx.std.chrono;

import cxx.Auto;

@:cxxStd
@:cppStd
@:native("std::chrono::steady_clock")
@:include("chrono",true)
@:valueType
extern class SteadyClock {
    public static function now(): IAuto;

}