diff options
author | Jose <jose@zeroc.com> | 2010-02-11 05:10:43 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2010-02-11 05:10:43 +0100 |
commit | d3e520a951ced49d836e94936451a529d301e562 (patch) | |
tree | 366f383dbc98a8fb3c2e2744c6581736aa4cd034 /cpp/demo | |
parent | bug 4380: stringToProxy docu (diff) | |
download | ice-d3e520a951ced49d836e94936451a529d301e562.tar.bz2 ice-d3e520a951ced49d836e94936451a529d301e562.tar.xz ice-d3e520a951ced49d836e94936451a529d301e562.zip |
4651 - Inconsistent line endings
Diffstat (limited to 'cpp/demo')
21 files changed, 979 insertions, 979 deletions
diff --git a/cpp/demo/Database/Oracle/occi/DbTypes.typ b/cpp/demo/Database/Oracle/occi/DbTypes.typ index f682eb61adc..89a7a2a0a02 100755 --- a/cpp/demo/Database/Oracle/occi/DbTypes.typ +++ b/cpp/demo/Database/Oracle/occi/DbTypes.typ @@ -1,16 +1,16 @@ -# **********************************************************************
-#
-# Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-#
-# Compile with:
-# ott userid=scott/tiger@orcl code=cpp hfile=DbTypes.h cppfile=DbTypes.cpp
-# mapfile=DbTypesMap.cpp intype=DbTypes.typ outtype=DbTypesOut.typ
-# attraccess=private
-#
-TYPE DEPT_T
-TYPE EMP_T
+# ********************************************************************** +# +# Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** +# +# Compile with: +# ott userid=scott/tiger@orcl code=cpp hfile=DbTypes.h cppfile=DbTypes.cpp +# mapfile=DbTypesMap.cpp intype=DbTypes.typ outtype=DbTypesOut.typ +# attraccess=private +# +TYPE DEPT_T +TYPE EMP_T diff --git a/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp b/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp index 58c4148376c..51a014dfb2a 100644 --- a/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp +++ b/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp @@ -6,75 +6,75 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -
-#include <OCCIServantLocator.h>
-#include <EmpI.h>
-#include <DeptI.h>
-#include <DbTypes.h>
-#include <Util.h>
-#include <occi.h>
-
-using namespace std;
-using namespace oracle::occi;
-
-OCCIServantLocator::OCCIServantLocator(const DeptFactoryIPtr& factory) :
- _factory(factory)
-{}
-
-
-Ice::ObjectPtr
-OCCIServantLocator::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie)
-{
- ConnectionHolderPtr con = new ConnectionHolder(_factory->getConnectionPool());
- RefAny ref = decodeRef(current.id.name, _factory->getEnv(), con->connection());
-
- try
- {
- //
- // Extract SQL type from target object
- //
- string sqlType = Ref<PObject>(ref)->getSQLTypeName();
-
- //
- // Create and return the servant, used only for this one operation
- //
- if(sqlType.find("EMP_T") != string::npos)
- {
- return new EmpI(ref, con, _factory);
- }
- else if(sqlType.find("DEPT_T") != string::npos)
- {
- return new DeptI(ref, con, _factory);
- }
- else
- {
- return 0;
- }
- }
- catch(const SQLException& sqle)
- {
- if(sqle.getErrorCode() == 21700)
- {
- return 0;
- }
- else
- {
- throw;
- }
- }
-}
-
-void
-OCCIServantLocator::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&)
-{
- //
- // Nothing to do: if the connection was not yet released, it is released (and the tx rolled back)
- // when the servant's last refcount goes away
- //
-}
-
-void
-OCCIServantLocator::deactivate(const string&)
-{
-}
-
+ +#include <OCCIServantLocator.h> +#include <EmpI.h> +#include <DeptI.h> +#include <DbTypes.h> +#include <Util.h> +#include <occi.h> + +using namespace std; +using namespace oracle::occi; + +OCCIServantLocator::OCCIServantLocator(const DeptFactoryIPtr& factory) : + _factory(factory) +{} + + +Ice::ObjectPtr +OCCIServantLocator::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie) +{ + ConnectionHolderPtr con = new ConnectionHolder(_factory->getConnectionPool()); + RefAny ref = decodeRef(current.id.name, _factory->getEnv(), con->connection()); + + try + { + // + // Extract SQL type from target object + // + string sqlType = Ref<PObject>(ref)->getSQLTypeName(); + + // + // Create and return the servant, used only for this one operation + // + if(sqlType.find("EMP_T") != string::npos) + { + return new EmpI(ref, con, _factory); + } + else if(sqlType.find("DEPT_T") != string::npos) + { + return new DeptI(ref, con, _factory); + } + else + { + return 0; + } + } + catch(const SQLException& sqle) + { + if(sqle.getErrorCode() == 21700) + { + return 0; + } + else + { + throw; + } + } +} + +void +OCCIServantLocator::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&) +{ + // + // Nothing to do: if the connection was not yet released, it is released (and the tx rolled back) + // when the servant's last refcount goes away + // +} + +void +OCCIServantLocator::deactivate(const string&) +{ +} + diff --git a/cpp/demo/Database/Oracle/occi/OCCIServantLocator.h b/cpp/demo/Database/Oracle/occi/OCCIServantLocator.h index f1d952b39f3..61fdc9784c4 100644 --- a/cpp/demo/Database/Oracle/occi/OCCIServantLocator.h +++ b/cpp/demo/Database/Oracle/occi/OCCIServantLocator.h @@ -6,26 +6,26 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -
-#ifndef OCCI_SERVANT_LOCATOR_H
-#define OCCI_SERVANT_LOCATOR_H
-
-#include <DeptFactoryI.h>
-#include <Ice/ServantLocator.h>
-#include <occi.h>
-
-class OCCIServantLocator : public Ice::ServantLocator
-{
-public:
-
- OCCIServantLocator(const DeptFactoryIPtr&);
-
- virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&);
- virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&);
- virtual void deactivate(const std::string&);
-
-private:
- DeptFactoryIPtr _factory;
-};
-
-#endif
+ +#ifndef OCCI_SERVANT_LOCATOR_H +#define OCCI_SERVANT_LOCATOR_H + +#include <DeptFactoryI.h> +#include <Ice/ServantLocator.h> +#include <occi.h> + +class OCCIServantLocator : public Ice::ServantLocator +{ +public: + + OCCIServantLocator(const DeptFactoryIPtr&); + + virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); + virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); + virtual void deactivate(const std::string&); + +private: + DeptFactoryIPtr _factory; +}; + +#endif diff --git a/cpp/demo/Database/Oracle/occi/createTypes.sql b/cpp/demo/Database/Oracle/occi/createTypes.sql index 82fdc0fc025..3c8422d9764 100644 --- a/cpp/demo/Database/Oracle/occi/createTypes.sql +++ b/cpp/demo/Database/Oracle/occi/createTypes.sql @@ -1,54 +1,54 @@ -Rem
-Rem Copyright (c) 2006 ZeroC, Inc. All rights reserved.
-Rem
-Rem This copy of Ice is licensed to you under the terms described in the
-Rem ICE_LICENSE file included in this distribution.
-
-Rem
-Rem Create object types and views for the DEPT and EMP tables
-Rem
-
-SET ECHO ON
-
-CONNECT scott/tiger@orcl
-
-DROP VIEW EMP_VIEW;
-DROP VIEW DEPT_VIEW;
-DROP TYPE EMP_T;
-DROP TYPE DEPT_T;
-
-CREATE TYPE DEPT_T AS OBJECT(
- DEPTNO NUMBER(2),
- DNAME VARCHAR2(14),
- LOC VARCHAR2(13));
-/
-
-CREATE TYPE EMP_T;
-/
-CREATE TYPE EMP_T AS OBJECT(
- EMPNO NUMBER(4),
- ENAME VARCHAR2(10),
- JOB VARCHAR2(9),
- MGRREF REF EMP_T,
- HIREDATE DATE,
- SAL NUMBER(7,2),
- COMM NUMBER(7,2),
- DEPTREF REF DEPT_T);
-/
-
-CREATE VIEW DEPT_VIEW OF DEPT_T WITH OBJECT IDENTIFIER(DEPTNO)
- AS SELECT DEPTNO, DNAME, LOC FROM DEPT;
-
-Rem
-Rem Need to create the view in two steps since it references itself
-Rem
-CREATE VIEW EMP_VIEW OF EMP_T WITH OBJECT IDENTIFIER(EMPNO)
- AS SELECT EMPNO, ENAME, JOB, NULL, HIREDATE, SAL, COMM,
- MAKE_REF(DEPT_VIEW, DEPTNO) FROM EMP;
-
-CREATE OR REPLACE VIEW EMP_VIEW OF EMP_T WITH OBJECT IDENTIFIER(EMPNO)
- AS SELECT EMPNO, ENAME, JOB, MAKE_REF(EMP_VIEW, MGR), HIREDATE, SAL,
- COMM, MAKE_REF(DEPT_VIEW, DEPTNO) FROM EMP;
-
-COMMIT;
-EXIT
+Rem +Rem Copyright (c) 2006 ZeroC, Inc. All rights reserved. +Rem +Rem This copy of Ice is licensed to you under the terms described in the +Rem ICE_LICENSE file included in this distribution. + +Rem +Rem Create object types and views for the DEPT and EMP tables +Rem + +SET ECHO ON + +CONNECT scott/tiger@orcl + +DROP VIEW EMP_VIEW; +DROP VIEW DEPT_VIEW; +DROP TYPE EMP_T; +DROP TYPE DEPT_T; + +CREATE TYPE DEPT_T AS OBJECT( + DEPTNO NUMBER(2), + DNAME VARCHAR2(14), + LOC VARCHAR2(13)); +/ + +CREATE TYPE EMP_T; +/ +CREATE TYPE EMP_T AS OBJECT( + EMPNO NUMBER(4), + ENAME VARCHAR2(10), + JOB VARCHAR2(9), + MGRREF REF EMP_T, + HIREDATE DATE, + SAL NUMBER(7,2), + COMM NUMBER(7,2), + DEPTREF REF DEPT_T); +/ + +CREATE VIEW DEPT_VIEW OF DEPT_T WITH OBJECT IDENTIFIER(DEPTNO) + AS SELECT DEPTNO, DNAME, LOC FROM DEPT; + +Rem +Rem Need to create the view in two steps since it references itself +Rem +CREATE VIEW EMP_VIEW OF EMP_T WITH OBJECT IDENTIFIER(EMPNO) + AS SELECT EMPNO, ENAME, JOB, NULL, HIREDATE, SAL, COMM, + MAKE_REF(DEPT_VIEW, DEPTNO) FROM EMP; + +CREATE OR REPLACE VIEW EMP_VIEW OF EMP_T WITH OBJECT IDENTIFIER(EMPNO) + AS SELECT EMPNO, ENAME, JOB, MAKE_REF(EMP_VIEW, MGR), HIREDATE, SAL, + COMM, MAKE_REF(DEPT_VIEW, DEPTNO) FROM EMP; + +COMMIT; +EXIT diff --git a/cpp/demo/Freeze/library/Scanner.cpp b/cpp/demo/Freeze/library/Scanner.cpp index 89c9c00a3c2..909b2633081 100755 --- a/cpp/demo/Freeze/library/Scanner.cpp +++ b/cpp/demo/Freeze/library/Scanner.cpp @@ -1,4 +1,4 @@ -#include "IceUtil/Config.h"
+#include "IceUtil/Config.h" /* A lexical scanner generated by flex */ /* Scanner skeleton version: diff --git a/cpp/demo/Freeze/phonebook/Scanner.cpp b/cpp/demo/Freeze/phonebook/Scanner.cpp index ca723d09126..22fedb31aca 100755 --- a/cpp/demo/Freeze/phonebook/Scanner.cpp +++ b/cpp/demo/Freeze/phonebook/Scanner.cpp @@ -1,4 +1,4 @@ -#include "IceUtil/Config.h"
+#include "IceUtil/Config.h" /* A lexical scanner generated by flex */ /* Scanner skeleton version: diff --git a/cpp/demo/Ice/MFC/client/HelloClient.h b/cpp/demo/Ice/MFC/client/HelloClient.h index 2f5cef4faae..08a21097d1d 100644 --- a/cpp/demo/Ice/MFC/client/HelloClient.h +++ b/cpp/demo/Ice/MFC/client/HelloClient.h @@ -7,28 +7,28 @@ // // ********************************************************************** -
-#ifndef HELLO_CLIENT_H
-#define HELLO_CLIENT_H
-
-#pragma once
-
-#ifndef __AFXWIN_H__
- #error include 'stdafx.h' before including this file for PCH
-#endif
-
-#include "Resource.h"
-
-class CHelloClientApp : public CWinApp
-{
-public:
- CHelloClientApp();
-
- virtual BOOL InitInstance();
-
- DECLARE_MESSAGE_MAP()
-};
-
-extern CHelloClientApp theApp;
-
-#endif
+ +#ifndef HELLO_CLIENT_H +#define HELLO_CLIENT_H + +#pragma once + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "Resource.h" + +class CHelloClientApp : public CWinApp +{ +public: + CHelloClientApp(); + + virtual BOOL InitInstance(); + + DECLARE_MESSAGE_MAP() +}; + +extern CHelloClientApp theApp; + +#endif diff --git a/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp b/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp index c3f8f31ca74..fbb9dcc2a91 100644 --- a/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp +++ b/cpp/demo/Ice/MFC/client/HelloClientDlg.cpp @@ -1,452 +1,452 @@ -// **********************************************************************
-//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#include "stdafx.h"
-#include "HelloClient.h"
-#include "HelloClientDlg.h"
-
-#include <iomanip>
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#endif
-
-#define WM_AMI_CALLBACK (WM_USER + 1)
-
-using namespace std;
-using namespace Demo;
-
-namespace
-{
-
-class Dispatcher : public Ice::Dispatcher
-{
-public:
-
- Dispatcher(CHelloClientDlg* dialog) : _dialog(dialog)
- {
- }
-
- virtual void
- dispatch(const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr&)
- {
- //
- // Dispatch Ice AMI callbacks with the event loop thread.
- //
- _dialog->PostMessage(WM_AMI_CALLBACK, 0, reinterpret_cast<LPARAM>(new Ice::DispatcherCallPtr(call)));
- }
-
-private:
-
- CHelloClientDlg* _dialog;
-};
-
-class Callback : public IceUtil::Shared
-{
-public:
-
- Callback(CHelloClientDlg* dialog) : _dialog(dialog)
- {
- }
-
- void
- sent(bool)
- {
- _dialog->sent();
- }
-
- void
- response()
- {
- _dialog->response();
- }
-
- void
- exception(const Ice::Exception& ex)
- {
- _dialog->exception(ex);
- }
-
- void
- flushSent(bool)
- {
- _dialog->flushed();
- }
-
-private:
-
- CHelloClientDlg* _dialog;
-};
-typedef IceUtil::Handle<Callback> CallbackPtr;
-
-enum DeliveryMode
-{
- TWOWAY,
- TWOWAY_SECURE,
- ONEWAY,
- ONEWAY_SECURE,
- ONEWAY_BATCH,
- ONEWAY_SECURE_BATCH,
- DATAGRAM,
- DATAGRAM_BATCH
-};
-
-}
-
-BEGIN_MESSAGE_MAP(CHelloClientDlg, CDialog)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_WM_HSCROLL()
- ON_BN_CLICKED(IDC_INVOKE, OnSayHello)
- ON_BN_CLICKED(IDC_FLUSH, OnFlush)
- ON_BN_CLICKED(IDC_SHUTDOWN, OnShutdown)
- ON_MESSAGE(WM_AMI_CALLBACK, OnAMICallback)
-END_MESSAGE_MAP()
-
-
-CHelloClientDlg::CHelloClientDlg(CWnd* pParent /*=NULL*/) : CDialog(CHelloClientDlg::IDD, pParent)
-{
- _hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
-
- //
- // Create the communicator.
- //
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- initData.dispatcher = new Dispatcher(this);
- _communicator = Ice::initialize(initData);
-
- //
- // Create AMI callbacks.
- //
- CallbackPtr cb = new Callback(this);
- _sayHelloCallback = newCallback_Hello_sayHello(cb, &Callback::response, &Callback::exception, &Callback::sent);
- _shutdownCallback = newCallback_Hello_shutdown(cb, &Callback::response, &Callback::exception);
- _flushCallback = Ice::newCallback_Communicator_flushBatchRequests(cb, &Callback::exception, &Callback::flushSent);
-}
-
-void
-CHelloClientDlg::DoDataExchange(CDataExchange* pDX)
-{
- CDialog::DoDataExchange(pDX);
-}
-
-
-BOOL
-CHelloClientDlg::OnInitDialog()
-{
- CDialog::OnInitDialog();
-
- // Set the icon for this dialog. The framework does this automatically
- // when the application's main window is not a dialog
- SetIcon(_hIcon, TRUE); // Set big icon
- SetIcon(_hIcon, FALSE); // Set small icon
-
- //
- // Retrieve the controls.
- //
- _host = (CEdit*)GetDlgItem(IDC_HOST);
- _mode = (CComboBox*)GetDlgItem(IDC_MODE);
- _timeout = (CSliderCtrl*)GetDlgItem(IDC_TIMEOUT_SLIDER);
- _timeoutStatus = (CStatic*)GetDlgItem(IDC_TIMEOUT_STATUS);
- _delay = (CSliderCtrl*)GetDlgItem(IDC_DELAY_SLIDER);
- _delayStatus = (CStatic*)GetDlgItem(IDC_DELAY_STATUS);
- _status = (CStatic*)GetDlgItem(IDC_STATUSBAR);
- _flush = (CButton*)GetDlgItem(IDC_FLUSH);
-
- //
- // Use twoway mode as the initial default.
- //
- _mode->SetCurSel(TWOWAY);
-
- //
- // Disable flush
- //
- _flush->EnableWindow(FALSE);
-
- //
- // Set hostname
- //
- _host->SetWindowText(CString("127.0.0.1"));
-
- //
- // Initialize timeout slider
- //
- _timeout->SetRangeMin(0);
- _timeout->SetRangeMax(50);
- _timeoutStatus->SetWindowText(CString("0.0s"));
-
- //
- // Initialize delay slider
- //
- _delay->SetRangeMin(0);
- _delay->SetRangeMax(50);
- _delayStatus->SetWindowText(CString("0.0s"));
-
- _status->SetWindowText(CString(" Ready"));
-
- return TRUE; // return TRUE unless you set the focus to a control
-}
-
-void
-CHelloClientDlg::OnClose()
-{
- //
- // Destroy the communicator. If AMI calls are still in progress they will be
- // interrupted with an Ice::CommunicatorDestroyedException.
- //
- try
- {
- _communicator->destroy();
- }
- catch(const IceUtil::Exception&)
- {
- }
-}
-
-// If you add a minimize button to your dialog, you will need the code below
-// to draw the icon. For MFC applications using the document/view model,
-// this is automatically done for you by the framework.
-
-void
-CHelloClientDlg::OnPaint()
-{
- if(IsIconic())
- {
- CPaintDC dc(this); // device context for painting
-
- SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
-
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
-
- // Draw the icon
- dc.DrawIcon(x, y, _hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
-}
-
-// The system calls this function to obtain the cursor to display while the user drags
-// the minimized window.
-HCURSOR
-CHelloClientDlg::OnQueryDragIcon()
-{
- return static_cast<HCURSOR>(_hIcon);
-}
-
-void
-CHelloClientDlg::OnHScroll(UINT, UINT, CScrollBar* scroll)
-{
- CSliderCtrl* slider = (CSliderCtrl*)scroll;
- ostringstream s;
- if(slider == _timeout)
- {
- s << setiosflags(ios::fixed) << setprecision(1) << (long)_timeout->GetPos()/10.0 << "s";
- _timeoutStatus->SetWindowText(CString(s.str().c_str()));
- }
- else
- {
- s << setiosflags(ios::fixed) << setprecision(1) << (long)_delay->GetPos()/10.0 << "s";
- _delayStatus->SetWindowText(CString(s.str().c_str()));
- }
-}
-
-void
-CHelloClientDlg::OnSayHello()
-{
- Demo::HelloPrx hello = createProxy();
- if(!hello)
- {
- return;
- }
- int delay = _delay->GetPos() * 100;
- try
- {
- if(!deliveryModeIsBatch())
- {
- _status->SetWindowText(CString(" Sending request"));
- hello->begin_sayHello(delay, _sayHelloCallback);
- }
- else
- {
- _flush->EnableWindow(TRUE);
- hello->sayHello(delay);
- _status->SetWindowText(CString(" Queued sayHello request"));
- }
- }
- catch(const IceUtil::Exception& ex)
- {
- handleException(ex);
- }
-}
-
-void
-CHelloClientDlg::OnShutdown()
-{
- Demo::HelloPrx hello = createProxy();
- try
- {
- if(!deliveryModeIsBatch())
- {
- _status->SetWindowText(CString(" Sending request"));
- CallbackPtr cb = new Callback(this);
- hello->begin_shutdown(_shutdownCallback);
- }
- else
- {
- _flush->EnableWindow(TRUE);
- hello->shutdown();
- _status->SetWindowText(CString(" Queued shutdown request"));
- }
- }
- catch(const IceUtil::Exception& ex)
- {
- handleException(ex);
- }
-}
-
-void
-CHelloClientDlg::OnFlush()
-{
- try
- {
- _communicator->begin_flushBatchRequests(_flushCallback);
- }
- catch(const IceUtil::Exception& ex)
- {
- handleException(ex);
- }
- _flush->EnableWindow(FALSE);
-}
-
-LRESULT
-CHelloClientDlg::OnAMICallback(WPARAM, LPARAM lParam)
-{
- try
- {
- Ice::DispatcherCallPtr* call = reinterpret_cast<Ice::DispatcherCallPtr*>(lParam);
- (*call)->run();
- delete call;
- }
- catch(const Ice::Exception& ex)
- {
- handleException(ex);
- }
- return 0;
-}
-
-void
-CHelloClientDlg::sent()
-{
- int mode = _mode->GetCurSel();
- if(mode == TWOWAY || mode == TWOWAY_SECURE)
- {
- _status->SetWindowText(CString(" Waiting for response"));
- }
- else
- {
- _status->SetWindowText(CString(" Ready"));
- }
-}
-
-void
-CHelloClientDlg::response()
-{
- _status->SetWindowText(CString(" Ready"));
-}
-
-void
-CHelloClientDlg::exception(const Ice::Exception& ex)
-{
- if(!dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex))
- {
- handleException(ex);
- }
-}
-
-void
-CHelloClientDlg::flushed()
-{
- _status->SetWindowText(CString(" Flushed batch requests"));
-}
-
-Demo::HelloPrx
-CHelloClientDlg::createProxy()
-{
- CString h;
- _host->GetWindowText(h);
- string host = (LPCTSTR)h;
- if(host.size() == 0)
- {
- _status->SetWindowText(CString(" No hostname"));
- }
-
- string s = "hello:tcp -h " + host + " -p 10000:ssl -h " + host + " -p 10001:udp -h " + host + " -p 10000";
- Ice::ObjectPrx prx = _communicator->stringToProxy(s);
-
- int mode = _mode->GetCurSel();
- switch(mode)
- {
- case TWOWAY:
- prx = prx->ice_twoway();
- break;
- case TWOWAY_SECURE:
- prx = prx->ice_twoway()->ice_secure(true);;
- break;
- case ONEWAY:
- prx = prx->ice_oneway();
- break;
- case ONEWAY_SECURE:
- prx = prx->ice_oneway()->ice_secure(true);
- break;
- case ONEWAY_BATCH:
- prx = prx->ice_batchOneway();
- break;
- case ONEWAY_SECURE_BATCH:
- prx = prx->ice_batchOneway()->ice_secure(true);
- break;
- case DATAGRAM:
- prx = prx->ice_datagram();
- break;
- case DATAGRAM_BATCH:
- prx = prx->ice_batchDatagram();
- break;
- }
-
- int timeout = _timeout->GetPos() * 100;
- if(timeout != 0)
- {
- prx = prx->ice_timeout(timeout);
- }
-
- return Demo::HelloPrx::uncheckedCast(prx);
-}
-
-BOOL
-CHelloClientDlg::deliveryModeIsBatch()
-{
- return _mode->GetCurSel() == ONEWAY_BATCH ||
- _mode->GetCurSel() == ONEWAY_SECURE_BATCH ||
- _mode->GetCurSel() == DATAGRAM_BATCH;
-}
-
-void
-CHelloClientDlg::handleException(const IceUtil::Exception& ex)
-{
- _status->SetWindowText(CString(ex.ice_name().c_str()));
-}
+// ********************************************************************** +// +// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include "stdafx.h" +#include "HelloClient.h" +#include "HelloClientDlg.h" + +#include <iomanip> + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +#define WM_AMI_CALLBACK (WM_USER + 1) + +using namespace std; +using namespace Demo; + +namespace +{ + +class Dispatcher : public Ice::Dispatcher +{ +public: + + Dispatcher(CHelloClientDlg* dialog) : _dialog(dialog) + { + } + + virtual void + dispatch(const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr&) + { + // + // Dispatch Ice AMI callbacks with the event loop thread. + // + _dialog->PostMessage(WM_AMI_CALLBACK, 0, reinterpret_cast<LPARAM>(new Ice::DispatcherCallPtr(call))); + } + +private: + + CHelloClientDlg* _dialog; +}; + +class Callback : public IceUtil::Shared +{ +public: + + Callback(CHelloClientDlg* dialog) : _dialog(dialog) + { + } + + void + sent(bool) + { + _dialog->sent(); + } + + void + response() + { + _dialog->response(); + } + + void + exception(const Ice::Exception& ex) + { + _dialog->exception(ex); + } + + void + flushSent(bool) + { + _dialog->flushed(); + } + +private: + + CHelloClientDlg* _dialog; +}; +typedef IceUtil::Handle<Callback> CallbackPtr; + +enum DeliveryMode +{ + TWOWAY, + TWOWAY_SECURE, + ONEWAY, + ONEWAY_SECURE, + ONEWAY_BATCH, + ONEWAY_SECURE_BATCH, + DATAGRAM, + DATAGRAM_BATCH +}; + +} + +BEGIN_MESSAGE_MAP(CHelloClientDlg, CDialog) + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_WM_HSCROLL() + ON_BN_CLICKED(IDC_INVOKE, OnSayHello) + ON_BN_CLICKED(IDC_FLUSH, OnFlush) + ON_BN_CLICKED(IDC_SHUTDOWN, OnShutdown) + ON_MESSAGE(WM_AMI_CALLBACK, OnAMICallback) +END_MESSAGE_MAP() + + +CHelloClientDlg::CHelloClientDlg(CWnd* pParent /*=NULL*/) : CDialog(CHelloClientDlg::IDD, pParent) +{ + _hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + + // + // Create the communicator. + // + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); + initData.properties->load("config"); + initData.dispatcher = new Dispatcher(this); + _communicator = Ice::initialize(initData); + + // + // Create AMI callbacks. + // + CallbackPtr cb = new Callback(this); + _sayHelloCallback = newCallback_Hello_sayHello(cb, &Callback::response, &Callback::exception, &Callback::sent); + _shutdownCallback = newCallback_Hello_shutdown(cb, &Callback::response, &Callback::exception); + _flushCallback = Ice::newCallback_Communicator_flushBatchRequests(cb, &Callback::exception, &Callback::flushSent); +} + +void +CHelloClientDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + + +BOOL +CHelloClientDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(_hIcon, TRUE); // Set big icon + SetIcon(_hIcon, FALSE); // Set small icon + + // + // Retrieve the controls. + // + _host = (CEdit*)GetDlgItem(IDC_HOST); + _mode = (CComboBox*)GetDlgItem(IDC_MODE); + _timeout = (CSliderCtrl*)GetDlgItem(IDC_TIMEOUT_SLIDER); + _timeoutStatus = (CStatic*)GetDlgItem(IDC_TIMEOUT_STATUS); + _delay = (CSliderCtrl*)GetDlgItem(IDC_DELAY_SLIDER); + _delayStatus = (CStatic*)GetDlgItem(IDC_DELAY_STATUS); + _status = (CStatic*)GetDlgItem(IDC_STATUSBAR); + _flush = (CButton*)GetDlgItem(IDC_FLUSH); + + // + // Use twoway mode as the initial default. + // + _mode->SetCurSel(TWOWAY); + + // + // Disable flush + // + _flush->EnableWindow(FALSE); + + // + // Set hostname + // + _host->SetWindowText(CString("127.0.0.1")); + + // + // Initialize timeout slider + // + _timeout->SetRangeMin(0); + _timeout->SetRangeMax(50); + _timeoutStatus->SetWindowText(CString("0.0s")); + + // + // Initialize delay slider + // + _delay->SetRangeMin(0); + _delay->SetRangeMax(50); + _delayStatus->SetWindowText(CString("0.0s")); + + _status->SetWindowText(CString(" Ready")); + + return TRUE; // return TRUE unless you set the focus to a control +} + +void +CHelloClientDlg::OnClose() +{ + // + // Destroy the communicator. If AMI calls are still in progress they will be + // interrupted with an Ice::CommunicatorDestroyedException. + // + try + { + _communicator->destroy(); + } + catch(const IceUtil::Exception&) + { + } +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void +CHelloClientDlg::OnPaint() +{ + if(IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, _hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR +CHelloClientDlg::OnQueryDragIcon() +{ + return static_cast<HCURSOR>(_hIcon); +} + +void +CHelloClientDlg::OnHScroll(UINT, UINT, CScrollBar* scroll) +{ + CSliderCtrl* slider = (CSliderCtrl*)scroll; + ostringstream s; + if(slider == _timeout) + { + s << setiosflags(ios::fixed) << setprecision(1) << (long)_timeout->GetPos()/10.0 << "s"; + _timeoutStatus->SetWindowText(CString(s.str().c_str())); + } + else + { + s << setiosflags(ios::fixed) << setprecision(1) << (long)_delay->GetPos()/10.0 << "s"; + _delayStatus->SetWindowText(CString(s.str().c_str())); + } +} + +void +CHelloClientDlg::OnSayHello() +{ + Demo::HelloPrx hello = createProxy(); + if(!hello) + { + return; + } + int delay = _delay->GetPos() * 100; + try + { + if(!deliveryModeIsBatch()) + { + _status->SetWindowText(CString(" Sending request")); + hello->begin_sayHello(delay, _sayHelloCallback); + } + else + { + _flush->EnableWindow(TRUE); + hello->sayHello(delay); + _status->SetWindowText(CString(" Queued sayHello request")); + } + } + catch(const IceUtil::Exception& ex) + { + handleException(ex); + } +} + +void +CHelloClientDlg::OnShutdown() +{ + Demo::HelloPrx hello = createProxy(); + try + { + if(!deliveryModeIsBatch()) + { + _status->SetWindowText(CString(" Sending request")); + CallbackPtr cb = new Callback(this); + hello->begin_shutdown(_shutdownCallback); + } + else + { + _flush->EnableWindow(TRUE); + hello->shutdown(); + _status->SetWindowText(CString(" Queued shutdown request")); + } + } + catch(const IceUtil::Exception& ex) + { + handleException(ex); + } +} + +void +CHelloClientDlg::OnFlush() +{ + try + { + _communicator->begin_flushBatchRequests(_flushCallback); + } + catch(const IceUtil::Exception& ex) + { + handleException(ex); + } + _flush->EnableWindow(FALSE); +} + +LRESULT +CHelloClientDlg::OnAMICallback(WPARAM, LPARAM lParam) +{ + try + { + Ice::DispatcherCallPtr* call = reinterpret_cast<Ice::DispatcherCallPtr*>(lParam); + (*call)->run(); + delete call; + } + catch(const Ice::Exception& ex) + { + handleException(ex); + } + return 0; +} + +void +CHelloClientDlg::sent() +{ + int mode = _mode->GetCurSel(); + if(mode == TWOWAY || mode == TWOWAY_SECURE) + { + _status->SetWindowText(CString(" Waiting for response")); + } + else + { + _status->SetWindowText(CString(" Ready")); + } +} + +void +CHelloClientDlg::response() +{ + _status->SetWindowText(CString(" Ready")); +} + +void +CHelloClientDlg::exception(const Ice::Exception& ex) +{ + if(!dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex)) + { + handleException(ex); + } +} + +void +CHelloClientDlg::flushed() +{ + _status->SetWindowText(CString(" Flushed batch requests")); +} + +Demo::HelloPrx +CHelloClientDlg::createProxy() +{ + CString h; + _host->GetWindowText(h); + string host = (LPCTSTR)h; + if(host.size() == 0) + { + _status->SetWindowText(CString(" No hostname")); + } + + string s = "hello:tcp -h " + host + " -p 10000:ssl -h " + host + " -p 10001:udp -h " + host + " -p 10000"; + Ice::ObjectPrx prx = _communicator->stringToProxy(s); + + int mode = _mode->GetCurSel(); + switch(mode) + { + case TWOWAY: + prx = prx->ice_twoway(); + break; + case TWOWAY_SECURE: + prx = prx->ice_twoway()->ice_secure(true);; + break; + case ONEWAY: + prx = prx->ice_oneway(); + break; + case ONEWAY_SECURE: + prx = prx->ice_oneway()->ice_secure(true); + break; + case ONEWAY_BATCH: + prx = prx->ice_batchOneway(); + break; + case ONEWAY_SECURE_BATCH: + prx = prx->ice_batchOneway()->ice_secure(true); + break; + case DATAGRAM: + prx = prx->ice_datagram(); + break; + case DATAGRAM_BATCH: + prx = prx->ice_batchDatagram(); + break; + } + + int timeout = _timeout->GetPos() * 100; + if(timeout != 0) + { + prx = prx->ice_timeout(timeout); + } + + return Demo::HelloPrx::uncheckedCast(prx); +} + +BOOL +CHelloClientDlg::deliveryModeIsBatch() +{ + return _mode->GetCurSel() == ONEWAY_BATCH || + _mode->GetCurSel() == ONEWAY_SECURE_BATCH || + _mode->GetCurSel() == DATAGRAM_BATCH; +} + +void +CHelloClientDlg::handleException(const IceUtil::Exception& ex) +{ + _status->SetWindowText(CString(ex.ice_name().c_str())); +} diff --git a/cpp/demo/Ice/MFC/client/HelloClientDlg.h b/cpp/demo/Ice/MFC/client/HelloClientDlg.h index 167b1571063..ce692b457cf 100644 --- a/cpp/demo/Ice/MFC/client/HelloClientDlg.h +++ b/cpp/demo/Ice/MFC/client/HelloClientDlg.h @@ -1,70 +1,70 @@ -// **********************************************************************
-//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-
-#ifndef HELLO_CLIENT_DLG_H
-#define HELLO_CLIENT_DLG_H
-
-#include "Hello.h"
-
-#pragma once
-
-class CHelloClientDlg : public CDialog
-{
-public:
-
- CHelloClientDlg(CWnd* = NULL);
-
- enum { IDD = IDD_HELLOCLIENT_DIALOG };
-
- afx_msg void OnCbnSelchangeMode();
-
- void exception(const Ice::Exception&);
- void response();;
- void sent();
- void flushed();
-
-protected:
-
- virtual void DoDataExchange(CDataExchange*); // DDX/DDV support
-
- Ice::CommunicatorPtr _communicator;
- Demo::Callback_Hello_sayHelloPtr _sayHelloCallback;
- Demo::Callback_Hello_shutdownPtr _shutdownCallback;
- Ice::Callback_Communicator_flushBatchRequestsPtr _flushCallback;
- CEdit* _host;
- CComboBox* _mode;
- CSliderCtrl* _timeout;
- CStatic* _timeoutStatus;
- CSliderCtrl* _delay;
- CStatic* _delayStatus;
- CStatic* _status;
- CButton* _flush;
- HICON _hIcon;
-
- // Generated message map functions
- virtual BOOL OnInitDialog();
- afx_msg void OnClose();
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- afx_msg void OnHScroll(UINT, UINT, CScrollBar*);
- afx_msg void OnSayHello();
- afx_msg void OnFlush();
- afx_msg void OnShutdown();
- afx_msg LRESULT OnAMICallback(WPARAM, LPARAM);
- DECLARE_MESSAGE_MAP()
-
-private:
-
- Demo::HelloPrx createProxy();
- BOOL deliveryModeIsBatch();
- void handleException(const IceUtil::Exception&);
-};
-
-#endif
+// ********************************************************************** +// +// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + + +#ifndef HELLO_CLIENT_DLG_H +#define HELLO_CLIENT_DLG_H + +#include "Hello.h" + +#pragma once + +class CHelloClientDlg : public CDialog +{ +public: + + CHelloClientDlg(CWnd* = NULL); + + enum { IDD = IDD_HELLOCLIENT_DIALOG }; + + afx_msg void OnCbnSelchangeMode(); + + void exception(const Ice::Exception&); + void response();; + void sent(); + void flushed(); + +protected: + + virtual void DoDataExchange(CDataExchange*); // DDX/DDV support + + Ice::CommunicatorPtr _communicator; + Demo::Callback_Hello_sayHelloPtr _sayHelloCallback; + Demo::Callback_Hello_shutdownPtr _shutdownCallback; + Ice::Callback_Communicator_flushBatchRequestsPtr _flushCallback; + CEdit* _host; + CComboBox* _mode; + CSliderCtrl* _timeout; + CStatic* _timeoutStatus; + CSliderCtrl* _delay; + CStatic* _delayStatus; + CStatic* _status; + CButton* _flush; + HICON _hIcon; + + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnHScroll(UINT, UINT, CScrollBar*); + afx_msg void OnSayHello(); + afx_msg void OnFlush(); + afx_msg void OnShutdown(); + afx_msg LRESULT OnAMICallback(WPARAM, LPARAM); + DECLARE_MESSAGE_MAP() + +private: + + Demo::HelloPrx createProxy(); + BOOL deliveryModeIsBatch(); + void handleException(const IceUtil::Exception&); +}; + +#endif diff --git a/cpp/demo/Ice/MFC/client/Resource.h b/cpp/demo/Ice/MFC/client/Resource.h index 7075a527802..b35407d15ec 100755 --- a/cpp/demo/Ice/MFC/client/Resource.h +++ b/cpp/demo/Ice/MFC/client/Resource.h @@ -1,33 +1,33 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by HelloClient.rc
-//
-#define IDD_HELLOCLIENT_DIALOG 101
-#define IDR_MAINFRAME 128
-#define IDC_MODELABEL 1000
-#define IDC_MODE 1001
-#define IDC_TIMEOUTLABEL 1002
-#define IDC_DELAYLABEL 1003
-#define IDC_INVOKE 1004
-#define IDC_FLUSH 1005
-#define IDC_SHUTDOWN 1006
-#define IDC_STATUSBAR 1007
-#define IDC_TIMEOUT_STATUS 1008
-#define IDC_HOST 1009
-#define IDC_HOSTNAME 1010
-#define IDC_HOSTLABEL 1010
-#define IDC_TIMEOUT_SLIDER 1011
-#define IDC_DELAY_SLIDER 1012
-#define IDC_STATUSBAR3 1013
-#define IDC_DELAY_STATUS 1013
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 130
-#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1012
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by HelloClient.rc +// +#define IDD_HELLOCLIENT_DIALOG 101 +#define IDR_MAINFRAME 128 +#define IDC_MODELABEL 1000 +#define IDC_MODE 1001 +#define IDC_TIMEOUTLABEL 1002 +#define IDC_DELAYLABEL 1003 +#define IDC_INVOKE 1004 +#define IDC_FLUSH 1005 +#define IDC_SHUTDOWN 1006 +#define IDC_STATUSBAR 1007 +#define IDC_TIMEOUT_STATUS 1008 +#define IDC_HOST 1009 +#define IDC_HOSTNAME 1010 +#define IDC_HOSTLABEL 1010 +#define IDC_TIMEOUT_SLIDER 1011 +#define IDC_DELAY_SLIDER 1012 +#define IDC_STATUSBAR3 1013 +#define IDC_DELAY_STATUS 1013 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1012 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/cpp/demo/Ice/MFC/client/stdafx.cpp b/cpp/demo/Ice/MFC/client/stdafx.cpp index c73265a887b..1e840966688 100644 --- a/cpp/demo/Ice/MFC/client/stdafx.cpp +++ b/cpp/demo/Ice/MFC/client/stdafx.cpp @@ -7,11 +7,11 @@ // // ********************************************************************** -
-// stdafx.cpp : source file that includes just the standard includes
-// HelloClient.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-
+ +// stdafx.cpp : source file that includes just the standard includes +// HelloClient.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + diff --git a/cpp/demo/Ice/MFC/server/HelloServer.h b/cpp/demo/Ice/MFC/server/HelloServer.h index 14944e3ae13..198a0d1acba 100644 --- a/cpp/demo/Ice/MFC/server/HelloServer.h +++ b/cpp/demo/Ice/MFC/server/HelloServer.h @@ -7,28 +7,28 @@ // // ********************************************************************** -
-#ifndef HELLO_SERVER_H
-#define HELLO_SERVER_H
-
-#pragma once
-
-#ifndef __AFXWIN_H__
- #error include 'stdafx.h' before including this file for PCH
-#endif
-
-#include "Resource.h"
-
-class CHelloServerApp : public CWinApp
-{
-public:
- CHelloServerApp();
-
- virtual BOOL InitInstance();
-
- DECLARE_MESSAGE_MAP()
-};
-
-extern CHelloServerApp theApp;
-
-#endif
+ +#ifndef HELLO_SERVER_H +#define HELLO_SERVER_H + +#pragma once + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "Resource.h" + +class CHelloServerApp : public CWinApp +{ +public: + CHelloServerApp(); + + virtual BOOL InitInstance(); + + DECLARE_MESSAGE_MAP() +}; + +extern CHelloServerApp theApp; + +#endif diff --git a/cpp/demo/Ice/MFC/server/HelloServerDlg.h b/cpp/demo/Ice/MFC/server/HelloServerDlg.h index 4082629ae07..eaa70fe876b 100644 --- a/cpp/demo/Ice/MFC/server/HelloServerDlg.h +++ b/cpp/demo/Ice/MFC/server/HelloServerDlg.h @@ -7,39 +7,39 @@ // // ********************************************************************** -
-#ifndef HELLO_SERVER_DLG_H
-#define HELLO_SERVER_DLG_H
-
-#pragma once
-
-#include "LogI.h"
-
-class CHelloServerDlg : public CDialog
-{
-public:
- CHelloServerDlg(const Ice::CommunicatorPtr&, const LogIPtr&, CWnd* = NULL);
-
- enum { IDD = IDD_HELLOSERVER_DIALOG };
-
-protected:
- virtual void DoDataExchange(CDataExchange*); // DDX/DDV support
-
-protected:
- Ice::CommunicatorPtr _communicator;
- LogIPtr _log;
- CEdit* _edit;
- HICON _hIcon;
-
- // Generated message map functions
- virtual BOOL OnInitDialog();
- virtual void OnCancel();
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- afx_msg void OnShutdown();
- afx_msg void OnClear();
+ +#ifndef HELLO_SERVER_DLG_H +#define HELLO_SERVER_DLG_H + +#pragma once + +#include "LogI.h" + +class CHelloServerDlg : public CDialog +{ +public: + CHelloServerDlg(const Ice::CommunicatorPtr&, const LogIPtr&, CWnd* = NULL); + + enum { IDD = IDD_HELLOSERVER_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange*); // DDX/DDV support + +protected: + Ice::CommunicatorPtr _communicator; + LogIPtr _log; + CEdit* _edit; + HICON _hIcon; + + // Generated message map functions + virtual BOOL OnInitDialog(); + virtual void OnCancel(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnShutdown(); + afx_msg void OnClear(); afx_msg LRESULT OnLog(WPARAM, LPARAM); - DECLARE_MESSAGE_MAP()
-};
-
-#endif
+ DECLARE_MESSAGE_MAP() +}; + +#endif diff --git a/cpp/demo/Ice/MFC/server/Resource.h b/cpp/demo/Ice/MFC/server/Resource.h index aa36843484c..fd2966fc9b1 100644 --- a/cpp/demo/Ice/MFC/server/Resource.h +++ b/cpp/demo/Ice/MFC/server/Resource.h @@ -1,20 +1,20 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by HelloServer.rc
-//
-#define IDD_HELLOSERVER_DIALOG 101
-#define IDR_MAINFRAME 128
-#define IDC_SHUTDOWN 1001
-#define IDC_CLEAR 1002
-#define IDC_LOG 1003
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 130
-#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1004
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by HelloServer.rc +// +#define IDD_HELLOSERVER_DIALOG 101 +#define IDR_MAINFRAME 128 +#define IDC_SHUTDOWN 1001 +#define IDC_CLEAR 1002 +#define IDC_LOG 1003 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/cpp/demo/Ice/MFC/server/stdafx.cpp b/cpp/demo/Ice/MFC/server/stdafx.cpp index e46a30ff629..59971dfb70f 100644 --- a/cpp/demo/Ice/MFC/server/stdafx.cpp +++ b/cpp/demo/Ice/MFC/server/stdafx.cpp @@ -7,11 +7,11 @@ // // ********************************************************************** -
-// stdafx.cpp : source file that includes just the standard includes
-// HelloServer.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-
+ +// stdafx.cpp : source file that includes just the standard includes +// HelloServer.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + diff --git a/cpp/demo/IceGrid/icebox/application.xml b/cpp/demo/IceGrid/icebox/application.xml index dd5e29675c0..7322dc8ae46 100644 --- a/cpp/demo/IceGrid/icebox/application.xml +++ b/cpp/demo/IceGrid/icebox/application.xml @@ -1,56 +1,56 @@ -<?xml version="1.0" encoding="UTF-8" ?>
-<!-- This file was written by IceGrid Admin -->
-<icegrid>
- <application name="HelloSimpsons">
- <service-template id="HelloService">
- <parameter name="name"/>
- <service name="${name}" entry="HelloService:create">
- <description>A very simple service named after ${name}</description>
- <properties>
- <property name="Hello.Identity" value="hello"/>
- </properties>
- <adapter name="Hello-${name}" endpoints="default" id="Hello-${name}" replica-group="HelloGroup" server-lifetime="false"/>
- </service>
- </service-template>
- <server-template id="Glacier2">
- <parameter name="instance-name" default="${application}.Glacier2"/>
- <parameter name="client-endpoints"/>
- <parameter name="server-endpoints"/>
- <parameter name="session-timeout" default="0"/>
- <server id="${instance-name}" activation="manual" exe="glacier2router">
- <properties>
- <property name="Ice.Admin.Endpoints" value="tcp -h 127.0.0.1"/>
- <property name="Glacier2.Client.Endpoints" value="${client-endpoints}"/>
- <property name="Glacier2.Server.Endpoints" value="${server-endpoints}"/>
- <property name="Glacier2.InstanceName" value="${instance-name}"/>
- <property name="Glacier2.SessionTimeout" value="${session-timeout}"/>
- </properties>
- </server>
- </server-template>
- <replica-group id="HelloGroup">
- <load-balancing type="round-robin" n-replicas="1"/>
- <object identity="hello" type="::Demo::Hello"/>
- </replica-group>
- <node name="node1">
- <server-instance template="Glacier2" instance-name="DemoGlacier2" client-endpoints="tcp -h localhost -p 4063" server-endpoints="tcp">
- <properties>
- <property name="Glacier2.SessionManager" value="DemoIceGrid/AdminSessionManager"/>
- <property name="Glacier2.PermissionsVerifier" value="DemoGlacier2/NullPermissionsVerifier"/>
- </properties>
- </server-instance>
- <icebox id="IceBox" activation="on-demand" exe="icebox">
- <description>A sample IceBox server</description>
- <properties>
- <property name="Ice.Admin.Endpoints" value="tcp -h 127.0.0.1"/>
- <property name="IceBox.InstanceName" value="${server}"/>
- <property name="IceBox.Trace.ServiceObserver" value="1"/>
- </properties>
- <service-instance template="HelloService" name="Homer"/>
- <service-instance template="HelloService" name="Marge"/>
- <service-instance template="HelloService" name="Bart"/>
- <service-instance template="HelloService" name="Lisa"/>
- <service-instance template="HelloService" name="Maggie"/>
- </icebox>
- </node>
- </application>
-</icegrid>
+<?xml version="1.0" encoding="UTF-8" ?> +<!-- This file was written by IceGrid Admin --> +<icegrid> + <application name="HelloSimpsons"> + <service-template id="HelloService"> + <parameter name="name"/> + <service name="${name}" entry="HelloService:create"> + <description>A very simple service named after ${name}</description> + <properties> + <property name="Hello.Identity" value="hello"/> + </properties> + <adapter name="Hello-${name}" endpoints="default" id="Hello-${name}" replica-group="HelloGroup" server-lifetime="false"/> + </service> + </service-template> + <server-template id="Glacier2"> + <parameter name="instance-name" default="${application}.Glacier2"/> + <parameter name="client-endpoints"/> + <parameter name="server-endpoints"/> + <parameter name="session-timeout" default="0"/> + <server id="${instance-name}" activation="manual" exe="glacier2router"> + <properties> + <property name="Ice.Admin.Endpoints" value="tcp -h 127.0.0.1"/> + <property name="Glacier2.Client.Endpoints" value="${client-endpoints}"/> + <property name="Glacier2.Server.Endpoints" value="${server-endpoints}"/> + <property name="Glacier2.InstanceName" value="${instance-name}"/> + <property name="Glacier2.SessionTimeout" value="${session-timeout}"/> + </properties> + </server> + </server-template> + <replica-group id="HelloGroup"> + <load-balancing type="round-robin" n-replicas="1"/> + <object identity="hello" type="::Demo::Hello"/> + </replica-group> + <node name="node1"> + <server-instance template="Glacier2" instance-name="DemoGlacier2" client-endpoints="tcp -h localhost -p 4063" server-endpoints="tcp"> + <properties> + <property name="Glacier2.SessionManager" value="DemoIceGrid/AdminSessionManager"/> + <property name="Glacier2.PermissionsVerifier" value="DemoGlacier2/NullPermissionsVerifier"/> + </properties> + </server-instance> + <icebox id="IceBox" activation="on-demand" exe="icebox"> + <description>A sample IceBox server</description> + <properties> + <property name="Ice.Admin.Endpoints" value="tcp -h 127.0.0.1"/> + <property name="IceBox.InstanceName" value="${server}"/> + <property name="IceBox.Trace.ServiceObserver" value="1"/> + </properties> + <service-instance template="HelloService" name="Homer"/> + <service-instance template="HelloService" name="Marge"/> + <service-instance template="HelloService" name="Bart"/> + <service-instance template="HelloService" name="Lisa"/> + <service-instance template="HelloService" name="Maggie"/> + </icebox> + </node> + </application> +</icegrid> diff --git a/cpp/demo/IcePatch2/MFC/README b/cpp/demo/IcePatch2/MFC/README index cfc206a063b..78c1ffbf286 100644 --- a/cpp/demo/IcePatch2/MFC/README +++ b/cpp/demo/IcePatch2/MFC/README @@ -1,41 +1,41 @@ -This demo illustrates how to use MFC to create a simple IcePatch2
-client application.
-
-In order to use this demo, you must first prepare a sample data
-directory for the IcePatch2 server. The contents of the data
-directory are what the client will receive during the patch process.
-For convenience, this example uses its own source files as the data
-to be patched.
-
-Assuming that your current working directory is demo/IcePatch2/MFC,
-you can prepare the data files with the following command:
-
-> icepatch2calc .
-
-Next, start the IcePatch2 server. Note that the trailing "." argument
-in the following command is required and directs the server to use the
-current directory as its data directory:
-
-> icepatch2server --IcePatch2.Endpoints="tcp -h 127.0.0.1 -p 10000" .
-
-Before we start the patch client, we must first create an empty
-directory where the downloaded files will be placed. For example, open
-a new command window and execute this command:
-
-> mkdir C:\icepatch_download
-
-Now you can start the IcePatch2 client (You will also need to pass an
-argument that defines IcePatch2.Endpoints if you use an endpoint other
-than the one shown above when you start icepatch2server):
-
-> client
-
-Click the "..." button to the right of the Patch Directory field and
-select the empty directory you just created. Then click the "Patch"
-button to begin the patch process. The first time you click this
-button you will be prompted to confirm that you want to perform a
-thorough patch (because the target download directory is empty).
-
-If you add files or delete files from the data directory or make
-changes to existing files, you must stop the server, run icepatch2calc
-again to update the data files, and then restart the IcePatch2 server.
+This demo illustrates how to use MFC to create a simple IcePatch2 +client application. + +In order to use this demo, you must first prepare a sample data +directory for the IcePatch2 server. The contents of the data +directory are what the client will receive during the patch process. +For convenience, this example uses its own source files as the data +to be patched. + +Assuming that your current working directory is demo/IcePatch2/MFC, +you can prepare the data files with the following command: + +> icepatch2calc . + +Next, start the IcePatch2 server. Note that the trailing "." argument +in the following command is required and directs the server to use the +current directory as its data directory: + +> icepatch2server --IcePatch2.Endpoints="tcp -h 127.0.0.1 -p 10000" . + +Before we start the patch client, we must first create an empty +directory where the downloaded files will be placed. For example, open +a new command window and execute this command: + +> mkdir C:\icepatch_download + +Now you can start the IcePatch2 client (You will also need to pass an +argument that defines IcePatch2.Endpoints if you use an endpoint other +than the one shown above when you start icepatch2server): + +> client + +Click the "..." button to the right of the Patch Directory field and +select the empty directory you just created. Then click the "Patch" +button to begin the patch process. The first time you click this +button you will be prompted to confirm that you want to perform a +thorough patch (because the target download directory is empty). + +If you add files or delete files from the data directory or make +changes to existing files, you must stop the server, run icepatch2calc +again to update the data files, and then restart the IcePatch2 server. diff --git a/cpp/demo/IcePatch2/MFC/resource.h b/cpp/demo/IcePatch2/MFC/resource.h index d97e574378b..3f5dfd7febc 100644 --- a/cpp/demo/IcePatch2/MFC/resource.h +++ b/cpp/demo/IcePatch2/MFC/resource.h @@ -1,36 +1,36 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by PatchClient.rc
-//
-#define IDD_PATCHCLIENT_DIALOG 101
-#define IDR_MAINFRAME 128
-#define IDC_MODELABEL 1000
-#define IDC_MODE 1001
-#define IDC_SECURE 1002
-#define IDC_TIMEOUT 1003
-#define IDC_INVOKE 1004
-#define IDC_FLUSH 1005
-#define IDC_SHUTDOWN 1006
-#define IDC_STATUSBAR 1007
-#define IDC_PROGRESS 1008
-#define IDC_PERCENT 1009
-#define IDC_STARTPATCH 1010
-#define IDC_CANCELPATCH 1011
-#define IDC_THOROUGH 1015
-#define IDC_PATH 1016
-#define IDC_SELECTDIR 1017
-#define IDC_ORPHAN 1018
-#define IDC_FILE 1023
-#define IDC_TOTAL 1024
-#define IDC_SPEED 1025
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 130
-#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1026
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by PatchClient.rc +// +#define IDD_PATCHCLIENT_DIALOG 101 +#define IDR_MAINFRAME 128 +#define IDC_MODELABEL 1000 +#define IDC_MODE 1001 +#define IDC_SECURE 1002 +#define IDC_TIMEOUT 1003 +#define IDC_INVOKE 1004 +#define IDC_FLUSH 1005 +#define IDC_SHUTDOWN 1006 +#define IDC_STATUSBAR 1007 +#define IDC_PROGRESS 1008 +#define IDC_PERCENT 1009 +#define IDC_STARTPATCH 1010 +#define IDC_CANCELPATCH 1011 +#define IDC_THOROUGH 1015 +#define IDC_PATH 1016 +#define IDC_SELECTDIR 1017 +#define IDC_ORPHAN 1018 +#define IDC_FILE 1023 +#define IDC_TOTAL 1024 +#define IDC_SPEED 1025 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1026 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/cpp/demo/book/evictor_filesystem/Scanner.cpp b/cpp/demo/book/evictor_filesystem/Scanner.cpp index 4a6a9c0ab78..7b654a5b6ca 100755 --- a/cpp/demo/book/evictor_filesystem/Scanner.cpp +++ b/cpp/demo/book/evictor_filesystem/Scanner.cpp @@ -1,4 +1,4 @@ -#include "IceUtil/Config.h"
+#include "IceUtil/Config.h" /* A lexical scanner generated by flex */ /* Scanner skeleton version: diff --git a/cpp/demo/book/lifecycle/Scanner.cpp b/cpp/demo/book/lifecycle/Scanner.cpp index 4a6a9c0ab78..7b654a5b6ca 100755 --- a/cpp/demo/book/lifecycle/Scanner.cpp +++ b/cpp/demo/book/lifecycle/Scanner.cpp @@ -1,4 +1,4 @@ -#include "IceUtil/Config.h"
+#include "IceUtil/Config.h" /* A lexical scanner generated by flex */ /* Scanner skeleton version: diff --git a/cpp/demo/book/map_filesystem/Scanner.cpp b/cpp/demo/book/map_filesystem/Scanner.cpp index 4a6a9c0ab78..7b654a5b6ca 100644 --- a/cpp/demo/book/map_filesystem/Scanner.cpp +++ b/cpp/demo/book/map_filesystem/Scanner.cpp @@ -1,4 +1,4 @@ -#include "IceUtil/Config.h"
+#include "IceUtil/Config.h" /* A lexical scanner generated by flex */ /* Scanner skeleton version: |