Skip to content
Browse files

各CMakeListsでパスのハードコーディングをなくし、より多くの環境でライブラリをビルドできるようにした

  • Loading branch information...
1 parent b6568a6 commit 27594a469abf74b3f149fd920a8becc08fe85597 @gplusnasite committed
Showing with 1,222 additions and 629 deletions.
  1. +64 −55 CMakeLists.txt
  2. +0 −24 Directories.txt
  3. +2 −0 Include/EventHandler/PostAddedEventHandler.hpp
  4. +2 −5 Include/Stream/AccountStream.hpp
  5. +4 −4 Include/Stream/HomeStream.hpp
  6. +5 −2 Readme.md
  7. +1 −1 Src/Account/Account/AccountLua.cpp
  8. +1 −1 Src/Account/AccountParser/AccountParser.hpp
  9. +1 −1 Src/Account/MyAccount/MyAccountData.cpp
  10. +1 −1 Src/AttachedData/AttachedPage/AttachedPage.cpp
  11. +2 −2 Src/AttachedData/AttachedPage/AttachedPageData.cpp
  12. +2 −1 Src/AttachedData/AttachedPage/AttachedPageData.hpp
  13. +13 −0 Src/AttachedData/AttachedPage/AttachedPageDataLua.cpp
  14. +1 −1 Src/Circle/Circle/CircleLua.cpp
  15. +1 −1 Src/Circle/CircleParser/CircleParser.hpp
  16. +2 −2 Src/Circle/Circles/CirclesData.cpp
  17. +63 −73 Src/Connection/CMakeLists.txt
  18. +30 −0 Src/Connection/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
  19. +54 −0 Src/Connection/cmake_modules/FindLUA.cmake
  20. +14 −12 Src/Connection/cmake_modules/FindLUABIND.cmake
  21. +24 −0 Src/Connection/cmake_modules/FindUTF8CPP.cmake
  22. +2 −2 Src/Datas/DataParser.hpp
  23. +6 −0 Src/EventHandler/PostAddedEventHandler.cpp
  24. +68 −70 Src/Json/CMakeLists.txt
  25. +2 −5 Src/Json/Impl/JsonObjectImpl.cpp
  26. +1 −1 Src/Json/Impl/JsonObjectImpl.hpp
  27. +1 −1 Src/Json/JsonObject.cpp
  28. +1 −1 Src/Json/JsonObject.hpp
  29. +30 −0 Src/Json/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
  30. +54 −0 Src/Json/cmake_modules/FindLUA.cmake
  31. +14 −12 Src/Json/cmake_modules/FindLUABIND.cmake
  32. +24 −0 Src/Json/cmake_modules/FindUTF8CPP.cmake
  33. +2 −2 Src/Notification/NotificationParser/NotificationParser.cpp
  34. +2 −2 Src/Notification/NotificationParser/NotificationParser.hpp
  35. +2 −2 Src/Notification/Notifications/NotificationsData.cpp
  36. +1 −1 Src/Notification/Notifications/NotificationsData.hpp
  37. +2 −2 Src/Share/ShareRanges/Impl/ShareRangesImpl.cpp
  38. +1 −1 Src/Share/ShareRanges/ShareRangesLua.cpp
  39. +1 −1 Src/Share/UrlShareSetting/Impl/UrlShareSettingImpl.cpp
  40. +1 −1 Src/Share/UrlShareSetting/UrlShareSetting.cpp
  41. +1 −1 Src/Share/UrlShareSetting/UrlShareSettingLua.cpp
  42. +3 −49 Src/Stream/AccountStream/AccountStream.cpp
  43. +44 −0 Src/Stream/AccountStream/Impl/AccountStreamImpl.cpp
  44. +26 −0 Src/Stream/AccountStream/Impl/AccountStreamImpl.hpp
  45. +66 −50 Src/Stream/HomeStream/HomeStream.cpp
  46. +40 −0 Src/Stream/HomeStream/Impl/HomeStreamImpl.cpp
  47. +26 −0 Src/Stream/HomeStream/Impl/HomeStreamImpl.hpp
  48. +1 −1 Src/Stream/Post/PostParser/PostParser.hpp
  49. +3 −3 Src/Stream/StreamObserver/Impl/StreamObserverImpl.cpp
  50. +1 −1 Src/Stream/StreamObserver/Impl/StreamObserverImpl.hpp
  51. +23 −20 Src/Thread/CMakeLists.txt
  52. +30 −0 Src/Thread/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
  53. +0 −75 Src/Thread/cmake_modules/FindLUABIND.cmake
  54. +45 −51 Src/UTF8/CMakeLists.txt
  55. +30 −0 Src/UTF8/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
  56. +54 −0 Src/UTF8/cmake_modules/FindLUA.cmake
  57. +14 −12 Src/UTF8/cmake_modules/FindLUABIND.cmake
  58. +24 −0 Src/UTF8/cmake_modules/FindUTF8CPP.cmake
  59. +45 −52 Src/Utility/CMakeLists.txt
  60. +30 −0 Src/Utility/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
  61. +54 −0 Src/Utility/cmake_modules/FindLUA.cmake
  62. +14 −12 Src/Utility/cmake_modules/FindLUABIND.cmake
  63. +24 −0 Src/Utility/cmake_modules/FindUTF8CPP.cmake
  64. +30 −0 cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
  65. +54 −0 cmake_modules/FindLUA.cmake
  66. +14 −12 cmake_modules/FindLUABIND.cmake
  67. +24 −0 cmake_modules/FindUTF8CPP.cmake
View
119 CMakeLists.txt
@@ -28,27 +28,6 @@ PROJECT(GooglePlusLibrary)
set(GooglePlusLibrary_Version "1.0")
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
-#-------------------------------------------------------
-# Set Manualy Library Directories if not auto detected.
-#-------------------------------------------------------
-### Lua
-set(LUA_INCLUDE_DIR "C:/lua/include")
-set(LUA_LIBRARIES "C:/lua/lib/lua5.1.lib")
-### LuaBind
-set(LUABIND_INCLUDE_DIR "C:/luabind")
-set(LUABIND_LIBRARIES debug "C:/luabind/bin/msvc-10.0/debug/link-static/threading-multi/libluabind_s_mdd.lib" optimized "C:/luabind/bin/msvc-10.0/release/link-static/threading-multi/libluabind_s_md.lib")
-### UTF8-Cpp
-set(UTF8_CPP_INCLUDE_DIR "D:/Development/utf8_v2_3_4/source")
-### OpenSSL
-# set(OPENSSL_INCLUDE_DIR "C:/OpenSSL-Win32/include")
-# set(OPENSSL_LIBRARIES "C:/OpenSSL-Win32/lib/VC/static/libeay32.lib;C:/OpenSSL-Win32/lib/VC/static/libssl32.lib")
-### Boost
-# set(Boost_INCLUDE_DIR "C:/boost_1_53_0")
-# set(Boost_LIBRARY_DIR "C:/boost_1_53_0/stage/lib")
-set(Boost_USE_STATIC_LIBS ON)
-### GooglePlusLibrary Source
-set(GOOGLE_PLUS_LIBRARY_DIR "D:/development/GooglePlusLibrary")
-
MESSAGE(INFO " ***********************************************")
MESSAGE(INFO " *** Welcome to Unofficial GooglePlusLibrary ***")
MESSAGE(INFO " ***********************************************")
@@ -57,66 +36,81 @@ MESSAGE(INFO " Checking Libraries ...")
#
# Lua
#
-find_package(Lua51)
-IF(LUA51_FOUND)
+MACRO_OPTIONAL_FIND_PACKAGE(LUA)
+if(Lua_FOUND)
MESSAGE(STATUS ":===> Lua Found!")
- MESSAGE(STATUS " include directories are : " ${LUA_INCLUDE_DIR})
- MESSAGE(STATUS " libraries are : " ${LUA_LIBRARIES})
- set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUA_INCLUDE_DIR})
-ELSE(LUA51_FOUND)
+ MESSAGE(STATUS " include directories are : " ${Lua_INCLUDE_DIR})
+ MESSAGE(STATUS " libraries are : " ${Lua_LIBRARIES})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${Lua_INCLUDE_DIR})
+else(Lua_FOUND)
MESSAGE(FATAL ERROR ":Lua was not found.")
-ENDIF(LUA51_FOUND)
+endif(Lua_FOUND)
#
# LuaBind
#
MACRO_OPTIONAL_FIND_PACKAGE(LUABIND)
-IF(LUABIND_FOUND)
+if(LUABIND_FOUND)
MESSAGE(STATUS ":====> LuaBind Found!")
MESSAGE(STATUS " include directories are : " ${LUABIND_INCLUDE_DIR})
- MESSAGE(STATUS " libraries are : " ${LUABIND_LIBRARIES})
- set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR})
-ELSE(LUABIND_FOUND)
+ MESSAGE(STATUS " debug libraries are : " ${LUABIND_LIBRARY_DBG})
+ MESSAGE(STATUS " release libraries are : " ${LUABIND_LIBRARY})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUABIND_DIR})
+else(LUABIND_FOUND)
MESSAGE(FATAL ERROR ":LuaBind was not found.")
-ENDIF(LUABIND_FOUND)
+endif(LUABIND_FOUND)
#
# UTF8-Cpp
#
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${UTF8_CPP_INCLUDE_DIR})
+MACRO_OPTIONAL_FIND_PACKAGE(UTF8CPP)
+if(UTF8CPP_FOUND)
+ MESSAGE(STATUS ":===> UTF8CPP Found!")
+ MESSAGE(STATUS " include directories are : " ${UTF8CPP_INCLUDE_DIR})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${UTF8CPP_INCLUDE_DIR})
+else(UTF8CPP_FOUND)
+ MESSAGE(FATAL ERROR ":UTF8CPP was not found.")
+endif(UTF8CPP_FOUND)
#
# OpenSSL
#
find_package(OpenSSL)
-IF(OPENSSL_FOUND)
+if(OPENSSL_FOUND)
MESSAGE(STATUS "====> OpenSSL Found!")
MESSAGE(STATUS " include directories are : " ${OPENSSL_INCLUDE_DIR})
MESSAGE(STATUS " libraries are : " ${OPENSSL_LIBRARIES})
- MESSAGE(STATUS " eay libraries are : " ${OPENSSL_EAY_LIBRARIES})
set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIRS})
-ELSE(OPENSSL_FOUND)
+else(OPENSSL_FOUND)
MESSAGE(FATAL ERROR ": OpenSSL was not found.")
-ENDIF(OPENSSL_FOUND)
+endif(OPENSSL_FOUND)
#
# BOOST
#
+set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS thread system date_time chrono filesystem regex)
-IF(Boost_FOUND)
+if(Boost_FOUND)
MESSAGE(STATUS ":====> Boost Found!")
MESSAGE(STATUS " include directories are : " ${Boost_INCLUDE_DIRS})
MESSAGE(STATUS " libraries are : " ${Boost_LIBRARIES})
set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
-ELSE(Boost_FOUND)
+else(Boost_FOUND)
MESSAGE(FATAL ERROR ": Boost was not found.")
-ENDIF(Boost_FOUND)
+endif(Boost_FOUND)
#
-# GooglePlusLibrary Source
+# GooglePlusLibrary
#
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_DIR}/Include)
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_DIR}/Src)
+MACRO_OPTIONAL_FIND_PACKAGE(GOOGLEPLUSLIBRARY)
+if(GOOGLEPLUSLIBRARY_FOUND)
+ MESSAGE(STATUS ":===> GOOGLEPLUSLIBRARY Found!")
+ MESSAGE(STATUS " include directories are : " ${GOOGLEPLUSLIBRARY_DIR}/Include)
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLEPLUSLIBRARY_DIR}/Include)
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLEPLUSLIBRARY_DIR}/Src)
+else(GOOGLEPLUSLIBRARY_FOUND)
+ MESSAGE(FATAL ERROR ":GOOGLEPLUSLIBRARY was not found.")
+endif(GOOGLEPLUSLIBRARY_FOUND)
#
# Source Files
@@ -982,6 +976,12 @@ set (GooglePlusLibrary_HEADERS ${GooglePlusLibrary_HEADERS} "Src/Stream/Post/Pos
source_group("Stream\\AccountStream" FILES "Src/Stream/AccountStream/AccountStream.cpp")
set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/AccountStream/AccountStream.cpp")
+source_group("Stream\\AccountStream\\Impl" FILES "Src/Stream/AccountStream/Impl/AccountStreamImpl.cpp")
+set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/AccountStream/Impl/AccountStreamImpl.cpp")
+
+source_group("Stream\\AccountStream\\Impl" FILES "Src/Stream/AccountStream/Impl/AccountStreamImpl.hpp")
+set (GooglePlusLibrary_HEADERS ${GooglePlusLibrary_HEADERS} "Src/Stream/AccountStream/Impl/AccountStreamImpl.hpp")
+
source_group("Stream\\Comment\\CommentID" FILES "Src/Stream/Comment/CommentID/CommentID.cpp")
set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/Comment/CommentID/CommentID.cpp")
@@ -1000,6 +1000,12 @@ set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/Comment/
source_group("Stream\\HomeStream" FILES "Src/Stream/HomeStream/HomeStream.cpp")
set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/HomeStream/HomeStream.cpp")
+source_group("Stream\\HomeStream\\Impl" FILES "Src/Stream/HomeStream/Impl/HomeStreamImpl.cpp")
+set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/HomeStream/Impl/HomeStreamImpl.cpp")
+
+source_group("Stream\\HomeStream\\Impl" FILES "Src/Stream/HomeStream/Impl/HomeStreamImpl.hpp")
+set (GooglePlusLibrary_HEADERS ${GooglePlusLibrary_HEADERS} "Src/Stream/HomeStream/Impl/HomeStreamImpl.hpp")
+
source_group("Stream\\Impl" FILES "Src/Stream/Impl/StreamConnectionImpl.cpp")
set (GooglePlusLibrary_SOURCES ${GooglePlusLibrary_SOURCES} "Src/Stream/Impl/StreamConnectionImpl.cpp")
@@ -1079,22 +1085,25 @@ set (GooglePlusLibrary_HEADERS ${GooglePlusLibrary_HEADERS} "Src/Talkgadget/Talk
# Target sources
#
-add_subdirectory(${GOOGLE_PLUS_LIBRARY_DIR}/Src/UTF8)
-add_subdirectory(${GOOGLE_PLUS_LIBRARY_DIR}/Src/Thread)
-add_subdirectory(${GOOGLE_PLUS_LIBRARY_DIR}/Src/Json)
-add_subdirectory(${GOOGLE_PLUS_LIBRARY_DIR}/Src/Utility)
-add_subdirectory(${GOOGLE_PLUS_LIBRARY_DIR}/Src/Connection)
+add_subdirectory(${GOOGLEPLUSLIBRARY_DIR}/Src/UTF8)
+add_subdirectory(${GOOGLEPLUSLIBRARY_DIR}/Src/Thread)
+add_subdirectory(${GOOGLEPLUSLIBRARY_DIR}/Src/Json)
+add_subdirectory(${GOOGLEPLUSLIBRARY_DIR}/Src/Utility)
+add_subdirectory(${GOOGLEPLUSLIBRARY_DIR}/Src/Connection)
-#link_directories(${GOOGLE_PLUS_LIBRARY_DIR}/Src/UTF8)
-#link_directories(${GOOGLE_PLUS_LIBRARY_DIR}/Src/UTF8/lib)
+#link_directories(${GOOGLEPLUSLIBRARY_DIR}/Src/UTF8)
+#link_directories(${GOOGLEPLUSLIBRARY_DIR}/Src/UTF8/lib)
include_directories(${CMAKE_INCLUDE_DIR})
link_directories(${CMAKE_LIBRARY_PATH})
-set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -lstdc++") # -std=C++0x")
-IF(MSVC)
+if(NOT MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -lstdc++") # -std=C++0x")
+endif(NOT MSVC)
+
+if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
-ENDIF(MSVC)
+endif(MSVC)
add_library(GooglePlusLibrary SHARED ${GooglePlusLibrary_SOURCES} ${GooglePlusLibrary_HEADERS})
@@ -1102,6 +1111,6 @@ add_definitions(-D "GOOGLEPLUSLIBRARY_SHARED_LIBRARY")
add_definitions(-D "GOOGLEPLUSLIBRARY_NO_WARNINGS")
set_target_properties(GooglePlusLibrary PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(GooglePlusLibrary PROPERTIES DEFINE_SYMBOL GOOGLEPLUSLIBRARY_EXPORTS)
-target_link_libraries(GooglePlusLibrary ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} UTF8String ReadWriteMutex GooglePlusJsonParser Utility Connection)
+target_link_libraries(GooglePlusLibrary ${Lua_LIBRARIES} ${LUABIND_LIBRARIES} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} UTF8String ReadWriteMutex GooglePlusJsonParser Utility Connection)
endif(NOT TARGET GooglePlusLibrary)
View
24 Directories.txt
@@ -1,24 +0,0 @@
-#-------------------------------------------------------
-# Set Manualy Library Directories if not auto detected.
-#-------------------------------------------------------
-### Lua
-set(LUA_INCLUDE_DIR "C:/lua/include")
-set(LUA_LIBRARIES "C:/lua/lib/lua5.1.lib")
-### LuaBind
-#set(LUABIND_INCLUDE_DIR "C:/luabind")
-#set(LUABIND_LIBRARIES debug "C:/luabind/bin/msvc-10.0/debug/link-static/threading-multi/libluabind_s_mdd.lib" optimized "C:/luabind/bin/msvc-10.0/release/link-static/threading-multi/libluabind_s_md.lib")
-set(LUABIND_INCLUDE_DIR "C:/Downloads/luabind-0.9.1")
-set(LUABIND_LIBRARIES debug "C:/Downloads/luabind-0.9.1/bin/msvc-10.0/debug/link-static/threading-multi/libluabind_s_mdd.lib" optimized "C:/luabind/bin/msvc-10.0/release/link-static/threading-multi/libluabind_s_md.lib")
-### UTF8-Cpp
-set(UTF8_CPP_INCLUDE_DIR "D:/Development/utf8_v2_3_2/source")
-### OpenSSL
- set(OPENSSL_ROOT_DIR "C:/usr/openssl")
-# set(OPENSSL_INCLUDE_DIR "C:/OpenSSL-Win32/include")
-# set(OPENSSL_LIBRARIES "C:/OpenSSL-Win32/lib/VC/static/libeay32.lib;C:/OpenSSL-Win32/lib/VC/static/libssl32.lib")
-### Boost
-#
- set(Boost_INCLUDE_DIR "C:/Downloads/boost_1_52_0")
- set(Boost_LIBRARY_DIR "C:/Downloads/boost_1_52_0/stage/lib")
-set(Boost_USE_STATIC_LIBS ON)
-### GooglePlusLibrary Source
-set(GOOGLE_PLUS_LIBRARY_SOURCE_DIR "C:/Downloads/Gplus/GooglePlusLibrary/Src")
View
2 Include/EventHandler/PostAddedEventHandler.hpp
@@ -102,6 +102,8 @@ class GOOGLEPLUSLIBRARY_API PostAddedEventHandler
/// @since Version 1.0
void operator()(ParameterType param0);
+ PostAddedEventHandler& operator=(const PostAddedEventHandler& event_handler);
+
virtual ~PostAddedEventHandler();
private:
View
7 Include/Stream/AccountStream.hpp
@@ -26,9 +26,7 @@ namespace Gplusnasite
namespace GooglePlusLibrary
{
-template <class T>
-class Datas;
-
+class AccountStreamImpl;
class Post;
class Comment;
class Account;
@@ -168,8 +166,7 @@ class GOOGLEPLUSLIBRARY_API AccountStream
virtual ~AccountStream();
private:
- std::shared_ptr<Datas<Post> > impl_;
-
+ std::shared_ptr<AccountStreamImpl> impl_;
};
}// namespace GooglePlusLibrary
View
8 Include/Stream/HomeStream.hpp
@@ -27,9 +27,7 @@ namespace Gplusnasite
namespace GooglePlusLibrary
{
-template <class T>
-class Datas;
-
+class HomeStreamImpl;
class Post;
class Comment;
class MyAccount;
@@ -162,12 +160,14 @@ class GOOGLEPLUSLIBRARY_API HomeStream
int count() const;
HomeStream& operator=(const HomeStream& home_stream);
+
+ void disconnectAllEventHandler();
public:
virtual ~HomeStream();
private:
- std::shared_ptr<Datas<Post> > impl_;
+ std::shared_ptr<HomeStreamImpl> impl_;
};
View
7 Readme.md
@@ -36,10 +36,13 @@ boost (Boost Software License)
(http://www.boost.org/)
Lua (MIT license)
-(http://www.lua.org/)
+(http://luabinaries.sourceforge.net/download.html)
Luabind (MIT License)
-(http://www.rasterbar.com/products/luabind.html)
+(http://sourceforge.net/projects/luabind/files/luabind/)
+
+OpenSSL (OpenSSL License and SSLeay License)
+(http://slproweb.com/products/Win32OpenSSL.html)
UTF-8 CPP (調査中)
(http://sourceforge.net/projects/utfcpp/)
View
2 Src/Account/Account/AccountLua.cpp
@@ -1,4 +1,4 @@
-#include <Account/Account/AccountLua.hpp>
+#include <Account/Account/AccountLua.hpp>
#include <Account/Account.hpp>
#include <luabind/luabind.hpp>
View
2 Src/Account/AccountParser/AccountParser.hpp
@@ -32,7 +32,7 @@ class GOOGLEPLUSLIBRARY_API AccountParser
static void add(const std::string& account_id, JsonObject& json);
- static boost::signals2::signal<void(const std::string& account_id, const std::string& circle_id)> onAccountAdded;
+ static boost::signals2::signal<void(const std::string& my_account_id, const std::string& circle_id)> onAccountAdded;
static void erase(const std::string& post_id);
View
2 Src/Account/MyAccount/MyAccountData.cpp
@@ -57,7 +57,7 @@ void MyAccountData::loginAsync(const string& mail_address, const string& passwor
{
mail_address_ = mail_address;
- std::function<void(const string&, const string&)> login_async_func = [&](const string& mail_address, const string& password)
+ function<void(const string&, const string&)> login_async_func = [&](const string& mail_address, const string& password)
{
LuaScript<string(string, string)> lua_script("LuaScript/Login.lua", "login", [](lua_State* lua_state)
{
View
2 Src/AttachedData/AttachedPage/AttachedPage.cpp
@@ -30,7 +30,7 @@ string AttachedPage::getPageUrl() const
return url_data_->getPageUrl();
}
-void AttachedPage::setPageUrl(const std::string& page_url) const
+void AttachedPage::setPageUrl(const string& page_url) const
{
url_data_->setPageUrl(page_url);
}
View
4 Src/AttachedData/AttachedPage/AttachedPageData.cpp
@@ -17,7 +17,7 @@ thumbnail_position_(-1)
{
}
-AttachedPageData::AttachedPageData(const std::string& page_url)
+AttachedPageData::AttachedPageData(const string& page_url)
:page_title_(""),
page_description_(""),
page_favicon_url_(""),
@@ -27,7 +27,7 @@ thumbnail_position_(-1)
{
}
-AttachedPageData::AttachedPageData(const std::string& page_url, int thumbnail_position)
+AttachedPageData::AttachedPageData(const string& page_url, int thumbnail_position)
:page_title_(""),
page_description_(""),
page_favicon_url_(""),
View
3 Src/AttachedData/AttachedPage/AttachedPageData.hpp
@@ -27,7 +27,8 @@ class GOOGLEPLUSLIBRARY_API AttachedPageData
static AttachedPageData parse(JsonObject& json);
static AttachedPageData parse(luabind::object json_object);
-
+protected:
+ void updateByUrl(const std::string& url);
public:
UTF8String getPageTitle() const;
void setPageTitle(const UTF8String& page_title);
View
13 Src/AttachedData/AttachedPage/AttachedPageDataLua.cpp
@@ -36,6 +36,19 @@ AttachedPageData AttachedPageData::parse(luabind::object json_object)
return parse(*node_pointer);
}
+void AttachedPageData::updateByUrl(const string& url)
+{
+ LuaScript<bool(AttachedPageData*)> lua_script("LuaScript/GetPageInformation.lua", "getPageInformation", [](lua_State* lua_state)
+ {
+ UTF8StringLua::bindToScript(lua_state);
+ JsonObjectLua::bindToScript(lua_state);
+ bindToScript(lua_state);
+ });
+ AttachedPageData attached_page_data;
+ //lua_script(&json, &attached_page_data);
+}
+
+
void AttachedPageData::setPageUrl(const string& page_url)
{
ScopedWriteLock lock(read_write_mutex_);
View
2 Src/Circle/Circle/CircleLua.cpp
@@ -1,4 +1,4 @@
-#include <Circle/Circle/CircleLua.hpp>
+#include <Circle/Circle/CircleLua.hpp>
#include <Circle/Circle.hpp>
#include <luabind/luabind.hpp>
View
2 Src/Circle/CircleParser/CircleParser.hpp
@@ -32,7 +32,7 @@ class GOOGLEPLUSLIBRARY_API CircleParser
static void add(const std::string& account_id, JsonObject& json);
- static boost::signals2::signal<void(const std::string& account_id, const std::string& circle_id)> onCircleAdded;
+ static boost::signals2::signal<void(const std::string& my_account_id, const std::string& circle_id)> onCircleAdded;
static void erase(const std::string& post_id);
View
4 Src/Circle/Circles/CirclesData.cpp
@@ -16,9 +16,9 @@ CirclesData::CirclesData()
CirclesData::CirclesData(const string& my_account_id)
:NamedDatas<Circle>(my_account_id)
{
- CircleParser::onCircleAdded.connect([&](const string& account_id, const string& circle_id)
+ CircleParser::onCircleAdded.connect([&](const string& my_account_id, const string& circle_id)
{
- if(getTargetAccountID() != account_id)
+ if(getTargetAccountID() != my_account_id)
{
return;
}
View
136 Src/Connection/CMakeLists.txt
@@ -28,32 +28,6 @@ PROJECT(Connection)
set(Connection_Version "0.1.0")
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
-#-------------------------------------------------------
-# Set Manualy Library Directories if not auto detected.
-#-------------------------------------------------------
-### Lua
-set(LUA_INCLUDE_DIR "C:/lua/include")
-set(LUA_LIBRARIES "C:/lua/lib/lua5.1.lib")
-### LuaBind
-set(LUABIND_INCLUDE_DIR "C:/luabind")
-set(LUABIND_LIBRARIES debug "C:/luabind/bin/msvc-10.0/debug/link-static/threading-multi/libluabind_s_mdd.lib" optimized "C:/luabind/bin/msvc-10.0/release/link-static/threading-multi/libluabind_s_md.lib")
-### OpenSSL
-# set(OPENSSL_INCLUDE_DIR "C:/OpenSSL-Win32/include")
-# set(OPENSSL_LIBRARIES "C:/OpenSSL-Win32/lib/VC/static/libeay32.lib;C:/OpenSSL-Win32/lib/VC/static/libssl32.lib")
-### UTF8-Cpp
-set(UTF8_CPP_INCLUDE_DIR "D:/Development/utf8_v2_3_4/source")
-### Boost
-# set(Boost_DIR "C:/boost_1_53_0")
-set(Boost_INCLUDE_DIR "C:/boost_1_53_0")
-# set(Boost_LIBRARY_DIR "C:/boost_1_53_0/stage/lib")
-set(Boost_USE_STATIC_LIBS ON)
-### GooglePlusLibrary Source
-set(GOOGLE_PLUS_LIBRARY_INCLUDE_DIR "D:/development/GooglePlusLibrary/Include")
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_INCLUDE_DIR})
-
-set(GOOGLE_PLUS_LIBRARY_SOURCE_DIR "D:/development/GooglePlusLibrary/Src")
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_SOURCE_DIR})
-
MESSAGE(INFO " ***********************************************")
MESSAGE(INFO " *** Welcome to Connection(GooglePlusLibrary) ***")
MESSAGE(INFO " ***********************************************")
@@ -62,15 +36,15 @@ MESSAGE(INFO " Checking Libraries ...")
#
# Lua
#
-find_package(Lua51)
-IF(LUA51_FOUND)
+MACRO_OPTIONAL_FIND_PACKAGE(LUA)
+if(Lua_FOUND)
MESSAGE(STATUS ":===> Lua Found!")
- MESSAGE(STATUS " include directories are : " ${LUA_INCLUDE_DIR})
- MESSAGE(STATUS " libraries are : " ${LUA_LIBRARIES})
- set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUA_INCLUDE_DIR})
-ELSE(LUA51_FOUND)
+ MESSAGE(STATUS " include directories are : " ${Lua_INCLUDE_DIR})
+ MESSAGE(STATUS " libraries are : " ${Lua_LIBRARIES})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${Lua_INCLUDE_DIR})
+else(Lua_FOUND)
MESSAGE(FATAL ERROR ":Lua was not found.")
-ENDIF(LUA51_FOUND)
+endif(Lua_FOUND)
#
# LuaBind
@@ -80,7 +54,7 @@ IF(LUABIND_FOUND)
MESSAGE(STATUS ":====> LuaBind Found!")
MESSAGE(STATUS " include directories are : " ${LUABIND_INCLUDE_DIR})
MESSAGE(STATUS " libraries are : " ${LUABIND_LIBRARIES})
- set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUABIND_DIR})
ELSE(LUABIND_FOUND)
MESSAGE(FATAL ERROR ":LuaBind was not found.")
ENDIF(LUABIND_FOUND)
@@ -88,16 +62,32 @@ ENDIF(LUABIND_FOUND)
#
# UTF8-Cpp
#
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${UTF8_CPP_INCLUDE_DIR})
+MACRO_OPTIONAL_FIND_PACKAGE(UTF8CPP)
+if(UTF8CPP_FOUND)
+ MESSAGE(STATUS ":===> UTF8CPP Found!")
+ MESSAGE(STATUS " include directories are : " ${UTF8CPP_INCLUDE_DIR})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${UTF8CPP_INCLUDE_DIR})
+else(UTF8CPP_FOUND)
+ MESSAGE(FATAL ERROR ":UTF8CPP was not found.")
+endif(UTF8CPP_FOUND)
#
# GooglePlusLibrary Source
#
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_SOURCE_DIR})
+MACRO_OPTIONAL_FIND_PACKAGE(GOOGLEPLUSLIBRARY)
+if(GOOGLEPLUSLIBRARY_FOUND)
+ MESSAGE(STATUS ":===> GOOGLEPLUSLIBRARY Found!")
+ MESSAGE(STATUS " include directories are : " ${GOOGLEPLUSLIBRARY_DIR}/Include)
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLEPLUSLIBRARY_DIR}/Include)
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLEPLUSLIBRARY_DIR}/Src)
+else(GOOGLEPLUSLIBRARY_FOUND)
+ MESSAGE(FATAL ERROR ":GOOGLEPLUSLIBRARY was not found.")
+endif(GOOGLEPLUSLIBRARY_FOUND)
#
# BOOST
#
+set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS system date_time regex thread chrono filesystem)
IF(Boost_FOUND)
MESSAGE(STATUS ":====> Boost Found!")
@@ -128,61 +118,61 @@ ENDIF(OPENSSL_FOUND)
#---------------
## Connection
#---------------
-source_group("Connection" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Connection/Connection.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Connection/Connection.cpp")
+source_group("Connection" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Connection/Connection.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Connection/Connection.cpp")
-source_group("Connection" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Connection/Connection.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Connection/Connection.hpp")
+source_group("Connection" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Connection/Connection.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Connection/Connection.hpp")
-source_group("Cookie" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookie.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookie.cpp")
+source_group("Cookie" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookie.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookie.cpp")
-source_group("Cookie" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookie.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookie.hpp")
+source_group("Cookie" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookie.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookie.hpp")
-source_group("Cookie" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/CookieContainer.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/CookieContainer.cpp")
+source_group("Cookie" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/CookieContainer.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/CookieContainer.cpp")
-source_group("Cookie" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/CookieContainer.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/CookieContainer.hpp")
+source_group("Cookie" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/CookieContainer.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/CookieContainer.hpp")
-source_group("Cookie" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookies.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookies.cpp")
+source_group("Cookie" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookies.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookies.cpp")
-source_group("Cookie" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookies.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Cookie/Cookies.hpp")
+source_group("Cookie" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookies.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Cookie/Cookies.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/GooglePlusConnectionExports.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/GooglePlusConnectionExports.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/GooglePlusConnectionExports.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/GooglePlusConnectionExports.hpp")
-source_group("HttpResponse" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/HttpResponse/HttpResponse.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/HttpResponse/HttpResponse.cpp")
+source_group("HttpResponse" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/HttpResponse/HttpResponse.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/HttpResponse/HttpResponse.cpp")
-source_group("HttpResponse" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/HttpResponse/HttpResponse.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/HttpResponse/HttpResponse.hpp")
+source_group("HttpResponse" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/HttpResponse/HttpResponse.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/HttpResponse/HttpResponse.hpp")
-source_group("Uri" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Uri/Uri.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Uri/Uri.cpp")
+source_group("Uri" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Uri/Uri.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Uri/Uri.cpp")
-source_group("Uri" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Uri/Uri.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/Uri/Uri.hpp")
+source_group("Uri" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Uri/Uri.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/Uri/Uri.hpp")
-source_group("WebClient" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/WebClient/WebClient.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/WebClient/WebClient.cpp")
+source_group("WebClient" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/WebClient/WebClient.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/WebClient/WebClient.cpp")
-source_group("WebClient" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/WebClient/WebClient.hpp")
-set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/WebClient/WebClient.hpp")
+source_group("WebClient" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/WebClient/WebClient.hpp")
+set(Connection_HEADERS ${Connection_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/WebClient/WebClient.hpp")
-source_group("WebClient" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/WebClient/WebClientHandler.cpp")
-set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Connection/WebClient/WebClientHandler.cpp")
+source_group("WebClient" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/WebClient/WebClientHandler.cpp")
+set(Connection_SOURCES ${Connection_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Connection/WebClient/WebClientHandler.cpp")
#
# Target sources
#
-#subdirs(${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/UTF8)
-subdirs(${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Thread)
-subdirs(${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json)
-subdirs(${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Utility)
+#subdirs(${GOOGLEPLUSLIBRARY_DIR}/${GOOGLEPLUSLIBRARY_DIR}/Include)
+subdirs(${GOOGLEPLUSLIBRARY_DIR}/Src/Thread)
+subdirs(${GOOGLEPLUSLIBRARY_DIR}/Src/Json)
+subdirs(${GOOGLEPLUSLIBRARY_DIR}/Src/Utility)
include_directories(${CMAKE_INCLUDE_DIR})
link_directories(${CMAKE_LIBRARY_PATH})
@@ -197,5 +187,5 @@ add_library(Connection STATIC ${Connection_SOURCES} ${Connection_HEADERS})
add_definitions(-D "GOOGLEPLUSLIBRARY_NO_WARNINGS")
set_target_properties(Connection PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(Connection PROPERTIES DEFINE_SYMBOL GOOGLEPLUSCONNECTION_EXPORTS)
-target_link_libraries(Connection ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ReadWriteMutex GooglePlusJsonParser Utility)
+target_link_libraries(Connection ${Lua_LIBRARIES} ${LUABIND_LIBRARIES} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ReadWriteMutex GooglePlusJsonParser Utility)
endif(NOT TARGET Connection)
View
30 Src/Connection/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
@@ -0,0 +1,30 @@
+# - Find GOOGLEPLUSLIBRARY
+# Find the GOOGLEPLUSLIBRARY includes and library
+# This module defines
+# GOOGLEPLUSLIBRARY_DIR, where to find Readme.md
+# GOOGLEPLUSLIBRARY_FOUND, If false, do not try to use GOOGLEPLUSLIBRARY.
+
+# Search for GooglePlusLibrary include dir
+find_path(GOOGLEPLUSLIBRARY_DIR Readme.md
+ PATHS
+ $ENV{GOOGLEPLUSLIBRARY_DIR}
+ D:/Development/GooglePlusLibrary/Include
+)
+
+find_path(GOOGLEPLUSLIBRARY_DIR Readme.md
+ PATHS
+ $ENV{GOOGLEPLUSLIBRARY_DIR}
+ D:/Development/GooglePlusLibrary
+)
+
+if(GOOGLEPLUSLIBRARY_DIR)
+ set(GOOGLEPLUSLIBRARY_FOUND TRUE)
+else(GOOGLEPLUSLIBRARY_DIR)
+ set(GOOGLEPLUSLIBRARY_FOUND FALSE)
+endif(GOOGLEPLUSLIBRARY_DIR)
+
+mark_as_advanced(GOOGLEPLUSLIBRARY_DIR)
+
+
+
+
View
54 Src/Connection/cmake_modules/FindLUA.cmake
@@ -0,0 +1,54 @@
+# - Find LUA
+# Find the LUA includes and library
+# This module defines
+# Lua_INCLUDE_DIR, where to find lua.h
+# Lua_LIBRARIES, the libraries needed to use Lua.
+# Lua_FOUND, If false, do not try to use Lua.
+
+IF (Lua_INCLUDE_DIR AND Lua_LIBRARY_DIR)
+
+ find_library(Lua_LIBRARIES NAMES lua
+ PATHS
+ ${Lua_LIBRARY_DIR}
+ )
+
+ELSE (Lua_INCLUDE_DIR AND Lua_LIBRARY_DIR)
+
+ # Search for lua include dir
+ find_path(Lua_INCLUDE_DIR lua.h
+ PATHS
+ $ENV{LUA_INCLUDE_DIR}
+ C:/lua/include
+ /usr/include
+ /usr/include/lua
+ /usr/local/include
+ /usr/local/include/lua
+ /Libs/lua/include
+ )
+
+ # Search for lua library dir
+ find_library(Lua_LIBRARIES NAMES lua lua5.1 lua51
+ PATHS
+ $ENV{LUA_LIBRARIES}
+ C:/lua/lib
+ /usr/lib
+ /usr/local/lib
+ /Libs/lua/lib
+ )
+
+ENDIF (Lua_INCLUDE_DIR AND Lua_LIBRARY_DIR)
+
+if(Lua_INCLUDE_DIR AND Lua_LIBRARIES)
+ set(Lua_FOUND TRUE)
+ message(STATUS "Found Lua: ${Lua_INCLUDE_DIR}, ${Lua_LIBRARIES}")
+else(Lua_INCLUDE_DIR AND Lua_LIBRARIES)
+ set(Lua_FOUND FALSE)
+ message(STATUS "Lua was not found.")
+endif(Lua_INCLUDE_DIR AND Lua_LIBRARIES)
+
+mark_as_advanced(Lua_INCLUDE_DIR)
+mark_as_advanced(Lua_LIBRARY_DIR)
+
+
+
+
View
26 Src/Connection/cmake_modules/FindLUABIND.cmake
@@ -16,8 +16,10 @@ ENDIF()
FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp
HINTS
$ENV{LUABIND_DIR}
+ $ENV{LUABIND_INCLUDE_DIR}
PATH_SUFFIXES luabind include/luabind include
PATHS
+ C:/luabind
~/Library/Frameworks
/Library/Frameworks
/usr/local
@@ -26,10 +28,16 @@ FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp
/opt
)
+IF(LUABIND_INCLUDE_DIR)
+get_filename_component(LUABIND_DIR ${LUABIND_INCLUDE_DIR} PATH)
+ENDIF(LUABIND_INCLUDE_DIR)
+
FIND_LIBRARY(LUABIND_LIBRARY
- NAMES luabind
+ NAMES luabind libluabind libluabind_s_md
HINTS
$ENV{LUABIND_DIR}
+ $ENV{LUABIND_LIBRARIES}
+ C:/luabind/stage
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
@@ -41,9 +49,11 @@ FIND_LIBRARY(LUABIND_LIBRARY
)
FIND_LIBRARY(LUABIND_LIBRARY_DBG
- NAMES luabindd
+ NAMES luabindd libluabindd libluabind_s_mdd
HINTS
$ENV{LUABIND_DIR}
+ $ENV{LUABIND_LIBRARIES}
+ C:/luabind/stage
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
@@ -55,7 +65,8 @@ FIND_LIBRARY(LUABIND_LIBRARY_DBG
)
IF(LUABIND_LIBRARY)
- SET( LUABIND_LIBRARIES "${LUABIND_LIBRARY}" CACHE STRING "Luabind Libraries")
+ SET( LUABIND_LIBRARIES "${LUABIND_LIBRARY}" CACHE STRING "Luabind Libraries")
+ set(LUABIND_LIBRARIES debug ${LUABIND_LIBRARY_DBG} optimized ${LUABIND_LIBRARY})
ENDIF(LUABIND_LIBRARY)
INCLUDE(FindPackageHandleStandardArgs)
@@ -63,13 +74,4 @@ INCLUDE(FindPackageHandleStandardArgs)
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Luabind DEFAULT_MSG LUABIND_LIBRARIES LUABIND_INCLUDE_DIR)
-IF( NOT LUABIND_FIND_QUIETLY )
- IF( LUABIND_FOUND )
- MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARY}" )
- ENDIF()
- IF( LUABIND_LIBRARY_DBG )
- MESSAGE(STATUS "Luabind debug library availible: ${LUABIND_LIBRARY_DBG}")
- ENDIF()
-ENDIF()
-
MARK_AS_ADVANCED(LUABIND_INCLUDE_DIR LUABIND_LIBRARIES LUABIND_LIBRARY LUABIND_LIBRARY_DBG)
View
24 Src/Connection/cmake_modules/FindUTF8CPP.cmake
@@ -0,0 +1,24 @@
+# - Find UTF8CPP
+# Find the UTF8CPP includes and library
+# This module defines
+# UTF8CPP_INCLUDE_DIR, where to find utf8.h
+# UTF8CPP_FOUND, If false, do not try to use UTF8CPP.
+
+# Search for utf8cpp include dir
+find_path(UTF8CPP_INCLUDE_DIR utf8.h
+ PATHS
+ $ENV{UTF8CPP_INCLUDE_DIR}
+ D:/Development/utf8_v2_3_4/source
+)
+
+if(UTF8CPP_INCLUDE_DIR)
+ set(UTF8CPP_FOUND TRUE)
+else(UTF8CPP_INCLUDE_DIR)
+ set(UTF8CPP_FOUND FALSE)
+endif(UTF8CPP_INCLUDE_DIR)
+
+mark_as_advanced(UTF8CPP_INCLUDE_DIR)
+
+
+
+
View
4 Src/Datas/DataParser.hpp
@@ -43,7 +43,7 @@ class GOOGLEPLUSLIBRARY_API DataParser
static std::function<void(const std::string&, JsonObject&)> parser_function_;
public:
- static void add(const std::string& account_id, const std::string& item_id, const T& item_data)
+ static void add(const std::string& my_account_id, const std::string& item_id, const T& item_data)
{
DataContainer<T>::insert(item_id, item_data);
onItemAdded(account_id, item_id);
@@ -54,7 +54,7 @@ class GOOGLEPLUSLIBRARY_API DataParser
parser_function_(account_id, json);
}
- static boost::signals2::signal<void(const std::string&, const std::string&)> onItemAdded;
+ static boost::signals2::signal<void(const std::string& my_account_id, const std::string& item_id)> onItemAdded;
static void erase(const std::string& item_id)
{
View
6 Src/EventHandler/PostAddedEventHandler.cpp
@@ -37,6 +37,12 @@ void PostAddedEventHandler::operator()(ParameterType param0)
impl_->operator()(param0);
}
+PostAddedEventHandler& PostAddedEventHandler::operator=(const PostAddedEventHandler& event_handler)
+{
+ impl_ = event_handler.impl_;
+ return *this;
+}
+
PostAddedEventHandler::~PostAddedEventHandler()
{
}
View
138 Src/Json/CMakeLists.txt
@@ -27,29 +27,6 @@ PROJECT(GooglePlusJsonParser)
set(GooglePlusJsonParser_Version "0.1.0")
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
-#-------------------------------------------------------
-# Set Manualy Library Directories if not auto detected.
-#-------------------------------------------------------
-### Lua
-set(LUA_INCLUDE_DIR "C:/lua/include")
-set(LUA_LIBRARIES "C:/lua/lib/lua5.1.lib")
-### LuaBind
-set(LUABIND_INCLUDE_DIR "C:/luabind")
-set(LUABIND_LIBRARIES debug "C:/luabind/bin/msvc-10.0/debug/link-static/threading-multi/libluabind_s_mdd.lib" optimized "C:/luabind/bin/msvc-10.0/release/link-static/threading-multi/libluabind_s_md.lib")
-### UTF8-Cpp
-set(UTF8_CPP_INCLUDE_DIR "D:/Development/utf8_v2_3_4/source")
-### Boost
-# set(Boost_DIR "C:/boost_1_53_0")
-set(Boost_INCLUDE_DIR "C:/boost_1_53_0")
-set(Boost_LIBRARY_DIR "C:/boost_1_53_0/stage/lib")
-set(Boost_USE_STATIC_LIBS ON)
-### GooglePlusLibrary Source
-set(GOOGLE_PLUS_LIBRARY_INCLUDE_DIR "D:/development/GooglePlusLibrary/Include")
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_INCLUDE_DIR})
-
-set(GOOGLE_PLUS_LIBRARY_SOURCE_DIR "D:/development/GooglePlusLibrary/Src")
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLE_PLUS_LIBRARY_SOURCE_DIR})
-
MESSAGE(INFO " ***********************************************")
MESSAGE(INFO " *** Welcome to GooglePlusJsonParser(GooglePlusLibrary) ***")
MESSAGE(INFO " ***********************************************")
@@ -58,15 +35,15 @@ MESSAGE(INFO " Checking Libraries ...")
#
# Lua
#
-find_package(Lua51)
-IF(LUA51_FOUND)
+MACRO_OPTIONAL_FIND_PACKAGE(LUA)
+if(Lua_FOUND)
MESSAGE(STATUS ":===> Lua Found!")
- MESSAGE(STATUS " include directories are : " ${LUA_INCLUDE_DIR})
- MESSAGE(STATUS " libraries are : " ${LUA_LIBRARIES})
- set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUA_INCLUDE_DIR})
-ELSE(LUA51_FOUND)
+ MESSAGE(STATUS " include directories are : " ${Lua_INCLUDE_DIR})
+ MESSAGE(STATUS " libraries are : " ${Lua_LIBRARIES})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${Lua_INCLUDE_DIR})
+else(Lua_FOUND)
MESSAGE(FATAL ERROR ":Lua was not found.")
-ENDIF(LUA51_FOUND)
+endif(Lua_FOUND)
#
# LuaBind
@@ -76,7 +53,7 @@ IF(LUABIND_FOUND)
MESSAGE(STATUS ":====> LuaBind Found!")
MESSAGE(STATUS " include directories are : " ${LUABIND_INCLUDE_DIR})
MESSAGE(STATUS " libraries are : " ${LUABIND_LIBRARIES})
- set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${LUABIND_DIR})
ELSE(LUABIND_FOUND)
MESSAGE(FATAL ERROR ":LuaBind was not found.")
ENDIF(LUABIND_FOUND)
@@ -84,11 +61,19 @@ ENDIF(LUABIND_FOUND)
#
# UTF8-Cpp
#
-set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${UTF8_CPP_INCLUDE_DIR})
+MACRO_OPTIONAL_FIND_PACKAGE(UTF8CPP)
+if(UTF8CPP_FOUND)
+ MESSAGE(STATUS ":===> UTF8CPP Found!")
+ MESSAGE(STATUS " include directories are : " ${UTF8CPP_INCLUDE_DIR})
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${UTF8CPP_INCLUDE_DIR})
+else(UTF8CPP_FOUND)
+ MESSAGE(FATAL ERROR ":UTF8CPP was not found.")
+endif(UTF8CPP_FOUND)
#
# BOOST
#
+set(Boost_USE_STATIC_LIBS ON)
find_package(Boost)
IF(Boost_FOUND)
MESSAGE(STATUS ":====> Boost Found!")
@@ -100,70 +85,83 @@ ELSE(Boost_FOUND)
ENDIF(Boost_FOUND)
#
+# GooglePlusLibrary Source
+#
+MACRO_OPTIONAL_FIND_PACKAGE(GOOGLEPLUSLIBRARY)
+if(GOOGLEPLUSLIBRARY_FOUND)
+ MESSAGE(STATUS ":===> GOOGLEPLUSLIBRARY Found!")
+ MESSAGE(STATUS " include directories are : " ${GOOGLEPLUSLIBRARY_DIR}/Include)
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLEPLUSLIBRARY_DIR}/Include)
+ set(CMAKE_INCLUDE_DIR ${CMAKE_INCLUDE_DIR} ${GOOGLEPLUSLIBRARY_DIR}/Src)
+else(GOOGLEPLUSLIBRARY_FOUND)
+ MESSAGE(FATAL ERROR ":GOOGLEPLUSLIBRARY was not found.")
+endif(GOOGLEPLUSLIBRARY_FOUND)
+
+#
# Source Files
#
#---------------
## Json
#---------------
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/GooglePlusJsonExports.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/GooglePlusJsonExports.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/GooglePlusJsonExports.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/GooglePlusJsonExports.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonGrammar.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonGrammar.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonGrammar.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonGrammar.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonMember.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonMember.cpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonMember.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonMember.cpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonMember.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonMember.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonMember.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonMember.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObject.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObject.cpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObject.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObject.cpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObject.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObject.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObject.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObject.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObjectLua.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObjectLua.cpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObjectLua.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObjectLua.cpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObjectLua.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonObjectLua.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObjectLua.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonObjectLua.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonParser.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonParser.cpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonParser.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonParser.cpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonParser.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonParser.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonParser.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonParser.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPath.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPath.cpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPath.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPath.cpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPath.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPath.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPath.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPath.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPathLua.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPathLua.cpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPathLua.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPathLua.cpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPathLua.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/JsonPathLua.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPathLua.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/JsonPathLua.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/RangeException.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/RangeException.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/RangeException.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/RangeException.hpp")
-source_group("" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/TypeException.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/TypeException.hpp")
+source_group("" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/TypeException.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/TypeException.hpp")
-source_group("Impl" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/Impl/JsonObjectImpl.cpp")
-set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/Impl/JsonObjectImpl.cpp")
+source_group("Impl" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/Impl/JsonObjectImpl.cpp")
+set (GooglePlusJsonParser_SOURCES ${GooglePlusJsonParser_SOURCES} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/Impl/JsonObjectImpl.cpp")
-source_group("Impl" FILES "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/Impl/JsonObjectImpl.hpp")
-set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/Json/Impl/JsonObjectImpl.hpp")
+source_group("Impl" FILES "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/Impl/JsonObjectImpl.hpp")
+set (GooglePlusJsonParser_HEADERS ${GooglePlusJsonParser_HEADERS} "${GOOGLEPLUSLIBRARY_DIR}/Src/Json/Impl/JsonObjectImpl.hpp")
#
# Target sources
#
-#subdirs(${GOOGLE_PLUS_LIBRARY_SOURCE_DIR}/UTF8)
+#subdirs(${GOOGLEPLUSLIBRARY_DIR}/Src/UTF8)
include_directories(${CMAKE_INCLUDE_DIR})
link_directories(${CMAKE_LIBRARY_PATH})
@@ -178,5 +176,5 @@ add_library(GooglePlusJsonParser STATIC ${GooglePlusJsonParser_SOURCES} ${Google
add_definitions(-D "GOOGLEPLUSLIBRARY_NO_WARNINGS")
set_target_properties(GooglePlusJsonParser PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(GooglePlusJsonParser PROPERTIES DEFINE_SYMBOL GOOGLEPLUSJSON_EXPORTS)
-target_link_libraries(GooglePlusJsonParser ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${Boost_LIBRARIES} UTF8String)
+target_link_libraries(GooglePlusJsonParser ${Lua_LIBRARIES} ${LUABIND_LIBRARIES} ${Boost_LIBRARIES} UTF8String)
endif(NOT TARGET GooglePlusJsonParser)
View
7 Src/Json/Impl/JsonObjectImpl.cpp
@@ -254,8 +254,6 @@ JsonObject JsonObjectImpl::getByPosition(unsigned int position) const
void JsonObjectImpl::setByPosition(const JsonObject& json_object, unsigned int position)
{
- // TODO
- int co = count();
while(count() < position)
{
pushBack(JsonObject());
@@ -267,8 +265,7 @@ void JsonObjectImpl::setByPosition(const JsonObject& json_object, unsigned int p
else
{
pushBack(json_object);
- }
-
+ }
}
void JsonObjectImpl::pushBack(const JsonObject& rhs)
@@ -304,7 +301,7 @@ void JsonObjectImpl::addNode(const JsonMember& child_json)
pushBack(json);
}
-int JsonObjectImpl::count() const
+unsigned int JsonObjectImpl::count() const
{
if(ObjectImplType::Null == type_)
{
View
2 Src/Json/Impl/JsonObjectImpl.hpp
@@ -64,7 +64,7 @@ class GOOGLEPLUSJSON_API JsonObjectImpl
void addNode(const JsonObject& child_json);
void addNode(const JsonMember& child_json);
- int count() const;
+ unsigned int count() const;
virtual ~JsonObjectImpl();
};
View
2 Src/Json/JsonObject.cpp
@@ -366,7 +366,7 @@ void JsonObject::addNode(const JsonMember& child_json) const
impl_->addNode(child_json);
}
-int JsonObject::count() const
+unsigned int JsonObject::count() const
{
assert(impl_);
return impl_->count();
View
2 Src/Json/JsonObject.hpp
@@ -68,7 +68,7 @@ class GOOGLEPLUSJSON_API JsonObject
void addNode(const JsonObject& child_json) const;
void addNode(const JsonMember& child_json) const;
- int count() const;
+ unsigned int count() const;
JsonObject operator=(const JsonObject& json_object);
View
30 Src/Json/cmake_modules/FindGOOGLEPLUSLIBRARY.cmake
@@ -0,0 +1,30 @@
+# - Find GOOGLEPLUSLIBRARY
+# Find the GOOGLEPLUSLIBRARY includes and library
+# This module defines
+# GOOGLEPLUSLIBRARY_DIR, where to find Readme.md
+# GOOGLEPLUSLIBRARY_FOUND, If false, do not try to use GOOGLEPLUSLIBRARY.
+
+# Search for GooglePlusLibrary include dir
+find_path(GOOGLEPLUSLIBRARY_DIR Readme.md
+ PATHS
+ $ENV{GOOGLEPLUSLIBRARY_DIR}
+ D:/Development/GooglePlusLibrary/Include
+)
+
+find_path(GOOGLEPLUSLIBRARY_DIR Readme.md
+ PATHS
+ $ENV{GOOGLEPLUSLIBRARY_DIR}
+ D:/Development/GooglePlusLibrary
+)
+
+if(GOOGLEPLUSLIBRARY_DIR)
+ set(GOOGLEPLUSLIBRARY_FOUND TRUE)
+else(GOOGLEPLUSLIBRARY_DIR)
+ set(GOOGLEPLUSLIBRARY_FOUND FALSE)
+endif(GOOGLEPLUSLIBRARY_DIR)
+
+mark_as_advanced(GOOGLEPLUSLIBRARY_DIR)
+
+
+
+
View
54 Src/Json/cmake_modules/FindLUA.cmake
@@ -0,0 +1,54 @@
+# - Find LUA
+# Find the LUA includes and library
+# This module defines
+# Lua_INCLUDE_DIR, where to find lua.h
+# Lua_LIBRARIES, the libraries needed to use Lua.
+# Lua_FOUND, If false, do not try to use Lua.
+
+IF (Lua_INCLUDE_DIR AND Lua_LIBRARY_DIR)
+
+ find_library(Lua_LIBRARIES NAMES lua
+ PATHS
+ ${Lua_LIBRARY_DIR}
+ )
+
+ELSE (Lua_INCLUDE_DIR AND Lua_LIBRARY_DIR)
+
+ # Search for lua include dir
+ find_path(Lua_INCLUDE_DIR lua.h
+ PATHS
+ $ENV{LUA_INCLUDE_DIR}
+ C:/lua/include
+ /usr/include
+ /usr/include/lua
+ /usr/local/include
+ /usr/local/include/lua
+ /Libs/lua/include
+ )
+
+ # Search for lua library dir
+ find_library(Lua_LIBRARIES NAMES lua lua5.1 lua51
+ PATHS
+ $ENV{LUA_LIBRARIES}
+ C:/lua/lib
+ /usr/lib
+ /usr/local/lib
+ /Libs/lua/lib
+ )
+
+ENDIF (Lua_INCLUDE_DIR AND Lua_LIBRARY_DIR)
+
+if(Lua_INCLUDE_DIR AND Lua_LIBRARIES)
+ set(Lua_FOUND TRUE)
+ message(STATUS "Found Lua: ${Lua_INCLUDE_DIR}, ${Lua_LIBRARIES}")
+else(Lua_INCLUDE_DIR AND Lua_LIBRARIES)
+ set(Lua_FOUND FALSE)
+ message(STATUS "Lua was not found.")
+endif(Lua_INCLUDE_DIR AND Lua_LIBRARIES)
+
+mark_as_advanced(Lua_INCLUDE_DIR)
+mark_as_advanced(Lua_LIBRARY_DIR)
+
+
+
+
View
26 Src/Json/cmake_modules/FindLUABIND.cmake
@@ -16,8 +16,10 @@ ENDIF()
FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp
HINTS
$ENV{LUABIND_DIR}
+ $ENV{LUABIND_INCLUDE_DIR}
PATH_SUFFIXES luabind include/luabind include
PATHS
+ C:/luabind
~/Library/Frameworks
/Library/Frameworks
/usr/local
@@ -26,10 +28,16 @@ FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp
/opt
)
+IF(LUABIND_INCLUDE_DIR)
+get_filename_component(LUABIND_DIR ${LUABIND_INCLUDE_DIR} PATH)
+ENDIF(LUABIND_INCLUDE_DIR)
+
FIND_LIBRARY(LUABIND_LIBRARY
- NAMES luabind
+ NAMES luabind libluabind libluabind_s_md
HINTS
$ENV{LUABIND_DIR}
+ $ENV{LUABIND_LIBRARIES}
+ C:/luabind/stage
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
@@ -41,9 +49,11 @@ FIND_LIBRARY(LUABIND_LIBRARY
)
FIND_LIBRARY(LUABIND_LIBRARY_DBG
- NAMES luabindd
+ NAMES luabindd libluabindd libluabind_s_mdd
HINTS
$ENV{LUABIND_DIR}
+ $ENV{LUABIND_LIBRARIES}
+ C:/luabind/stage
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
@@ -55,7 +65,8 @@ FIND_LIBRARY(LUABIND_LIBRARY_DBG
)
IF(LUABIND_LIBRARY)
- SET( LUABIND_LIBRARIES "${LUABIND_LIBRARY}" CACHE STRING "Luabind Libraries")
+ SET( LUABIND_LIBRARIES "${LUABIND_LIBRARY}" CACHE STRING "Luabind Libraries")
+ set(LUABIND_LIBRARIES debug ${LUABIND_LIBRARY_DBG} optimized ${LUABIND_LIBRARY})
ENDIF(LUABIND_LIBRARY)
INCLUDE(FindPackageHandleStandardArgs)
@@ -63,13 +74,4 @@ INCLUDE(FindPackageHandleStandardArgs)
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Luabind DEFAULT_MSG LUABIND_LIBRARIES LUABIND_INCLUDE_DIR)
-IF( NOT LUABIND_FIND_QUIETLY )
- IF( LUABIND_FOUND )
- MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARY}" )
- ENDIF()
- IF( LUABIND_LIBRARY_DBG )
- MESSAGE(STATUS "Luabind debug library availible: ${LUABIND_LIBRARY_DBG}")
- ENDIF()
-ENDIF()
-
MARK_AS_ADVANCED(LUABIND_INCLUDE_DIR LUABIND_LIBRARIES LUABIND_LIBRARY LUABIND_LIBRARY_DBG)
View
24 Src/Json/cmake_modules/FindUTF8CPP.cmake
@@ -0,0 +1,24 @@
+# - Find UTF8CPP
+# Find the UTF8CPP includes and library
+# This module defines
+# UTF8CPP_INCLUDE_DIR, where to find utf8.h
+# UTF8CPP_FOUND, If false, do not try to use UTF8CPP.
+
+# Search for utf8cpp include dir
+find_path(UTF8CPP_INCLUDE_DIR utf8.h
+ PATHS
+ $ENV{UTF8CPP_INCLUDE_DIR}
+ D:/Development/utf8_v2_3_4/source
+)
+
+if(UTF8CPP_INCLUDE_DIR)
+ set(UTF8CPP_FOUND TRUE)
+else(UTF8CPP_INCLUDE_DIR)
+ set(UTF8CPP_FOUND FALSE)
+endif(UTF8CPP_INCLUDE_DIR)
+
+mark_as_advanced(UTF8CPP_INCLUDE_DIR)
+
+
+
+
View
4 Src/Notification/NotificationParser/NotificationParser.cpp
@@ -28,10 +28,10 @@ NotificationParser::NotificationParser()
{
}
-void NotificationParser::add(const string& account_id, const string& notification_id)
+void NotificationParser::add(const string& my_account_id, const string& notification_id)
{
// update notifications
- onNotificationAdded(account_id, notification_id);
+ onNotificationAdded(my_account_id, notification_id);
}
void NotificationParser::add(const NotificationData& notification_data)
View
4 Src/Notification/NotificationParser/NotificationParser.hpp
@@ -28,10 +28,10 @@ class GOOGLEPLUSLIBRARY_API NotificationParser
public:
NotificationParser();
- static void add(const std::string& account_id, const std::string& notification_id);
+ static void add(const std::string& my_account_id, const std::string& notification_id);
static void add(const NotificationData& notification_data);
- static boost::signals2::signal<void(const std::string& account_id, const std::string& notification_id)> onNotificationAdded;
+ static boost::signals2::signal<void(const std::string& my_account_id, const std::string& notification_id)> onNotificationAdded;
/// @~english
/// @brief Converts Json to Post and update the post list(Stream) of all applicable
View
4 Src/Notification/Notifications/NotificationsData.cpp
@@ -16,9 +16,9 @@ NotificationsData::NotificationsData()
NotificationsData::NotificationsData(const string& my_account_id)
:Datas<Notification>(my_account_id)
{
- update_function_ = [&](const string& account_id, const string& notification_id)
+ update_function_ = [&](const string& my_account_id, const string& notification_id)
{
- if(getTargetAccountID() != account_id)
+ if(getTargetAccountID() != my_account_id)
{
return;
}
View
2 Src/Notification/Notifications/NotificationsData.hpp
@@ -21,7 +21,7 @@ class GOOGLEPLUSLIBRARY_API NotificationsData : public Datas<Notification>
public:
virtual ~NotificationsData();
private:
- std::function<void(const std::string& account_id, const std::string& notification_id)> update_function_;
+ std::function<void(const std::string& my_account_id, const std::string& notification_id)> update_function_;
};
/// @endcond Developer
View
4 Src/Share/ShareRanges/Impl/ShareRangesImpl.cpp
@@ -111,7 +111,7 @@ void ShareRangesImpl::removeAllCircles()
vector<Account> ShareRangesImpl::getAccounts() const
{
vector<Account> result;
- unordered_map<std::string, Account>::const_iterator it = accounts_.cbegin();
+ unordered_map<string, Account>::const_iterator it = accounts_.cbegin();
while(it != accounts_.cend())
{
result.push_back(it->second);
@@ -123,7 +123,7 @@ vector<Account> ShareRangesImpl::getAccounts() const
vector<Circle> ShareRangesImpl::getCircles() const
{
vector<Circle> result;
- unordered_map<std::string, Circle>::const_iterator it = circles_.cbegin();
+ unordered_map<string, Circle>::const_iterator it = circles_.cbegin();
while(it != circles_.cend())
{
result.push_back(it->second);
View
2 Src/Share/ShareRanges/ShareRangesLua.cpp
@@ -1,4 +1,4 @@
-#include <Share/ShareRanges/ShareRangesLua.hpp>
+#include <Share/ShareRanges/ShareRangesLua.hpp>
#include <Share/ShareRanges.hpp>
#include <Account/Account.hpp>
#include <Circle/Circle.hpp>
View
2 Src/Share/UrlShareSetting/Impl/UrlShareSettingImpl.cpp
@@ -1,4 +1,4 @@
-#include <Share/UrlShareSetting/Impl/UrlShareSettingImpl.hpp>
+#include <Share/UrlShareSetting/Impl/UrlShareSettingImpl.hpp>
#include <Account/Account.hpp>
#include <Circle/Circle.hpp>
View
2 Src/Share/UrlShareSetting/UrlShareSetting.cpp
@@ -1,4 +1,4 @@
-#include <Share/UrlShareSetting.hpp>
+#include <Share/UrlShareSetting.hpp>
#include <Share/UrlShareSetting/Impl/UrlShareSettingImpl.hpp>
#include <Account/MyAccount.hpp>
#include <Account/Account.hpp>
View
2 Src/Share/UrlShareSetting/UrlShareSettingLua.cpp
@@ -1,4 +1,4 @@
-#include <Share/UrlShareSetting/UrlShareSettingLua.hpp>
+#include <Share/UrlShareSetting/UrlShareSettingLua.hpp>
#include <Share/UrlShareSetting.hpp>
#include <UTF8/UTF8String.hpp>
#include <Share/ShareRanges.hpp>
View
52 Src/Stream/AccountStream/AccountStream.cpp
@@ -1,5 +1,5 @@
#include <Stream/AccountStream.hpp>
-#include <Datas/Datas.hpp>
+#include <Stream/AccountStream/Impl/AccountStreamImpl.hpp>
#include <Datas/DataContainer.hpp>
#include <Stream/Post/PostData.hpp>
#include <Stream/Post/Post.hpp>
@@ -11,72 +11,26 @@ namespace Gplusnasite
namespace GooglePlusLibrary
{
-namespace
-{
-
using namespace std;
-void connectEventHandler(Datas<Post>& stream_impl, AccountStream& account_stream)
-{
- DataContainer<PostData>::onDataInserted.connect([&](const string& post_id, const PostData& post_data)
- {
- if(post_data.getAccountID() != stream_impl.getTargetAccountID())
- {
- return;
- }
- Post post(post_id);
- stream_impl.add(post_id, post);
- });
-
- DataContainer<PostData>::onDataUpdated.connect([&](const string& post_id, const PostData& post_data)
- {
- if(!stream_impl.contain(post_id))
- {
- return;
- }
- Post post(post_id);
- account_stream.onPostEdited(post);
- });
-
- DataContainer<PostData>::onDataDeleted.connect([&](const string& post_id)
- {
- if(!stream_impl.contain(post_id))
- {
- return;
- }
- account_stream.onPostDeleted(post_id);
- });
-}
-
-}
-
AccountStream::AccountStream()
:impl_()
{
}
AccountStream::AccountStream(const Account& account)
-:impl_(make_shared<Datas<Post> >(account.getAccountID()))
+:impl_(make_shared<AccountStreamImpl>(account.getAccountID()))
{
- assert(impl_);
- connectEventHandler(*impl_, *this);
}
AccountStream::AccountStream(const MyAccount& my_account)
-:impl_(make_shared<Datas<Post> >(my_account.getAccountID()))
+:impl_(make_shared<AccountStreamImpl>(my_account.getAccountID()))
{
- assert(impl_);
- connectEventHandler(*impl_, *this);
}
AccountStream::AccountStream(const AccountStream& account_stream)
:impl_(account_stream.impl_)
{
- if(impl_ == nullptr)
- {
- return;
- }
- connectEventHandler(*impl_, *this);
}
string AccountStream::getAccountID() const
View
44 Src/Stream/AccountStream/Impl/AccountStreamImpl.cpp
@@ -0,0 +1,44 @@
+#include <Stream/AccountStream/Impl/AccountStreamImpl.hpp>
+#include <Stream/Post/Post.hpp>
+#include <Stream/Post/PostParser/PostParser.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+using namespace std;
+
+AccountStreamImpl::AccountStreamImpl()
+:Datas<Post>()
+{
+}
+
+AccountStreamImpl::AccountStreamImpl(const string& my_account_id)
+:Datas<Post>(my_account_id)
+{
+ update_function_ = [&](const string& my_account_id, const string& post_id)
+ {
+ if(getTargetAccountID() != my_account_id)
+ {
+ return;
+ }
+
+ Post post(post_id);
+ if(post.getAccountID() != my_account_id)
+ {
+ return;
+ }
+ add(post.getPostID(), post);
+ cout << "AccountStreamImpl:Added" << endl;
+ };
+ PostParser::onPostAdded.connect(update_function_);
+}
+
+AccountStreamImpl::~AccountStreamImpl()
+{
+ PostParser::onPostAdded.disconnect(update_function_);
+}
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
26 Src/Stream/AccountStream/Impl/AccountStreamImpl.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <GooglePlusLibraryExports.hpp>
+
+#include <Datas/Datas.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+class Post;
+
+class GOOGLEPLUSLIBRARY_API AccountStreamImpl : public Datas<Post>
+{
+public:
+ AccountStreamImpl();
+ explicit AccountStreamImpl(const std::string& my_account_id);
+
+ virtual ~AccountStreamImpl();
+private:
+ std::function<void(const std::string& my_account_id, const std::string& post_id)> update_function_;
+};
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
116 Src/Stream/HomeStream/HomeStream.cpp
@@ -1,5 +1,5 @@
#include <Stream/HomeStream.hpp>
-#include <Datas/Datas.hpp>
+#include <Stream/HomeStream/Impl/HomeStreamImpl.hpp>
#include <Stream/Post/PostParser/PostParser.hpp>
#include <Stream/Post/PostData.hpp>
#include <Stream/Post/Post.hpp>
@@ -12,36 +12,6 @@ namespace GooglePlusLibrary
using namespace std;
-namespace
-{
-
-void connectEventHandler(Datas<Post>& stream_impl)
-{
- DataContainer<PostData>::onDataInserted.connect([&](const string& post_id, const PostData& post_data)
- {
- Post post(post_id);
- stream_impl.add(post_id, post);
- int a = 3;
- });
-
- DataContainer<PostData>::onDataUpdated.connect([&](const string& post_id, const PostData& post_data)
- {
- Post post(post_id);
- stream_impl.add(post_id, post);
- });
-
- DataContainer<PostData>::onDataDeleted.connect([&](const string& post_id)
- {
- if(!stream_impl.contain(post_id))
- {
- return;
- }
- stream_impl.remove(post_id);
- });
-}
-
-}
-
HomeStream::HomeStream()
:impl_()
{
@@ -49,16 +19,24 @@ HomeStream::HomeStream()
}
HomeStream::HomeStream(const MyAccount& my_account)
-:impl_(make_shared<Datas<Post> >(my_account.getAccountID()))
+:impl_(make_shared<HomeStreamImpl>(my_account.getAccountID()))
{
cout << "HomeStream::HomeStream(const MyAccount& my_account)" << endl;
-
+ /*
assert(impl_);
- impl_->onItemAdded.connect(boost::bind(&HomeStream::onPostAdded, this));
- impl_->onItemUpdated.connect(boost::bind(&HomeStream::onPostEdited, this));
- impl_->onItemDeleted.connect(boost::bind(&HomeStream::onPostDeleted, this));
-
- connectEventHandler(*impl_);
+ impl_->onItemAdded.connect([&](const Post& post)
+ {
+ onPostAdded(post);
+ });
+ impl_->onItemUpdated.connect([&](const Post& post)
+ {
+ onPostEdited(post);
+ });
+ impl_->onItemDeleted.connect([&](const string& post_id)
+ {
+ onPostDeleted(post_id);
+ });
+ */
}
HomeStream::HomeStream(const HomeStream& home_stream)
@@ -70,12 +48,29 @@ HomeStream::HomeStream(const HomeStream& home_stream)
return;
}
cout << "HomeStream::HomeStream(const HomeStream& home_stream) : impl_ != nullptr" << endl;
+ /*
+ assert(impl_);
+
+ onPostAdded = home_stream.onPostAdded;
+ onPostEdited = home_stream.onPostEdited;
+ onPostDeleted = home_stream.onPostDeleted;
+ onCommentAdded = home_stream.onCommentAdded;
+ onCommentEdited = home_stream.onCommentEdited;
+ onCommentDeleted = home_stream.onCommentDeleted;
- impl_->onItemAdded.connect(boost::bind(&HomeStream::onPostAdded, this));
- impl_->onItemUpdated.connect(boost::bind(&HomeStream::onPostEdited, this));
- impl_->onItemDeleted.connect(boost::bind(&HomeStream::onPostDeleted, this));
-
- connectEventHandler(*impl_);
+ impl_->onItemAdded.connect([&](const Post& post)
+ {
+ onPostAdded(post);
+ });
+ impl_->onItemUpdated.connect([&](const Post& post)
+ {
+ onPostEdited(post);
+ });
+ impl_->onItemDeleted.connect([&](const string& post_id)
+ {
+ onPostDeleted(post_id);
+ });
+ */
}
string HomeStream::getAccountID() const
@@ -146,25 +141,46 @@ HomeStream& HomeStream::operator=(const HomeStream& home_stream)
{
cout << "HomeStream& HomeStream::operator=(const HomeStream& home_stream)" << endl;
impl_ = home_stream.impl_;
+ if(impl_ == nullptr)
+ {
+ return *this;
+ }
+ /*
onPostAdded = home_stream.onPostAdded;
onPostEdited = home_stream.onPostEdited;
onPostDeleted = home_stream.onPostDeleted;
onCommentAdded = home_stream.onCommentAdded;
onCommentEdited = home_stream.onCommentEdited;
onCommentDeleted = home_stream.onCommentDeleted;
-
- /*
- impl_->onItemAdded.connect(boost::bind(&HomeStream::onPostAdded, this));
- impl_->onItemUpdated.connect(boost::bind(&HomeStream::onPostEdited, this));
- impl_->onItemDeleted.connect(boost::bind(&HomeStream::onPostDeleted, this));
+
+ impl_->onItemAdded.connect([&](const Post& post)
+ {
+ onPostAdded(post);
+ });
+ impl_->onItemUpdated.connect([&](const Post& post)
+ {
+ onPostEdited(post);
+ });
+ impl_->onItemDeleted.connect([&](const string& post_id)
+ {
+ onPostDeleted(post_id);
+ });
*/
-
return *this;
}
+void HomeStream::disconnectAllEventHandler()
+{
+ onPostAdded.disconnectAll();
+ onPostEdited.disconnectAll();
+ onPostDeleted.disconnectAll();
+ onCommentAdded.disconnectAll();
+ onCommentEdited.disconnectAll();
+ onCommentDeleted.disconnectAll();
+}
+
HomeStream::~HomeStream()
{
- //DataContainer<PostData>::onDataInserted.disconnect()
}
}// namespace GooglePlusLibrary
View
40 Src/Stream/HomeStream/Impl/HomeStreamImpl.cpp
@@ -0,0 +1,40 @@
+#include <Stream/HomeStream/Impl/HomeStreamImpl.hpp>
+#include <Stream/Post/Post.hpp>
+#include <Stream/Post/PostParser/PostParser.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+using namespace std;
+
+HomeStreamImpl::HomeStreamImpl()
+:Datas<Post>()
+{
+}
+
+HomeStreamImpl::HomeStreamImpl(const string& my_account_id)
+:Datas<Post>(my_account_id)
+{
+ update_function_ = [&](const string& my_account_id, const string& post_id)
+ {
+ if(getTargetAccountID() != my_account_id)
+ {
+ return;
+ }
+
+ Post post(post_id);
+ add(post.getPostID(), post);
+ cout << "HomeStreamImpl:Added" << endl;
+ };
+ PostParser::onPostAdded.connect(update_function_);
+}
+
+HomeStreamImpl::~HomeStreamImpl()
+{
+ PostParser::onPostAdded.disconnect(update_function_);
+}
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
26 Src/Stream/HomeStream/Impl/HomeStreamImpl.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <GooglePlusLibraryExports.hpp>
+
+#include <Datas/Datas.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+class Post;
+
+class GOOGLEPLUSLIBRARY_API HomeStreamImpl : public Datas<Post>
+{
+public:
+ HomeStreamImpl();
+ explicit HomeStreamImpl(const std::string& my_account_id);
+
+ virtual ~HomeStreamImpl();
+private:
+ std::function<void(const std::string& my_account_id, const std::string& post_id)> update_function_;
+};
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
2 Src/Stream/Post/PostParser/PostParser.hpp
@@ -40,7 +40,7 @@ class GOOGLEPLUSLIBRARY_API PostParser
static void add(const std::string& account_id, const PostData& post_data);
- static boost::signals2::signal<void(const std::string&, const std::string&)> onPostAdded;
+ static boost::signals2::signal<void(const std::string& my_account_id, const std::string& post_id)> onPostAdded;
/// @~english
/// @brief Converts Json to Post and update the post list(Stream) of all applicable
View
6 Src/Stream/StreamObserver/Impl/StreamObserverImpl.cpp
@@ -32,7 +32,7 @@ StreamObserverImpl::StreamObserverImpl()
{
}
-HttpResponse StreamObserverImpl::get(const string& account_id, const string& url) const
+HttpResponse StreamObserverImpl::get(const string& my_account_id, const string& url) const
{
LuaScript<bool(string, string)> lua_script("LuaScript/streamObserver.lua", "streamObserverUpdate", [&](lua_State* lua_state)
{
@@ -49,7 +49,7 @@ HttpResponse StreamObserverImpl::get(const string& account_id, const string& url
});
Connection connection;
- connection.setCurrentAccountID(account_id);
+ connection.setCurrentAccountID(my_account_id);
int chunked_json_size = 0;
string chunked_json;
@@ -91,7 +91,7 @@ HttpResponse StreamObserverImpl::get(const string& account_id, const string& url
int size = chunked_json.size();
if(chunked_json_size <= size)
{
- auto result = lua_script(account_id, chunked_json);
+ auto result = lua_script(my_account_id, chunked_json);
}
}
View
2 Src/Stream/StreamObserver/Impl/StreamObserverImpl.hpp
@@ -26,7 +26,7 @@ class GOOGLEPLUSLIBRARY_API StreamObserverImpl
public:
StreamObserverImpl();
- HttpResponse get(const std::string& account_id, const std::string& url) const;
+ HttpResponse get(const std::string& my_account_id, const std::string& url) const;
void scriptSleep(unsigned long milliseconds) const;
View
43 Src/Thread/CMakeLists.txt
@@ -16,8 +16,11 @@
#