diff --git a/cpp11/C++11 demos (Universal Windows).sln b/cpp11/C++11 demos (Universal Windows).sln deleted file mode 100644 index fbb54033c0..0000000000 --- a/cpp11/C++11 demos (Universal Windows).sln +++ /dev/null @@ -1,105 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ice", "Ice", "{C810DCB4-0B6A-40CF-B451-8DFA21C1CC6C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Glacier2", "Glacier2", "{968933D7-409C-4C20-9776-3AB5CD3A602C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simpleChat", "Glacier2\uwp\simpleChat\simpleChat.uwp.vcxproj", "{0F61C1A6-2A63-4044-94A6-DDBA1D279300}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hello", "hello", "{22A4B26C-81E4-423C-9621-F7139AE5830D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "Ice\uwp\hello\client\hello.client.uwp.vcxproj", "{C8173321-AB8B-4F46-8508-FB99A909B179}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "Ice\uwp\hello\server\hello.server.uwp.vcxproj", "{73F087ED-0995-4EC7-850E-52F73558CA5E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bidir", "bidir", "{69C6100D-F84C-4149-8BE5-C40397536061}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "Ice\uwp\bidir\client\bidir.client.uwp.vcxproj", "{11AF79C7-8E73-4CFA-AA03-41C45027C7BB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "Ice\uwp\bidir\server\bidir.server.uwp.vcxproj", "{647C6FD3-E5E5-4451-949D-A41D2A911868}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Debug|Win32.ActiveCfg = Debug|Win32 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Debug|Win32.Build.0 = Debug|Win32 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Debug|Win32.Deploy.0 = Debug|Win32 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Debug|x64.ActiveCfg = Debug|x64 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Debug|x64.Build.0 = Debug|x64 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Debug|x64.Deploy.0 = Debug|x64 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Release|Win32.ActiveCfg = Release|Win32 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Release|Win32.Build.0 = Release|Win32 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Release|Win32.Deploy.0 = Release|Win32 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Release|x64.ActiveCfg = Release|x64 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Release|x64.Build.0 = Release|x64 - {0F61C1A6-2A63-4044-94A6-DDBA1D279300}.Release|x64.Deploy.0 = Release|x64 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Debug|Win32.ActiveCfg = Debug|Win32 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Debug|Win32.Build.0 = Debug|Win32 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Debug|Win32.Deploy.0 = Debug|Win32 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Debug|x64.ActiveCfg = Debug|x64 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Debug|x64.Build.0 = Debug|x64 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Debug|x64.Deploy.0 = Debug|x64 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Release|Win32.ActiveCfg = Release|Win32 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Release|Win32.Build.0 = Release|Win32 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Release|Win32.Deploy.0 = Release|Win32 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Release|x64.ActiveCfg = Release|x64 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Release|x64.Build.0 = Release|x64 - {C8173321-AB8B-4F46-8508-FB99A909B179}.Release|x64.Deploy.0 = Release|x64 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Debug|Win32.ActiveCfg = Debug|Win32 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Debug|Win32.Build.0 = Debug|Win32 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Debug|Win32.Deploy.0 = Debug|Win32 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Debug|x64.ActiveCfg = Debug|x64 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Debug|x64.Build.0 = Debug|x64 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Debug|x64.Deploy.0 = Debug|x64 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Release|Win32.ActiveCfg = Release|Win32 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Release|Win32.Build.0 = Release|Win32 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Release|Win32.Deploy.0 = Release|Win32 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Release|x64.ActiveCfg = Release|x64 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Release|x64.Build.0 = Release|x64 - {73F087ED-0995-4EC7-850E-52F73558CA5E}.Release|x64.Deploy.0 = Release|x64 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Debug|Win32.ActiveCfg = Debug|Win32 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Debug|Win32.Build.0 = Debug|Win32 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Debug|Win32.Deploy.0 = Debug|Win32 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Debug|x64.ActiveCfg = Debug|x64 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Debug|x64.Build.0 = Debug|x64 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Debug|x64.Deploy.0 = Debug|x64 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Release|Win32.ActiveCfg = Release|Win32 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Release|Win32.Build.0 = Release|Win32 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Release|Win32.Deploy.0 = Release|Win32 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Release|x64.ActiveCfg = Release|x64 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Release|x64.Build.0 = Release|x64 - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB}.Release|x64.Deploy.0 = Release|x64 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Debug|Win32.ActiveCfg = Debug|Win32 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Debug|Win32.Build.0 = Debug|Win32 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Debug|Win32.Deploy.0 = Debug|Win32 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Debug|x64.ActiveCfg = Debug|x64 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Debug|x64.Build.0 = Debug|x64 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Debug|x64.Deploy.0 = Debug|x64 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Release|Win32.ActiveCfg = Release|Win32 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Release|Win32.Build.0 = Release|Win32 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Release|Win32.Deploy.0 = Release|Win32 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Release|x64.ActiveCfg = Release|x64 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Release|x64.Build.0 = Release|x64 - {647C6FD3-E5E5-4451-949D-A41D2A911868}.Release|x64.Deploy.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {0F61C1A6-2A63-4044-94A6-DDBA1D279300} = {968933D7-409C-4C20-9776-3AB5CD3A602C} - {22A4B26C-81E4-423C-9621-F7139AE5830D} = {C810DCB4-0B6A-40CF-B451-8DFA21C1CC6C} - {C8173321-AB8B-4F46-8508-FB99A909B179} = {22A4B26C-81E4-423C-9621-F7139AE5830D} - {73F087ED-0995-4EC7-850E-52F73558CA5E} = {22A4B26C-81E4-423C-9621-F7139AE5830D} - {69C6100D-F84C-4149-8BE5-C40397536061} = {C810DCB4-0B6A-40CF-B451-8DFA21C1CC6C} - {11AF79C7-8E73-4CFA-AA03-41C45027C7BB} = {69C6100D-F84C-4149-8BE5-C40397536061} - {647C6FD3-E5E5-4451-949D-A41D2A911868} = {69C6100D-F84C-4149-8BE5-C40397536061} - EndGlobalSection -EndGlobal diff --git a/cpp11/Chat/client/ChatUtils.cpp b/cpp11/Chat/client/ChatUtils.cpp index 0955813033..c862a76b17 100644 --- a/cpp11/Chat/client/ChatUtils.cpp +++ b/cpp11/Chat/client/ChatUtils.cpp @@ -20,13 +20,13 @@ string ChatUtils::unstripHtml(const string& s) { string out = s; - for(unsigned int count = 0; count < sizeof(htmlEntities) / sizeof(htmlEntities[0]); ++count) + for(const HtmlEntity& entity : htmlEntities) { - for(string::size_type pos = out.find(htmlEntities[count].first); + for(string::size_type pos = out.find(entity.first); pos != string::npos; - pos = out.find(htmlEntities[count].first, pos)) + pos = out.find(entity.first, pos)) { - out.replace(pos, htmlEntities[count].first.size(), htmlEntities[count].second); + out.replace(pos, entity.first.size(), entity.second); } } return out; @@ -36,7 +36,7 @@ string ChatUtils::trim(const string& s) { static const string delims = "\t\r\n "; - string::size_type last = s.find_last_not_of(delims); + const string::size_type last = s.find_last_not_of(delims); if(last != string::npos) { return s.substr(s.find_first_not_of(delims), last+1); diff --git a/cpp11/Chat/client/Client.cpp b/cpp11/Chat/client/Client.cpp index 6e3caa7bf5..d325d4b0b5 100644 --- a/cpp11/Chat/client/Client.cpp +++ b/cpp11/Chat/client/Client.cpp @@ -27,7 +27,7 @@ class ChatRoomCallbackI : public Chat::ChatRoomCallback virtual void init(Ice::StringSeq names, const Ice::Current&) override { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "Users: "; for(auto it = names.begin(); it != names.end();) { @@ -44,21 +44,21 @@ class ChatRoomCallbackI : public Chat::ChatRoomCallback virtual void join(long long, string name, const Ice::Current&) override { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << ">>>> " << name << " joined." << endl; } virtual void leave(long long, string name, const Ice::Current&) override { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "<<<< " << name << " left." << endl; } virtual void send(long long, string name, string message, const Ice::Current&) override { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << name << " > " << ChatUtils::unstripHtml(message) << endl; } }; @@ -156,7 +156,7 @@ class ChatClient : public Glacier2::Application { if(s.size() > maxMessageSize) { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "Message length exceeded, maximum length is " << maxMessageSize << " characters."; } else @@ -175,7 +175,7 @@ class ChatClient : public Glacier2::Application void menu() { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "enter /quit to exit." << endl; } }; diff --git a/cpp11/Chat/client/PollingClient.cpp b/cpp11/Chat/client/PollingClient.cpp index 6e68b0a902..a46bb8aa26 100644 --- a/cpp11/Chat/client/PollingClient.cpp +++ b/cpp11/Chat/client/PollingClient.cpp @@ -23,7 +23,7 @@ class GetUpdatesTask { public: - GetUpdatesTask(const shared_ptr& session) : + explicit GetUpdatesTask(const shared_ptr& session) : _session(session) { } @@ -31,7 +31,7 @@ class GetUpdatesTask ~GetUpdatesTask() { { - lock_guard lock(_mutex); + const lock_guard lock(_mutex); _done = true; } _cond.notify_all(); @@ -67,7 +67,7 @@ class GetUpdatesTask auto joinedEvt = dynamic_pointer_cast(u); if(joinedEvt) { - lock_guard lkg(coutMutex); + const lock_guard lkg(coutMutex); cout << ">>>> " << joinedEvt->name << " joined." << endl; } else @@ -75,7 +75,7 @@ class GetUpdatesTask auto leftEvt = dynamic_pointer_cast(u); if(leftEvt) { - lock_guard lkg(coutMutex); + const lock_guard lkg(coutMutex); cout << ">>>> " << leftEvt->name << " left." << endl; } else @@ -83,7 +83,7 @@ class GetUpdatesTask auto messageEvt = dynamic_pointer_cast(u); if(messageEvt) { - lock_guard lkg(coutMutex); + const lock_guard lkg(coutMutex); cout << messageEvt->name << " > " << ChatUtils::unstripHtml(messageEvt->message) << endl; } } @@ -93,7 +93,7 @@ class GetUpdatesTask catch(const Ice::LocalException& ex) { { - lock_guard lkg(_mutex); + const lock_guard lkg(_mutex); _done = true; } if(!dynamic_cast(&ex)) @@ -112,7 +112,7 @@ class GetUpdatesTask bool isDone() const { - lock_guard lock(const_cast(_mutex)); + const lock_guard lock(const_cast(_mutex)); return _done; } @@ -157,7 +157,7 @@ main(int argc, char* argv[]) initData.properties->setProperty("OverrideSessionEndpoints", "1"); } - Ice::CommunicatorHolder ich(argc, argv, initData); + const Ice::CommunicatorHolder ich(argc, argv, initData); if(argc > 1) { @@ -242,7 +242,7 @@ run(const shared_ptr& communicator) auto users = session->getInitialUsers(); { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "Users: "; for(auto it = users.begin(); it != users.end();) { @@ -278,7 +278,7 @@ run(const shared_ptr& communicator) { if(s.size() > maxMessageSize) { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "Message length exceeded, maximum length is " << maxMessageSize << " characters."; } else @@ -316,6 +316,6 @@ run(const shared_ptr& communicator) void menu() { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "enter /quit to exit." << endl; } diff --git a/cpp11/Chat/client/msbuild/chatgl2client/chatgl2client.vcxproj b/cpp11/Chat/client/msbuild/chatgl2client/chatgl2client.vcxproj index 84b5d75786..93089cd9c4 100644 --- a/cpp11/Chat/client/msbuild/chatgl2client/chatgl2client.vcxproj +++ b/cpp11/Chat/client/msbuild/chatgl2client/chatgl2client.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -55,11 +55,11 @@ - - - + + + - + @@ -277,15 +277,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Chat/client/msbuild/chatgl2client/packages.config b/cpp11/Chat/client/msbuild/chatgl2client/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Chat/client/msbuild/chatgl2client/packages.config +++ b/cpp11/Chat/client/msbuild/chatgl2client/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Chat/client/msbuild/chatpollclient/chatpollclient.vcxproj b/cpp11/Chat/client/msbuild/chatpollclient/chatpollclient.vcxproj index c993ae7a85..547781de3a 100644 --- a/cpp11/Chat/client/msbuild/chatpollclient/chatpollclient.vcxproj +++ b/cpp11/Chat/client/msbuild/chatpollclient/chatpollclient.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -165,11 +165,11 @@ - - - + + + - + @@ -274,15 +274,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Chat/client/msbuild/chatpollclient/packages.config b/cpp11/Chat/client/msbuild/chatpollclient/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Chat/client/msbuild/chatpollclient/packages.config +++ b/cpp11/Chat/client/msbuild/chatpollclient/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Chat/server/ChatRoom.cpp b/cpp11/Chat/server/ChatRoom.cpp index 1c7a34f4a2..1b42904cb8 100644 --- a/cpp11/Chat/server/ChatRoom.cpp +++ b/cpp11/Chat/server/ChatRoom.cpp @@ -15,7 +15,7 @@ ChatRoom::ChatRoom(bool trace, const shared_ptr& logger) : void ChatRoom::reserve(const string& name) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_reserved.find(name) != _reserved.end() || _members.find(name) != _members.end()) { throw runtime_error("The name " + name + " is already in use."); @@ -26,15 +26,16 @@ ChatRoom::reserve(const string& name) void ChatRoom::unreserve(const string& name) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _reserved.erase(name); } void ChatRoom::join(const string& name, const shared_ptr& callback) { - lock_guard sync(_mutex); - long long timestamp = chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); + const lock_guard sync(_mutex); + const long long timestamp = + chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); _reserved.erase(name); @@ -44,7 +45,7 @@ ChatRoom::join(const string& name, const shared_ptr& ca names.push_back(q.first); } - callback->init(move(names)); + callback->init(std::move(names)); _members[name] = callback; @@ -64,8 +65,9 @@ ChatRoom::join(const string& name, const shared_ptr& ca void ChatRoom::leave(const string& name) { - lock_guard sync(_mutex); - long long timestamp = chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); + const lock_guard sync(_mutex); + const long long timestamp = + chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); _members.erase(name); @@ -83,10 +85,11 @@ ChatRoom::leave(const string& name) } Ice::Long -ChatRoom::send(const string& name, string message) +ChatRoom::send(const string& name, const string& message) { - lock_guard sync(_mutex); - long long timestamp = chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); + const lock_guard sync(_mutex); + const long long timestamp = + chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); auto e = make_shared(timestamp, name, message); for(const auto& q: _members) diff --git a/cpp11/Chat/server/ChatRoom.h b/cpp11/Chat/server/ChatRoom.h index 9effe7f33a..d49db695e9 100644 --- a/cpp11/Chat/server/ChatRoom.h +++ b/cpp11/Chat/server/ChatRoom.h @@ -30,7 +30,7 @@ class ChatRoom void unreserve(const std::string&); void join(const std::string&, const std::shared_ptr&); void leave(const std::string&); - long long send(const std::string&, std::string); + long long send(const std::string&, const std::string&); private: diff --git a/cpp11/Chat/server/ChatServer.cpp b/cpp11/Chat/server/ChatServer.cpp index 7893ddc542..e5b0560891 100644 --- a/cpp11/Chat/server/ChatServer.cpp +++ b/cpp11/Chat/server/ChatServer.cpp @@ -23,8 +23,8 @@ class ChatServer : public Ice::Service bool ChatServer::start(int, char*[], int& status) { - int timeout = communicator()->getProperties()->getPropertyAsIntWithDefault("PollingChatSessionTimeout", 10); - bool traceEnabled = communicator()->getProperties()->getPropertyAsIntWithDefault("Server.Trace", 0) != 0; + const int timeout = communicator()->getProperties()->getPropertyAsIntWithDefault("PollingChatSessionTimeout", 10); + const bool traceEnabled = communicator()->getProperties()->getPropertyAsIntWithDefault("Server.Trace", 0) != 0; auto logger = communicator()->getLogger(); try diff --git a/cpp11/Chat/server/ChatSessionI.cpp b/cpp11/Chat/server/ChatSessionI.cpp index f5667b1186..d14b337003 100644 --- a/cpp11/Chat/server/ChatSessionI.cpp +++ b/cpp11/Chat/server/ChatSessionI.cpp @@ -14,12 +14,14 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, SessionCallbackAdapter(const shared_ptr& callback, const shared_ptr& session, - bool trace, const shared_ptr& logger, const std::string& name) : + bool trace, + const shared_ptr& logger, + std::string name) : _callback(callback), _session(session), _trace(trace), _logger(logger), - _name(name) + _name(std::move(name)) { } @@ -28,7 +30,7 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, auto self = shared_from_this(); try { - _callback->initAsync(users, nullptr, [self](std::exception_ptr eptr) { self->failed(eptr); }); + _callback->initAsync(users, nullptr, [self](exception_ptr) { self->failed(); }); } catch(const Ice::CommunicatorDestroyedException&) { @@ -41,20 +43,20 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, auto self = shared_from_this(); try { - _callback->joinAsync(e->timestamp, e->name, nullptr, [self](exception_ptr eptr) { self->failed(eptr); }); + _callback->joinAsync(e->timestamp, e->name, nullptr, [self](exception_ptr) { self->failed(); }); } catch(const Ice::CommunicatorDestroyedException&) { // Ignored server is being shutdown } - } + } void leave(const shared_ptr& e) override { auto self = shared_from_this(); try { - _callback->leaveAsync(e->timestamp, e->name, nullptr, [self](exception_ptr eptr) { self->failed(eptr); }); + _callback->leaveAsync(e->timestamp, e->name, nullptr, [self](exception_ptr) { self->failed(); }); } catch(const Ice::CommunicatorDestroyedException&) { @@ -67,7 +69,7 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, auto self = shared_from_this(); try { - _callback->sendAsync(e->timestamp, e->name, e->message, nullptr, [self](exception_ptr eptr) { self->failed(eptr); }); + _callback->sendAsync(e->timestamp, e->name, e->message, nullptr, [self](exception_ptr) { self->failed(); }); } catch(const Ice::CommunicatorDestroyedException&) { @@ -75,7 +77,7 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, } } - void failed(exception_ptr) + void failed() { if(_trace) { @@ -100,9 +102,9 @@ class SessionCallbackAdapter : public ChatRoomCallbackAdapter, const string _name; }; -ChatSessionI::ChatSessionI(const shared_ptr& chatRoom, const string& name, bool trace, const shared_ptr& logger) : +ChatSessionI::ChatSessionI(const shared_ptr& chatRoom, string name, bool trace, const shared_ptr& logger) : _chatRoom(chatRoom), - _name(name), + _name(std::move(name)), _trace(trace), _logger(logger) { @@ -111,7 +113,7 @@ ChatSessionI::ChatSessionI(const shared_ptr& chatRoom, const string& n void ChatSessionI::setCallback(shared_ptr callback, const Ice::Current& current) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) @@ -139,7 +141,7 @@ ChatSessionI::setCallback(shared_ptr callback, const long long ChatSessionI::send(string message, const Ice::Current&) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) @@ -172,13 +174,13 @@ ChatSessionI::send(string message, const Ice::Current&) } throw Chat::InvalidMessageException(ex.what()); } - return _chatRoom->send(_name, move(msg)); + return _chatRoom->send(_name, msg); } void ChatSessionI::destroy(const Ice::Current& current) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) diff --git a/cpp11/Chat/server/ChatSessionI.h b/cpp11/Chat/server/ChatSessionI.h index 778c40acb8..624dee2ef3 100644 --- a/cpp11/Chat/server/ChatSessionI.h +++ b/cpp11/Chat/server/ChatSessionI.h @@ -12,7 +12,7 @@ class ChatSessionI : public Chat::ChatSession { public: - ChatSessionI(const std::shared_ptr&, const std::string&, bool trace, const std::shared_ptr& logger); + ChatSessionI(const std::shared_ptr&, std::string, bool trace, const std::shared_ptr& logger); virtual void setCallback(std::shared_ptr, const Ice::Current&) override; virtual long long send(std::string, const Ice::Current&) override; diff --git a/cpp11/Chat/server/ChatUtils.cpp b/cpp11/Chat/server/ChatUtils.cpp index a12e84630c..c8eeab95cf 100644 --- a/cpp11/Chat/server/ChatUtils.cpp +++ b/cpp11/Chat/server/ChatUtils.cpp @@ -54,7 +54,7 @@ validateMessage(const string& in) } // Strip html codes in the message string out; - for(char c : in) + for(const char c : in) { switch(c) { diff --git a/cpp11/Chat/server/PollingChatSessionI.cpp b/cpp11/Chat/server/PollingChatSessionI.cpp index d30567d302..51d32d0f0a 100644 --- a/cpp11/Chat/server/PollingChatSessionI.cpp +++ b/cpp11/Chat/server/PollingChatSessionI.cpp @@ -14,35 +14,35 @@ class PollCallbackAdapter : public ChatRoomCallbackAdapter virtual void init(Ice::StringSeq users) override { - lock_guard sync(_mutex); - _users = move(users); + const lock_guard sync(_mutex); + _users = std::move(users); } virtual void send(const shared_ptr& e) override { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _updates.push_back(e); } virtual void join(const shared_ptr& e) override { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _updates.push_back(e); } virtual void leave(const shared_ptr& e) override { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _updates.push_back(e); } Ice::StringSeq getInitialUsers() { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); Ice::StringSeq users; users.swap(_users); return users; @@ -51,7 +51,7 @@ class PollCallbackAdapter : public ChatRoomCallbackAdapter PollingChat::ChatRoomEventSeq getUpdates() { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); PollingChat::ChatRoomEventSeq updates; updates.swap(_updates); return updates; @@ -78,7 +78,7 @@ PollingChatSessionI::PollingChatSessionI(const shared_ptr& chatRoom, c Ice::StringSeq PollingChatSessionI::getInitialUsers(const Ice::Current&) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) @@ -94,7 +94,7 @@ PollingChatSessionI::getInitialUsers(const Ice::Current&) PollingChat::ChatRoomEventSeq PollingChatSessionI::getUpdates(const Ice::Current&) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) @@ -110,7 +110,7 @@ PollingChatSessionI::getUpdates(const Ice::Current&) Ice::Long PollingChatSessionI::send(string message, const Ice::Current&) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) @@ -134,13 +134,13 @@ PollingChatSessionI::send(string message, const Ice::Current&) } throw Chat::InvalidMessageException(ex.what()); } - return _chatRoom->send(_name, move(msg)); + return _chatRoom->send(_name, std::move(msg)); } void PollingChatSessionI::destroy(const Ice::Current& current) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_destroy) { if(_trace) diff --git a/cpp11/Chat/server/msbuild/packages.config b/cpp11/Chat/server/msbuild/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Chat/server/msbuild/packages.config +++ b/cpp11/Chat/server/msbuild/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Chat/server/msbuild/server.vcxproj b/cpp11/Chat/server/msbuild/server.vcxproj index 413a90663f..7a40d106be 100644 --- a/cpp11/Chat/server/msbuild/server.vcxproj +++ b/cpp11/Chat/server/msbuild/server.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -225,11 +225,11 @@ - - - + + + - + @@ -342,15 +342,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Glacier2/callback/Client.cpp b/cpp11/Glacier2/callback/Client.cpp index 4a62a42b55..dd077b1268 100644 --- a/cpp11/Glacier2/callback/Client.cpp +++ b/cpp11/Glacier2/callback/Client.cpp @@ -36,7 +36,7 @@ main(int argc, char* argv[]) // CommunicatorHolder's ctor initializes an Ice communicator, // and its dtor destroys this communicator. // - Ice::CommunicatorHolder ich(argc, argv, "config.client"); + const Ice::CommunicatorHolder ich(argc, argv, "config.client"); // // The communicator initialization removes all Ice-related arguments from argc/argv @@ -64,7 +64,8 @@ void menu(); void run(const shared_ptr& communicator) { - shared_ptr router = Ice::checkedCast(communicator->getDefaultRouter()); + const shared_ptr router = + Ice::checkedCast(communicator->getDefaultRouter()); shared_ptr session; // // Loop until we have successfully create a session. @@ -103,8 +104,8 @@ run(const shared_ptr& communicator) } } - Ice::Int acmTimeout = router->getACMTimeout(); - Ice::ConnectionPtr connection = router->ice_getCachedConnection(); + const Ice::Int acmTimeout = router->getACMTimeout(); + const Ice::ConnectionPtr connection = router->ice_getCachedConnection(); assert(connection); connection->setACM(acmTimeout, IceUtil::None, Ice::ACMHeartbeat::HeartbeatAlways); connection->setCloseCallback([](Ice::ConnectionPtr) diff --git a/cpp11/Glacier2/callback/README.md b/cpp11/Glacier2/callback/README.md index c8d0de4de4..dddd86885b 100644 --- a/cpp11/Glacier2/callback/README.md +++ b/cpp11/Glacier2/callback/README.md @@ -22,10 +22,9 @@ client If you plan to run this demo using clients on different hosts than the router, you must first modify the configuration. You need to change the `Glacier2.Client.Endpoints` property in `config.glacier2` and the -`Ice.Default.Router` and `Callback.Client.Router` properties in -`config.client`. In all cases you must replace the `-h 127.0.0.1` -parameter with the actual external address of the machine on which -glacier2router is running. +`Ice.Default.Router` property in `config.client`. In all cases you must +set the host parameter of the `-h host` endpoint option to the actual +address of the machine on which glacier2router is running. [1]: https://doc.zeroc.com/ice/3.7/ice-services/glacier2/callbacks-through-glacier2 [2]: https://doc.zeroc.com/ice/3.7/ice-services/glacier2/how-glacier2-uses-request-contexts diff --git a/cpp11/Glacier2/callback/Server.cpp b/cpp11/Glacier2/callback/Server.cpp index e128fdf8b5..3ba4e3caa1 100644 --- a/cpp11/Glacier2/callback/Server.cpp +++ b/cpp11/Glacier2/callback/Server.cpp @@ -27,8 +27,8 @@ int main(int argc, char* argv[]) // CommunicatorHolder's ctor initializes an Ice communicator, // and its dtor destroys this communicator. // - Ice::CommunicatorHolder ich(argc, argv, "config.server"); - auto communicator = ich.communicator(); + const Ice::CommunicatorHolder ich(argc, argv, "config.server"); + const auto& communicator = ich.communicator(); ctrlCHandler.setCallback( [communicator](int) diff --git a/cpp11/Glacier2/callback/msbuild/client/client.vcxproj b/cpp11/Glacier2/callback/msbuild/client/client.vcxproj index 04e14103d8..d909f9aff0 100644 --- a/cpp11/Glacier2/callback/msbuild/client/client.vcxproj +++ b/cpp11/Glacier2/callback/msbuild/client/client.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -55,11 +55,11 @@ - - - + + + - + @@ -264,15 +264,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Glacier2/callback/msbuild/client/packages.config b/cpp11/Glacier2/callback/msbuild/client/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Glacier2/callback/msbuild/client/packages.config +++ b/cpp11/Glacier2/callback/msbuild/client/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Glacier2/callback/msbuild/server/packages.config b/cpp11/Glacier2/callback/msbuild/server/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Glacier2/callback/msbuild/server/packages.config +++ b/cpp11/Glacier2/callback/msbuild/server/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Glacier2/callback/msbuild/server/server.vcxproj b/cpp11/Glacier2/callback/msbuild/server/server.vcxproj index 1b94db2f9d..9ce7629188 100644 --- a/cpp11/Glacier2/callback/msbuild/server/server.vcxproj +++ b/cpp11/Glacier2/callback/msbuild/server/server.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -55,11 +55,11 @@ - - - + + + - + @@ -265,15 +265,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Glacier2/simpleChat/ChatSessionI.cpp b/cpp11/Glacier2/simpleChat/ChatSessionI.cpp index b5419d08e3..0afa7f0b88 100644 --- a/cpp11/Glacier2/simpleChat/ChatSessionI.cpp +++ b/cpp11/Glacier2/simpleChat/ChatSessionI.cpp @@ -47,7 +47,7 @@ void ChatRoom::enter(const shared_ptr& session, const shared_ptr& callback, const Ice::Current& current) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _callbacks.push_back(callback); auto p = _connectionMap.find(current.con); @@ -81,7 +81,7 @@ ChatRoom::enter(const shared_ptr& session, const shared_ptr& callback, const Ice::Current& current) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _callbacks.remove_if([&callback](const shared_ptr& cb) { @@ -96,7 +96,7 @@ ChatRoom::leave(const shared_ptr& callback, const Ice::Current& void ChatRoom::message(const string& data) const { - lock_guard sync(const_cast(_mutex)); + const lock_guard sync(const_cast(_mutex)); for(const auto& cb : _callbacks) { cb->messageAsync(data); @@ -120,7 +120,7 @@ ChatRoom::deadRouter(const shared_ptr& con) list> sessions; { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); auto p = _connectionMap.find(con); if(p != _connectionMap.end()) { @@ -144,7 +144,7 @@ ChatRoom::destroy() // // We could also destroy each session first // - lock_guard sync(_mutex); + const lock_guard sync(_mutex); _callbacks.clear(); _connectionMap.clear(); } @@ -153,15 +153,15 @@ ChatRoom::destroy() // ChatSessionI // -ChatSessionI::ChatSessionI(const string& userId) : - _userId(userId) +ChatSessionI::ChatSessionI(string userId) : + _userId(std::move(userId)) { } void ChatSessionI::setCallback(shared_ptr callback, const Ice::Current& current) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(!_callback) { _callback = callback; @@ -174,7 +174,7 @@ ChatSessionI::setCallback(shared_ptr callback, const Ice::Curre void ChatSessionI::say(string data, const Ice::Current&) { - lock_guard sync(_mutex); + const lock_guard sync(_mutex); ChatRoom::instance()->message(_userId + " says: " + data); } @@ -182,7 +182,7 @@ void ChatSessionI::destroy(const Ice::Current& current) { cout << "Destroying session for " << _userId << endl; - lock_guard sync(_mutex); + const lock_guard sync(_mutex); if(_callback) { auto chatRoom = ChatRoom::instance(); @@ -200,7 +200,7 @@ ChatSessionI::destroy(const Ice::Current& current) shared_ptr ChatSessionManagerI::create(string userId, shared_ptr, const Ice::Current& current) { - Ice::Identity ident = { Ice::generateUUID(), "session" }; + const Ice::Identity ident = { Ice::generateUUID(), "session" }; return Ice::uncheckedCast(current.adapter->add(make_shared(userId), ident)); } diff --git a/cpp11/Glacier2/simpleChat/ChatSessionI.h b/cpp11/Glacier2/simpleChat/ChatSessionI.h index 23449a862c..ba714e5a2e 100644 --- a/cpp11/Glacier2/simpleChat/ChatSessionI.h +++ b/cpp11/Glacier2/simpleChat/ChatSessionI.h @@ -13,7 +13,7 @@ class ChatSessionI : public Demo::ChatSession { public: - ChatSessionI(const std::string&); + ChatSessionI(std::string); virtual void setCallback(std::shared_ptr, const Ice::Current&) override; virtual void say(std::string, const Ice::Current&) override; diff --git a/cpp11/Glacier2/simpleChat/Client.cpp b/cpp11/Glacier2/simpleChat/Client.cpp index b0e529dd7c..eccfbc0c6c 100644 --- a/cpp11/Glacier2/simpleChat/Client.cpp +++ b/cpp11/Glacier2/simpleChat/Client.cpp @@ -19,7 +19,7 @@ class ChatCallbackI : public ChatCallback virtual void message(string data, const Ice::Current&) override { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << data << endl; } }; @@ -41,7 +41,7 @@ main(int argc, char* argv[]) // CommunicatorHolder's ctor initializes an Ice communicator, // and its dtor destroys this communicator. // - Ice::CommunicatorHolder ich(argc, argv, "config.client"); + const Ice::CommunicatorHolder ich(argc, argv, "config.client"); // // The communicator initialization removes all Ice-related arguments from argc/argv @@ -70,7 +70,8 @@ string trim(const string&); void run(const shared_ptr& communicator) { - shared_ptr router = Ice::checkedCast(communicator->getDefaultRouter()); + const shared_ptr router = + Ice::checkedCast(communicator->getDefaultRouter()); shared_ptr session; while(!session) { @@ -99,13 +100,13 @@ run(const shared_ptr& communicator) } } - Ice::Int acmTimeout = router->getACMTimeout(); - Ice::ConnectionPtr connection = router->ice_getCachedConnection(); + const Ice::Int acmTimeout = router->getACMTimeout(); + const Ice::ConnectionPtr connection = router->ice_getCachedConnection(); assert(connection); connection->setACM(acmTimeout, IceUtil::None, Ice::ACMHeartbeat::HeartbeatAlways); connection->setCloseCallback([](Ice::ConnectionPtr) { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "The Glacier2 session has been destroyed." << endl; }); @@ -126,7 +127,7 @@ run(const shared_ptr& communicator) { string s; { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "==> "; } getline(cin, s); @@ -153,7 +154,7 @@ run(const shared_ptr& communicator) void menu() { - lock_guard lock(coutMutex); + const lock_guard lock(coutMutex); cout << "enter /quit to exit." << endl; } diff --git a/cpp11/Glacier2/simpleChat/README.md b/cpp11/Glacier2/simpleChat/README.md index 6d83e7b67d..31bceb7612 100644 --- a/cpp11/Glacier2/simpleChat/README.md +++ b/cpp11/Glacier2/simpleChat/README.md @@ -19,13 +19,13 @@ In a separate window, start the client: client ``` -If you plan to run this demo using clients running on different -hosts than the glacier2router, it is necessary to first modify the +If you plan to run this demo using clients running on different hosts +than the glacier2router, it is necessary to first modify the configuration. You need to change the `Glacier2.Client.Endpoints` -property in `config.glacier2` and the `Ice.Default.Router` and -`Chat.Client.Router` properties in config. In all cases you must -replace the `-h 127.0.0.1` parameter with the actual external address -of the machine on which glacier2router is running. +property in `config.glacier2` and the `Ice.Default.Router` property in +`config.client`. In all cases you must set the host parameter of the +`-h host` endpoint option to the actual external address of the machine +on which glacier2router is running. When using Glacier2 session, the Glacier2 router destroys your sessions when a client goes away and otherwise becomes unresponsive. diff --git a/cpp11/Glacier2/simpleChat/Server.cpp b/cpp11/Glacier2/simpleChat/Server.cpp index 9e2fac1ac0..5fdb9af141 100644 --- a/cpp11/Glacier2/simpleChat/Server.cpp +++ b/cpp11/Glacier2/simpleChat/Server.cpp @@ -40,8 +40,8 @@ int main(int argc, char* argv[]) // CommunicatorHolder's ctor initializes an Ice communicator, // and its dtor destroys this communicator. // - Ice::CommunicatorHolder ich(argc, argv, "config.server"); - auto communicator = ich.communicator(); + const Ice::CommunicatorHolder ich(argc, argv, "config.server"); + const auto& communicator = ich.communicator(); ctrlCHandler.setCallback( [communicator](int) diff --git a/cpp11/Glacier2/simpleChat/msbuild/client/client.vcxproj b/cpp11/Glacier2/simpleChat/msbuild/client/client.vcxproj index 394af6bd0e..4b9fa00c88 100644 --- a/cpp11/Glacier2/simpleChat/msbuild/client/client.vcxproj +++ b/cpp11/Glacier2/simpleChat/msbuild/client/client.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -55,11 +55,11 @@ - - - + + + - + @@ -263,15 +263,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Glacier2/simpleChat/msbuild/client/packages.config b/cpp11/Glacier2/simpleChat/msbuild/client/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Glacier2/simpleChat/msbuild/client/packages.config +++ b/cpp11/Glacier2/simpleChat/msbuild/client/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Glacier2/simpleChat/msbuild/server/packages.config b/cpp11/Glacier2/simpleChat/msbuild/server/packages.config index 3826287f84..1aedaea80f 100644 --- a/cpp11/Glacier2/simpleChat/msbuild/server/packages.config +++ b/cpp11/Glacier2/simpleChat/msbuild/server/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/cpp11/Glacier2/simpleChat/msbuild/server/server.vcxproj b/cpp11/Glacier2/simpleChat/msbuild/server/server.vcxproj index f34f82ca5c..25fb381f32 100644 --- a/cpp11/Glacier2/simpleChat/msbuild/server/server.vcxproj +++ b/cpp11/Glacier2/simpleChat/msbuild/server/server.vcxproj @@ -1,10 +1,10 @@  - + - - - + + + Debug @@ -55,11 +55,11 @@ - - - + + + - + @@ -276,15 +276,15 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + - - + + \ No newline at end of file diff --git a/cpp11/Glacier2/uwp/simpleChat/App.xaml b/cpp11/Glacier2/uwp/simpleChat/App.xaml deleted file mode 100644 index df7f37cb61..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/App.xaml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/cpp11/Glacier2/uwp/simpleChat/App.xaml.cpp b/cpp11/Glacier2/uwp/simpleChat/App.xaml.cpp deleted file mode 100644 index cead296550..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/App.xaml.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#include "pch.h" -#include "MainPage.xaml.h" - -using namespace simpleChat; - -using namespace Platform; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Activation; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Interop; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; - -App::App() -{ - InitializeComponent(); -} - -void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs) -{ - // Do not repeat app initialization when already running, just ensure that - // the window is active - if(pArgs->PreviousExecutionState == ApplicationExecutionState::Running) - { - Window::Current->Activate(); - return; - } - - // Create a Frame to act navigation context and navigate to the first page - auto rootFrame = ref new Frame(); - if(!rootFrame->Navigate(TypeName(MainPage::typeid))) - { - throw ref new FailureException("Failed to create initial page"); - } - - // Place the frame in the current Window and ensure that it is active - Window::Current->Content = rootFrame; - Window::Current->Activate(); -} diff --git a/cpp11/Glacier2/uwp/simpleChat/App.xaml.h b/cpp11/Glacier2/uwp/simpleChat/App.xaml.h deleted file mode 100644 index 061135c8e2..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/App.xaml.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include "App.g.h" - -namespace simpleChat -{ - -ref class App sealed -{ -public: - App(); - virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^) override; -}; -} diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/LockScreenLogo.scale-200.png b/cpp11/Glacier2/uwp/simpleChat/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 735f57adb5..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/Logo.png b/cpp11/Glacier2/uwp/simpleChat/Assets/Logo.png deleted file mode 100644 index e26771cb33..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/Logo.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/SmallLogo.png b/cpp11/Glacier2/uwp/simpleChat/Assets/SmallLogo.png deleted file mode 100644 index fdf5be574c..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/SmallLogo.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/SplashScreen.png b/cpp11/Glacier2/uwp/simpleChat/Assets/SplashScreen.png deleted file mode 100644 index 209a04651a..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/SplashScreen.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/SplashScreen.scale-200.png b/cpp11/Glacier2/uwp/simpleChat/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 023e7f1fed..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/Square150x150Logo.scale-200.png b/cpp11/Glacier2/uwp/simpleChat/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index af49fec1a5..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/Square44x44Logo.scale-200.png b/cpp11/Glacier2/uwp/simpleChat/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index ce342a2ec8..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/cpp11/Glacier2/uwp/simpleChat/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index f6c02ce97e..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/StoreLogo.png b/cpp11/Glacier2/uwp/simpleChat/Assets/StoreLogo.png deleted file mode 100644 index 7385b56c0e..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/StoreLogo.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Assets/Wide310x150Logo.scale-200.png b/cpp11/Glacier2/uwp/simpleChat/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 288995b397..0000000000 Binary files a/cpp11/Glacier2/uwp/simpleChat/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/cpp11/Glacier2/uwp/simpleChat/Chat.ice b/cpp11/Glacier2/uwp/simpleChat/Chat.ice deleted file mode 100644 index 35ce7def51..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/Chat.ice +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -module Demo -{ - interface ChatCallback - { - void message(string data); - } - - interface ChatSession extends Glacier2::Session - { - void setCallback(ChatCallback* callback); - void say(string data); - } -} diff --git a/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml b/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml deleted file mode 100644 index 3a4eededec..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml.cpp b/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml.cpp deleted file mode 100644 index f462b9ff8e..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -// ChatView.xaml.cpp -// Implementation of the ChatView class -// - -#include "pch.h" -#include "ChatViewPage.xaml.h" -#include "MainPage.xaml.h" - -#include -#include -#include - -using namespace simpleChat; - -using namespace Platform; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; - -using namespace std; - -ChatViewPage::ChatViewPage() -{ - InitializeComponent(); - MainPage::instance()->_chatView = this; -} - -void -ChatViewPage::setError(String^ err) -{ - appendMessage(L" " + err); -} - -void -ChatViewPage::appendMessage(String^ message) -{ - messages->Text += message + L"\n"; - messages->UpdateLayout(); - Scroller->ChangeView(nullptr, Scroller->ScrollableHeight, nullptr); -} - -void -ChatViewPage::inputKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) -{ - if (e->Key == Windows::System::VirtualKey::Enter && !input->Text->IsEmpty()) - { - string msg = Ice::wstringToString(input->Text->Data()); - input->Text = ""; - MainPage::instance()->coordinator()->say(msg); - } -} diff --git a/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml.h b/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml.h deleted file mode 100644 index 0e2da7ad21..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/ChatViewPage.xaml.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ChatViewPage.xaml.h -// Declaration of the ChatViewPage class -// - -#pragma once - -#include "ChatViewPage.g.h" - -namespace simpleChat -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - [Windows::Foundation::Metadata::WebHostHidden] - public ref class ChatViewPage sealed - { - public: - ChatViewPage(); - void setError(Platform::String^ err); - void appendMessage(Platform::String^ message); - void inputKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e); - }; -} diff --git a/cpp11/Glacier2/uwp/simpleChat/Common/StandardStyles.xaml b/cpp11/Glacier2/uwp/simpleChat/Common/StandardStyles.xaml deleted file mode 100644 index c6447dce77..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/Common/StandardStyles.xaml +++ /dev/null @@ -1,1007 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Mouse - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cpp11/Glacier2/uwp/simpleChat/LoginViewPage.xaml b/cpp11/Glacier2/uwp/simpleChat/LoginViewPage.xaml deleted file mode 100644 index c54b12330d..0000000000 --- a/cpp11/Glacier2/uwp/simpleChat/LoginViewPage.xaml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - Host: - - Username: - - Password: - - - - - - - - - -