Logo
SharpKmyCore.h
1// SharpKmyCore.h
2
3#pragma once
4using namespace System;
5
6#using <System.Drawing.dll>
7
8namespace SharpKmyBase {
9
10 public ref class PerformanceMeter
11 {
12 public:
13 static IntPtr begin(System::String^ name, System::Drawing::Color c);
14 static void end(IntPtr p);
15 static void showCpu(bool flg);
16
17 ref class AutoPeriod
18 {
19 public:
20 AutoPeriod(System::String^ name) {
21 ptr = begin(name, System::Drawing::Color::Red);
22 }
24 end(ptr);
25 }
26 IntPtr ptr = IntPtr::Zero;
27 };
28 };
29
30 private ref class StringConv
31 {
32 public:
33 static std::string convert(System::String^ s)
34 {
35 if (s->Length == 0) {
36 return std::string("");
37 }
38
39 System::Text::Encoding^ utf8 = System::Text::Encoding::UTF8;
40 array<byte>^ utf8path = utf8->GetBytes(s);
41 pin_ptr<byte> pinnedText = &utf8path[0];
42 const char* p = (const char*)pinnedText;
43
44 auto r = std::string(p, utf8path->Length);
45 pinnedText = nullptr;
46 return r;
47 }
48
49 static String^ New(std::string s)
50 {
51 System::Text::Encoding^ utf8 = System::Text::Encoding::UTF8;
52 return gcnew System::String(s.c_str(), 0, (int)s.length(), utf8);
53 }
54 };
55}
Definition: SharpKmyCore.h:18
AutoPeriod(System::String^ name)
Definition: SharpKmyCore.h:20
IntPtr ptr
Definition: SharpKmyCore.h:26
~AutoPeriod()
Definition: SharpKmyCore.h:23
Definition: SharpKmyCore.h:11
static void showCpu(bool flg)
Definition: SharpKmyCore.cpp:22
static void end(IntPtr p)
Definition: SharpKmyCore.cpp:17
static IntPtr begin(System::String^ name, System::Drawing::Color c)
Definition: SharpKmyCore.cpp:11
Definition: SharpKmyCore.h:31
static String New(std::string s)
Definition: SharpKmyCore.h:49
static std::string convert(System::String^ s)
Definition: SharpKmyCore.h:33
Definition: Guid.cpp:4