00001 #ifndef STRING_CONVERSIONS_GROUP
00002 #define STRING_CONVERSIONS_GROUP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00026 using namespace System;
00027 using namespace System::Collections;
00028
00029 #include <basis/istring.h>
00030
00031 namespace hoople_api {
00032
00034 public ref class string_conversions
00035 {
00036 public:
00038
00040 static void convert(const String ^to_convert, istring &result) {
00041 result.reset();
00042 if (const_cast<String ^>(to_convert)->Length > 0) {
00043
00044 cli::array<Byte> ^bytes = System::Text::Encoding::UTF8->GetBytes
00045 (const_cast<String ^>(to_convert));
00046 pin_ptr<const byte> value = &bytes[0];
00047 result = (const char *)value;
00048 value = nullptr;
00049 }
00050 }
00051
00053 static void convert(const istring &to_convert, String ^ %result) {
00054 result = nullptr;
00055 result = gcnew String(to_convert.observe());
00056 }
00057
00058
00059
00060
00061
00063 static istring to_istring(const String ^to_convert) {
00064 istring to_return;
00065 convert(to_convert, to_return);
00066 return to_return;
00067 }
00068
00070 static String ^ to_mstring(const istring &to_convert) {
00071 String ^ to_return;
00072 convert(to_convert, to_return);
00073 return to_return;
00074 }
00075 };
00076 }
00077
00078 #endif
00079