changeset 269:0dfa83535cd7 am-2

indentation
author am@osimis.io
date Wed, 22 Aug 2018 15:22:33 +0200
parents 5bd4161bf11b
children 2d64f4d39610
files Framework/Toolbox/IWebService.h
diffstat 1 files changed, 91 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Toolbox/IWebService.h	Wed Aug 22 15:08:15 2018 +0200
+++ b/Framework/Toolbox/IWebService.h	Wed Aug 22 15:22:33 2018 +0200
@@ -28,105 +28,106 @@
 
 namespace OrthancStone
 {
-    class IWebService
-    {
-    protected:
-        MessageBroker& broker_;
-    public:
-        typedef std::map<std::string, std::string> Headers;
+  class IWebService
+  {
+  protected:
+    MessageBroker& broker_;
+  public:
+    typedef std::map<std::string, std::string> Headers;
 
-        class ICallback : public IObserver
-        {
-        public:
-            struct HttpRequestSuccessMessage: public IMessage
-            {
-                const std::string& Uri;
-                const void* Answer;
-                size_t AnswerSize;
-                Orthanc::IDynamicObject* Payload;
-                HttpRequestSuccessMessage(const std::string& uri,
-                                          const void* answer,
-                                          size_t answerSize,
-                                          Orthanc::IDynamicObject* payload)
-                    : IMessage(MessageType_HttpRequestSuccess),
-                      Uri(uri),
-                      Answer(answer),
-                      AnswerSize(answerSize),
-                      Payload(payload)
-                {}
-            };
+    class ICallback : public IObserver
+    {
+    public:
+      struct HttpRequestSuccessMessage: public IMessage
+      {
+        const std::string& Uri;
+        const void* Answer;
+        size_t AnswerSize;
+        Orthanc::IDynamicObject* Payload;
+        HttpRequestSuccessMessage(const std::string& uri,
+                                  const void* answer,
+                                  size_t answerSize,
+                                  Orthanc::IDynamicObject* payload)
+          : IMessage(MessageType_HttpRequestSuccess),
+            Uri(uri),
+            Answer(answer),
+            AnswerSize(answerSize),
+            Payload(payload)
+        {}
+      };
 
-            struct HttpRequestErrorMessage: public IMessage
-            {
-                const std::string& Uri;
-                Orthanc::IDynamicObject* Payload;
-                HttpRequestErrorMessage(const std::string& uri,
-                                        Orthanc::IDynamicObject* payload)
-                    : IMessage(MessageType_HttpRequestError),
-                      Uri(uri),
-                      Payload(payload)
-                {}
-            };
+      struct HttpRequestErrorMessage: public IMessage
+      {
+        const std::string& Uri;
+        Orthanc::IDynamicObject* Payload;
+        HttpRequestErrorMessage(const std::string& uri,
+                                Orthanc::IDynamicObject* payload)
+          : IMessage(MessageType_HttpRequestError),
+            Uri(uri),
+            Payload(payload)
+        {}
+      };
 
-            ICallback(MessageBroker& broker)
-                : IObserver(broker)
-            {
-                DeclareHandledMessage(MessageType_HttpRequestError);
-                DeclareHandledMessage(MessageType_HttpRequestSuccess);
-            }
-            virtual ~ICallback()
-            {
-            }
+      ICallback(MessageBroker& broker)
+        : IObserver(broker)
+      {
+        DeclareHandledMessage(MessageType_HttpRequestError);
+        DeclareHandledMessage(MessageType_HttpRequestSuccess);
+      }
+      virtual ~ICallback()
+      {
+      }
 
-            virtual void HandleMessage(IObservable& from, const IMessage& message)
-            {
-                switch(message.GetType())
-                {
-                case MessageType_HttpRequestError:
-                {    const HttpRequestErrorMessage& msg = dynamic_cast<const HttpRequestErrorMessage&>(message);
-                    OnHttpRequestError(msg.Uri,
-                                       msg.Payload);
-                }; break;
+      virtual void HandleMessage(IObservable& from, const IMessage& message)
+      {
+        switch(message.GetType())
+        {
+        case MessageType_HttpRequestError:
+        {
+          const HttpRequestErrorMessage& msg = dynamic_cast<const HttpRequestErrorMessage&>(message);
+          OnHttpRequestError(msg.Uri,
+                             msg.Payload);
+        }; break;
 
-                case MessageType_HttpRequestSuccess:
-                {
-                    const HttpRequestSuccessMessage& msg = dynamic_cast<const HttpRequestSuccessMessage&>(message);
-                    OnHttpRequestSuccess(msg.Uri,
-                                         msg.Answer,
-                                         msg.AnswerSize,
-                                         msg.Payload);
-                }; break;
-                default:
-                  VLOG("unhandled message type" << message.GetType());
-                }
-            }
+        case MessageType_HttpRequestSuccess:
+        {
+          const HttpRequestSuccessMessage& msg = dynamic_cast<const HttpRequestSuccessMessage&>(message);
+          OnHttpRequestSuccess(msg.Uri,
+                               msg.Answer,
+                               msg.AnswerSize,
+                               msg.Payload);
+        }; break;
+        default:
+          VLOG("unhandled message type" << message.GetType());
+        }
+      }
 
-            virtual void OnHttpRequestError(const std::string& uri,
-                                            Orthanc::IDynamicObject* payload) = 0;
+      virtual void OnHttpRequestError(const std::string& uri,
+                                      Orthanc::IDynamicObject* payload) = 0;
 
-            virtual void OnHttpRequestSuccess(const std::string& uri,
-                                              const void* answer,
-                                              size_t answerSize,
-                                              Orthanc::IDynamicObject* payload) = 0;
-        };
+      virtual void OnHttpRequestSuccess(const std::string& uri,
+                                        const void* answer,
+                                        size_t answerSize,
+                                        Orthanc::IDynamicObject* payload) = 0;
+    };
 
-        IWebService(MessageBroker& broker)
-            : broker_(broker)
-        {}
+    IWebService(MessageBroker& broker)
+      : broker_(broker)
+    {}
 
-        virtual ~IWebService()
-        {
-        }
+    virtual ~IWebService()
+    {
+    }
 
-        virtual void ScheduleGetRequest(ICallback& callback,
-                                        const std::string& uri,
-                                        const Headers& headers,
-                                        Orthanc::IDynamicObject* payload) = 0;
+    virtual void ScheduleGetRequest(ICallback& callback,
+                                    const std::string& uri,
+                                    const Headers& headers,
+                                    Orthanc::IDynamicObject* payload) = 0;
 
-        virtual void SchedulePostRequest(ICallback& callback,
-                                         const std::string& uri,
-                                         const Headers& headers,
-                                         const std::string& body,
-                                         Orthanc::IDynamicObject* payload) = 0;
-    };
+    virtual void SchedulePostRequest(ICallback& callback,
+                                     const std::string& uri,
+                                     const Headers& headers,
+                                     const std::string& body,
+                                     Orthanc::IDynamicObject* payload) = 0;
+  };
 }