comparison Core/Toolbox.cpp @ 473:c9a5d72f8481

changing the namespace of HTTP enumerations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Jul 2013 17:22:13 +0200
parents 30086c1aca30
children a9693dc7089c
comparison
equal deleted inserted replaced
472:722b56b99093 473:c9a5d72f8481
130 static bool finish; 130 static bool finish;
131 131
132 #if defined(_WIN32) 132 #if defined(_WIN32)
133 static BOOL WINAPI ConsoleControlHandler(DWORD dwCtrlType) 133 static BOOL WINAPI ConsoleControlHandler(DWORD dwCtrlType)
134 { 134 {
135 // http://msdn.microsoft.com/en-us/library/ms683242(v=vs.85).aspx 135 // http://msdn.microsoft.com/en-us/library/ms683242(v=vs.85).aspx
136 finish = true; 136 finish = true;
137 return true; 137 return true;
138 } 138 }
139 #else 139 #else
140 static void SignalHandler(int) 140 static void SignalHandler(int)
141 { 141 {
142 finish = true; 142 finish = true;
167 167
168 168
169 void Toolbox::ServerBarrier() 169 void Toolbox::ServerBarrier()
170 { 170 {
171 #if defined(_WIN32) 171 #if defined(_WIN32)
172 SetConsoleCtrlHandler(ConsoleControlHandler, true); 172 SetConsoleCtrlHandler(ConsoleControlHandler, true);
173 #else 173 #else
174 signal(SIGINT, SignalHandler); 174 signal(SIGINT, SignalHandler);
175 signal(SIGQUIT, SignalHandler); 175 signal(SIGQUIT, SignalHandler);
176 #endif 176 #endif
177 177
180 { 180 {
181 USleep(100000); 181 USleep(100000);
182 } 182 }
183 183
184 #if defined(_WIN32) 184 #if defined(_WIN32)
185 SetConsoleCtrlHandler(ConsoleControlHandler, false); 185 SetConsoleCtrlHandler(ConsoleControlHandler, false);
186 #else 186 #else
187 signal(SIGINT, NULL); 187 signal(SIGINT, NULL);
188 signal(SIGQUIT, NULL); 188 signal(SIGQUIT, NULL);
189 #endif 189 #endif
190 } 190 }
695 695
696 default: 696 default:
697 throw OrthancException(ErrorCode_NotImplemented); 697 throw OrthancException(ErrorCode_NotImplemented);
698 } 698 }
699 } 699 }
700
701
702 const char* Toolbox::ToString(HttpMethod method)
703 {
704 switch (method)
705 {
706 case HttpMethod_Get:
707 return "GET";
708
709 case HttpMethod_Post:
710 return "POST";
711
712 case HttpMethod_Delete:
713 return "DELETE";
714
715 case HttpMethod_Put:
716 return "PUT";
717
718 default:
719 return "?";
720 }
721 }
700 } 722 }