Provides commonly used methods.
More...
#include <Utils.h>
Provides commonly used methods.
Definition at line 224 of file Utils.h.
static System::DateTime CPPCli::Utils::ConvertCharToDateTime |
( |
char * |
dateTimeString | ) |
|
|
inlinestatic |
Convert a char to a DateTime.
- Parameters
-
dateTimeString | The date string. |
- Returns
- Default DateTime if it fails, else the parsed DateTime.
Definition at line 262 of file Utils.h.
263 System::String^ value =
gcnew System::String(dateTimeString);
264 System::String^ format =
gcnew System::String(
GetDateFormat());
265 if (value == System::String::Empty)
266 return System::DateTime();
268 System::DateTime timeValue;
269 System::Globalization::CultureInfo^ culture = System::Globalization::CultureInfo::InvariantCulture;
270 System::DateTime::TryParseExact(value, format, culture, System::Globalization::DateTimeStyles::None, timeValue);
271 timeValue = System::DateTime::SpecifyKind(timeValue, System::DateTimeKind::Utc);
static const char * GetDateFormat()
static const char* CPPCli::Utils::ConvertDateTimeToChar |
( |
System::DateTime |
dateTime | ) |
|
|
inlinestatic |
Convert a DateTime to a char.
- Parameters
-
- Returns
- The DateTime as a char.
Definition at line 280 of file Utils.h.
281 dateTime = dateTime.ToUniversalTime();
282 System::String^ timeString = dateTime.ToString(
gcnew System::String(
GetDateFormat()));
283 msclr::interop::marshal_context^ ctx =
gcnew msclr::interop::marshal_context();
284 return ctx->marshal_as<
const char*>(timeString);
static const char * GetDateFormat()
static char* CPPCli::Utils::ConvertDateTimeToCharNonConst |
( |
System::DateTime |
dateTime | ) |
|
|
inlinestatic |
Convert a DateTime to a char.
- Parameters
-
- Returns
- The DateTime as a char.
Definition at line 292 of file Utils.h.
293 dateTime = dateTime.ToUniversalTime();
294 System::String^ timeString = dateTime.ToString(
gcnew System::String(
GetDateFormat()));
295 msclr::interop::marshal_context^ ctx =
gcnew msclr::interop::marshal_context();
296 return (
char*)(
void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(timeString);
static const char * GetDateFormat()
static const char* CPPCli::Utils::ConvertDateTimeToTimeChar |
( |
System::DateTime |
dateTime | ) |
|
|
inlinestatic |
Convert a DateTime to a char in TimeOfDay format.
- Parameters
-
- Returns
- The DateTime as a char in TimeOfDay format.
Definition at line 304 of file Utils.h.
305 System::String^ timeString = dateTime.ToString(
gcnew System::String(
"HH:mm:ss"));
306 msclr::interop::marshal_context^ ctx =
gcnew msclr::interop::marshal_context();
307 return ctx->marshal_as<
const char*>(timeString);
static char* CPPCli::Utils::ConvertDateTimeToTimeCharNonConst |
( |
System::DateTime |
dateTime | ) |
|
|
inlinestatic |
Convert a DateTime to a char in TimeOfDay format.
- Parameters
-
- Returns
- The DateTime as a char in TimeOfDay format.
Definition at line 315 of file Utils.h.
316 System::String^ timeString = dateTime.ToString(
gcnew System::String(
"HH:mm:ss"));
317 msclr::interop::marshal_context^ ctx =
gcnew msclr::interop::marshal_context();
318 return (
char*)(
void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(timeString);
static const char* CPPCli::Utils::ConvertSysString |
( |
System::String^ |
sysString | ) |
|
|
inlinestatic |
Convert a system string to a char.
- Parameters
-
sysString | The system string. |
- Returns
- Null if it fails, else the converted string.
Definition at line 233 of file Utils.h.
234 msclr::interop::marshal_context^ ctx =
gcnew msclr::interop::marshal_context();
235 return ctx->marshal_as<
const char*>(sysString);
static char* CPPCli::Utils::ConvertSysStringNonConst |
( |
System::String^ |
sysString | ) |
|
|
inlinestatic |
Convert a system string to a char.
- Parameters
-
sysString | The system string. |
- Returns
- Null if it fails, else the converted string.
Definition at line 243 of file Utils.h.
244 return (
char*)(
void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(sysString);
static std::string CPPCli::Utils::ConvertSysStringStdString |
( |
System::String^ |
sysString | ) |
|
|
inlinestatic |
Convert a system string to a standard string.
- Parameters
-
sysString | The system string. |
- Returns
- Null if it fails, else the converted string.
Definition at line 252 of file Utils.h.
253 msclr::interop::marshal_context^ ctx =
gcnew msclr::interop::marshal_context();
254 return ctx->marshal_as<std::string>(sysString);
static System::DateTime CPPCli::Utils::ConvertTimeCharToDateTime |
( |
char * |
timeString | ) |
|
|
inlinestatic |
Convert a char to a DateTime using TimeOfDay format.
- Parameters
-
timeString | The time string. |
- Returns
- Default DateTime if it fails, else the parsed DateTime.
Definition at line 326 of file Utils.h.
327 System::DateTime parsedTime;
328 System::String^ value =
gcnew System::String(timeString);
329 if (value == System::String::Empty)
332 array<System::String^>^ formats =
gcnew array<System::String^>(2);
333 formats[0] =
gcnew System::String(
"HH:mm:ss");
334 formats[1] =
gcnew System::String(
"HH:mm:ss.fff");
335 System::DateTime::TryParseExact(value, formats, System::Globalization::CultureInfo::InvariantCulture, System::Globalization::DateTimeStyles::None, parsedTime);
static const char* CPPCli::Utils::GetDateFormat |
( |
| ) |
|
|
inlinestatic |
Definition at line 226 of file Utils.h.
226 {
return "yyyy-MM-dd'T'HH:mm:ss.fff'Z'"; }
The documentation for this class was generated from the following file:
- C:/Git/VxSDK-Samples/CSharpSample/CSharpWrapper/Include/Utils.h