X-Git-Url: http://nitlanguage.org diff --git a/lib/cpp.nit b/lib/cpp.nit index b994a83..78bb96c 100644 --- a/lib/cpp.nit +++ b/lib/cpp.nit @@ -15,18 +15,22 @@ # limitations under the License. # Offers features to interface with C++ code and libraries -module cpp +module cpp is + new_annotation cppflags +end # A pointer to a C++ std::string instance extern class CppString in "C++" `{ std::string* `} end -redef class String - fun to_cpp_string: CppString do return to_cstring.to_cpp_string +redef class Text + # Get `self` as a `CppString` + fun to_cpp_string: CppString do return to_cstring.to_cpp_string(length) end redef class NativeString - fun to_cpp_string: CppString in "C++" `{ - return new std::string(recv); + # Get `self` as a `CppString` + fun to_cpp_string(length: Int): CppString in "C++" `{ + return new std::string(recv, length); `} end