Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ReadWriteMutexクラスでwarningを発生させる項目があったので非表示マクロを編集した

  • Loading branch information...
commit a9bae8dff49b0d513600598d1fbc8119aa80333e 1 parent 2e162dd
@gplusnasite authored
View
9 Include/AttachedData/AttachedPage.hpp
@@ -30,6 +30,11 @@ class GOOGLEPLUSLIBRARY_API AttachedPage
{
public:
AttachedPage();
+ explicit AttachedPage(const std::string& page_url);
+ AttachedPage(const std::string& page_url, int thumbnail_position);
+
+ std::string getPageUrl() const;
+ void setPageUrl(const std::string& page_url) const;
UTF8String getPageTitle() const;
@@ -37,8 +42,6 @@ class GOOGLEPLUSLIBRARY_API AttachedPage
std::string getPageFaviconUrl() const;
- std::string getPageUrl() const;
-
/// @~english
/// @brief Get Thumbnail image Url is set
/// @invariant This function does not throw an exception
@@ -79,7 +82,7 @@ class GOOGLEPLUSLIBRARY_API AttachedPage
/// @param[in] thumbnail_position 投稿に設定するサムネイル画像の位置(0スタート)
/// @~
/// @since Version 1.0
- void setThumbnailPosition(unsigned int thumbnail_position);
+ void setThumbnailPosition(unsigned int thumbnail_position) const;
virtual ~AttachedPage();
View
49 Include/Share/UrlShareSetting.hpp
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <GooglePlusLibraryExports.hpp>
+
+#ifdef GOOGLEPLUSLIBRARY_NO_WARNINGS
+#ifdef _MSC_VER
+#pragma warning (disable:4251)
+#endif
+#endif
+
+#include <memory>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+class UrlShareSettingImpl;
+class MyAccount;
+class UTF8String;
+class ShareRanges;
+
+class GOOGLEPLUSLIBRARY_API UrlShareSetting
+{
+public:
+ UrlShareSetting();
+ explicit UrlShareSetting(const MyAccount& my_account);
+
+ UTF8String getMessage() const;
+ void setMessage(const UTF8String& message) const;
+
+ ShareRanges getShareRanges() const;
+ void setShareRanges(const ShareRanges& share_ranges) const;
+
+ bool isLockedPost() const;
+ void lockPost() const;
+ void unlockPost() const;
+
+ bool isCommentDisabled() const;
+ void disableComment() const;
+ void enableComment() const;
+
+ virtual ~UrlShareSetting();
+private:
+ std::shared_ptr<UrlShareSettingImpl> impl_;
+};
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
33 LuaScript/GetPageInformation.lua
@@ -0,0 +1,33 @@
+function getPageInformation(attached_page_data)
+
+ require("LuaScript/String")
+
+ attached_page_data:setPageUrl(json:selectChildNode(UTF8String("[1].[66].[0].[1]")):asString():toStdString())
+
+ favicon_url = json:selectChildNode(UTF8String("[1].[66].[0].[2]")):asString():toStdString()
+
+ if(isStringNullOrEmpty(favicon_url) ~= nil) then
+
+ if(string.find(favicon_url, "https:") == nil) then
+ favicon_url = "https:" .. favicon_url
+ end
+ end
+
+ attached_page_data:setPageFaviconUrl(favicon_url)
+
+ attached_page_data:setPageTitle(json:selectChildNode(UTF8String("[1].[66].[0].[3]")):asString())
+
+ attached_page_data:setPageDescription(json:selectChildNode(UTF8String("[1].[66].[0].[7]")):asString())
+
+ thumbnail_url = json:selectChildNode(UTF8String("[1].[66].[0].[8]")):asString():toStdString()
+
+ if(isStringNullOrEmpty(thumbnail_url) ~= nil) then
+
+ if(string.find(thumbnail_url, "https:") ~= 0) then
+
+ thumbnail_url = "https:" .. thumbnail_url
+ end
+ end
+
+ do return true end
+end
View
27 Src/AttachedData/AttachedPage/AttachedPage.cpp
@@ -15,6 +15,26 @@ AttachedPage::AttachedPage()
{
}
+AttachedPage::AttachedPage(const string& page_url)
+:url_data_(make_shared<AttachedPageData>(page_url))
+{
+}
+
+AttachedPage::AttachedPage(const string& page_url, int thumbnail_position)
+:url_data_(make_shared<AttachedPageData>(page_url, thumbnail_position))
+{
+}
+
+string AttachedPage::getPageUrl() const
+{
+ return url_data_->getPageUrl();
+}
+
+void AttachedPage::setPageUrl(const std::string& page_url) const
+{
+ url_data_->setPageUrl(page_url);
+}
+
UTF8String AttachedPage::getPageTitle() const
{
return url_data_->getPageTitle();
@@ -30,17 +50,12 @@ string AttachedPage::getPageFaviconUrl() const
return url_data_->getPageFaviconUrl();
}
-string AttachedPage::getPageUrl() const
-{
- return url_data_->getPageUrl();
-}
-
string AttachedPage::getThumbnailUrl() const
{
return url_data_->getThumbnailUrl();
}
-void AttachedPage::setThumbnailPosition(unsigned int thumbnail_position)
+void AttachedPage::setThumbnailPosition(unsigned int thumbnail_position) const
{
return url_data_->setThumbnailPosition(thumbnail_position);
}
View
39 Src/AttachedData/AttachedPage/AttachedPageData.cpp
@@ -1,5 +1,4 @@
#include <AttachedData/AttachedPage/AttachedPageData.hpp>
-//#include <Utility/Utility.hpp>
namespace Gplusnasite
{
@@ -18,6 +17,32 @@ thumbnail_position_(-1)
{
}
+AttachedPageData::AttachedPageData(const std::string& page_url)
+:page_title_(""),
+page_description_(""),
+page_favicon_url_(""),
+page_url_(page_url),
+thumbnail_url_(""),
+thumbnail_position_(-1)
+{
+}
+
+AttachedPageData::AttachedPageData(const std::string& page_url, int thumbnail_position)
+:page_title_(""),
+page_description_(""),
+page_favicon_url_(""),
+page_url_(page_url),
+thumbnail_url_(""),
+thumbnail_position_(thumbnail_position)
+{
+}
+
+string AttachedPageData::getPageUrl() const
+{
+ ScopedReadLock lock(read_write_mutex_);
+ return page_url_;
+}
+
UTF8String AttachedPageData::getPageTitle() const
{
ScopedReadLock lock(read_write_mutex_);
@@ -54,18 +79,6 @@ void AttachedPageData::setPageFaviconUrl(const string& page_favicon_url)
page_favicon_url_ = page_favicon_url;
}
-string AttachedPageData::getPageUrl() const
-{
- ScopedReadLock lock(read_write_mutex_);
- return page_url_;
-}
-
-void AttachedPageData::setPageUrl(const string& page_url)
-{
- ScopedWriteLock lock(read_write_mutex_);
- page_url_ = page_url;
-}
-
string AttachedPageData::getThumbnailUrl() const
{
ScopedReadLock lock(read_write_mutex_);
View
26 Src/AttachedData/AttachedPage/AttachedPageData.hpp
@@ -6,16 +6,27 @@
#include <Thread/ReadWriteMutex.hpp>
+#include <luabind/luabind.hpp>
+
+struct lua_State;
+
namespace Gplusnasite
{
namespace GooglePlusLibrary
{
+class JsonObject;
+
/// @cond Developer
class GOOGLEPLUSLIBRARY_API AttachedPageData
{
public:
AttachedPageData();
+ explicit AttachedPageData(const std::string& page_url);
+ AttachedPageData(const std::string& page_url, int thumbnail_position);
+
+ static AttachedPageData parse(JsonObject& json);
+ static AttachedPageData parse(luabind::object json_object);
public:
UTF8String getPageTitle() const;
@@ -92,6 +103,21 @@ class GOOGLEPLUSLIBRARY_API AttachedPageData
unsigned int thumbnail_position_;
public:
+
+ /// @~english
+ /// @brief Register this class to lua script to use
+ /// @invariant This function does not throw an exception
+ /// @invariant This function is thread-safe
+ /// @param[in] lua_state Lua state of which it is registered
+ /// @~japanese
+ /// @brief Luaスクリプトにこのクラスを登録して使えるようにします
+ /// @invariant この関数は例外を投げません
+ /// @invariant この関数はスレッドセーフです
+ /// @param[in] lua_state 登録先Luaステート
+ /// @~
+ /// @since Version 1.0
+ static void bindToScript(lua_State* lua_state);
+public:
virtual ~AttachedPageData();
private:
mutable ReadWriteMutex read_write_mutex_;
View
33 Src/AttachedData/AttachedPage/AttachedPageDataLua.cpp
@@ -1,4 +1,3 @@
-#include <AttachedData/AttachedPage/AttachedPageDataLua.hpp>
#include <AttachedData/AttachedPage/AttachedPageData.hpp>
#include <Utility/LuaScript.hpp>
@@ -14,11 +13,7 @@ namespace GooglePlusLibrary
using namespace std;
using namespace ::luabind;
-AttachedPageDataLua::AttachedPageDataLua()
-{
-}
-
-AttachedPageData AttachedPageDataLua::parse(JsonObject& json)
+AttachedPageData AttachedPageData::parse(JsonObject& json)
{
LuaScript<bool(JsonObject*, AttachedPageData*)> lua_script("LuaScript/ParseAttachedPage.lua", "parseAttachedPage", [](lua_State* lua_state)
{
@@ -31,7 +26,7 @@ AttachedPageData AttachedPageDataLua::parse(JsonObject& json)
return attached_page_data;
}
-AttachedPageData AttachedPageDataLua::parse(luabind::object json_object)
+AttachedPageData AttachedPageData::parse(luabind::object json_object)
{
if (luabind::type(json_object) != LUA_TLIGHTUSERDATA)
{
@@ -41,7 +36,21 @@ AttachedPageData AttachedPageDataLua::parse(luabind::object json_object)
return parse(*node_pointer);
}
-void AttachedPageDataLua::bindToScript(lua_State* lua_state)
+void AttachedPageData::setPageUrl(const string& page_url)
+{
+ ScopedWriteLock lock(read_write_mutex_);
+ LuaScript<bool(AttachedPageData*)> lua_script("LuaScript/ParseAttachedPage.lua", "parseAttachedPage", [](lua_State* lua_state)
+ {
+ UTF8StringLua::bindToScript(lua_state);
+ JsonObjectLua::bindToScript(lua_state);
+ bindToScript(lua_state);
+ });
+ AttachedPageData attached_page_data;
+ page_url_ = page_url;
+ lua_script(&attached_page_data);
+}
+
+void AttachedPageData::bindToScript(lua_State* lua_state)
{
module(lua_state)
[
@@ -49,11 +58,11 @@ void AttachedPageDataLua::bindToScript(lua_State* lua_state)
.def(constructor<>())
.scope
[
- def("parse", static_cast<AttachedPageData(*)(JsonObject&)>(&AttachedPageDataLua::parse))
+ def("parse", static_cast<AttachedPageData(*)(JsonObject&)>(&AttachedPageData::parse))
]
.scope
[
- def("parse", static_cast<AttachedPageData(*)(luabind::object)>(&AttachedPageDataLua::parse))
+ def("parse", static_cast<AttachedPageData(*)(luabind::object)>(&AttachedPageData::parse))
]
.def("setPageTitle", &AttachedPageData::setPageTitle)
.def("setPageDescription", &AttachedPageData::setPageDescription)
@@ -65,9 +74,5 @@ void AttachedPageDataLua::bindToScript(lua_State* lua_state)
];
}
-AttachedPageDataLua::~AttachedPageDataLua()
-{
-}
-
}// namespace GooglePlusLibrary
}// namespace Gplusnasite
View
74 Src/Share/UrlShareSetting/Impl/UrlShareSettingImpl.cpp
@@ -0,0 +1,74 @@
+#include <Share/UrlShareSetting/Impl/UrlShareSettingImpl.hpp>
+
+#include <Account/Account.hpp>
+#include <Circle/Circle.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+UrlShareSettingImpl::UrlShareSettingImpl()
+:message_(),
+share_ranges_(),
+is_locked_post_(false),
+is_comment_disabled_(false)
+{
+}
+
+UTF8String UrlShareSettingImpl::getMessage() const
+{
+ return message_;
+}
+
+void UrlShareSettingImpl::setMessage(const UTF8String& message)
+{
+ message_ = message;
+}
+
+ShareRanges UrlShareSettingImpl::getShareRanges() const
+{
+ return share_ranges_;
+}
+
+void UrlShareSettingImpl::setShareRanges(const ShareRanges& share_ranges)
+{
+ share_ranges_ = share_ranges;
+}
+
+bool UrlShareSettingImpl::isLockedPost() const
+{
+ return is_locked_post_;
+}
+
+void UrlShareSettingImpl::lockPost()
+{
+ is_locked_post_ = true;
+}
+
+void UrlShareSettingImpl::unlockPost()
+{
+ is_locked_post_ = false;
+}
+
+bool UrlShareSettingImpl::isCommentDisabled() const
+{
+ return is_comment_disabled_;
+}
+
+void UrlShareSettingImpl::disableComment()
+{
+ is_comment_disabled_ = true;
+}
+
+void UrlShareSettingImpl::enableComment()
+{
+ is_comment_disabled_ = false;
+}
+
+UrlShareSettingImpl::~UrlShareSettingImpl()
+{
+}
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
51 Src/Share/UrlShareSetting/Impl/UrlShareSettingImpl.hpp
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <GooglePlusLibraryExports.hpp>
+
+#include <UTF8/UTF8String.hpp>
+#include <Share/ShareRanges.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+/// @cond Developer
+class GOOGLEPLUSLIBRARY_API UrlShareSettingImpl
+{
+public:
+ UrlShareSettingImpl();
+
+public:
+ UTF8String getMessage() const;
+ void setMessage(const UTF8String& message);
+private:
+ UTF8String message_;
+
+public:
+ ShareRanges getShareRanges() const;
+ void setShareRanges(const ShareRanges& share_ranges);
+private:
+ ShareRanges share_ranges_;
+
+public:
+ bool isLockedPost() const;
+ void lockPost();
+ void unlockPost();
+private:
+ bool is_locked_post_;
+
+public:
+ bool isCommentDisabled() const;
+ void disableComment();
+ void enableComment();
+private:
+ bool is_comment_disabled_;
+
+public:
+ virtual ~UrlShareSettingImpl();
+};
+/// @endcond Developer
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
91 Src/Share/UrlShareSetting/UrlShareSetting.cpp
@@ -0,0 +1,91 @@
+#include <Share/UrlShareSetting.hpp>
+#include <Share/UrlShareSetting/Impl/UrlShareSettingImpl.hpp>
+#include <Account/MyAccount.hpp>
+#include <Account/Account.hpp>
+#include <Circle/Circle.hpp>
+#include <UTF8/UTF8String.hpp>
+#include <Share/ShareRanges.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+using namespace std;
+
+UrlShareSetting::UrlShareSetting()
+:impl_(make_shared<UrlShareSettingImpl>())
+{
+}
+
+UrlShareSetting::UrlShareSetting(const MyAccount& my_account)
+:impl_(make_shared<UrlShareSettingImpl>())
+{
+}
+
+UTF8String UrlShareSetting::getMessage() const
+{
+ assert(impl_);
+ return impl_->getMessage();
+}
+
+void UrlShareSetting::setMessage(const UTF8String& message) const
+{
+ assert(impl_);
+ impl_->setMessage(message);
+}
+
+ShareRanges UrlShareSetting::getShareRanges() const
+{
+ assert(impl_);
+ return impl_->getShareRanges();
+}
+
+void UrlShareSetting::setShareRanges(const ShareRanges& share_ranges) const
+{
+ assert(impl_);
+ impl_->setShareRanges(share_ranges);
+}
+
+bool UrlShareSetting::isLockedPost() const
+{
+ assert(impl_);
+ return impl_->isLockedPost();
+}
+
+void UrlShareSetting::lockPost() const
+{
+ assert(impl_);
+ impl_->lockPost();
+}
+
+void UrlShareSetting::unlockPost() const
+{
+ assert(impl_);
+ impl_->unlockPost();
+}
+
+bool UrlShareSetting::isCommentDisabled() const
+{
+ assert(impl_);
+ return impl_->isCommentDisabled();
+}
+
+void UrlShareSetting::disableComment() const
+{
+ assert(impl_);
+ impl_->disableComment();
+}
+
+void UrlShareSetting::enableComment() const
+{
+ assert(impl_);
+ impl_->enableComment();
+}
+
+UrlShareSetting::~UrlShareSetting()
+{
+}
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
43 Src/Share/UrlShareSetting/UrlShareSettingLua.cpp
@@ -0,0 +1,43 @@
+#include <Share/UrlShareSetting/UrlShareSettingLua.hpp>
+#include <Share/UrlShareSetting.hpp>
+#include <UTF8/UTF8String.hpp>
+#include <Share/ShareRanges.hpp>
+#include <luabind/luabind.hpp>
+
+namespace Gplusnasite
+{
+namespace GooglePlusLibrary
+{
+
+using namespace std;
+using namespace ::luabind;
+
+UrlShareSettingLua::UrlShareSettingLua()
+{
+}
+
+void UrlShareSettingLua::bindToScript(lua_State* lua_state)
+{
+ module(lua_state)
+ [
+ class_<UrlShareSetting>("UrlShareSetting")
+ .def(constructor<>())
+ .def("getMessage", &UrlShareSetting::getMessage)
+ .def("setMessage", &UrlShareSetting::setMessage)
+ .def("getShareRanges", &UrlShareSetting::getShareRanges)
+ .def("setShareRanges", &UrlShareSetting::setShareRanges)
+ .def("isLockedPost", &UrlShareSetting::isLockedPost)
+ .def("lockPost", &UrlShareSetting::lockPost)
+ .def("unlockPost", &UrlShareSetting::unlockPost)
+ .def("isCommentDisabled", &UrlShareSetting::isCommentDisabled)
+ .def("disableComment", &UrlShareSetting::disableComment)
+ .def("enableComment", &UrlShareSetting::enableComment)
+ ];
+}
+
+UrlShareSettingLua::~UrlShareSettingLua()
+{
+}
+
+}// namespace GooglePlusLibrary
+}// namespace Gplusnasite
View
22 ...Data/AttachedPage/AttachedPageDataLua.hpp → ...re/UrlShareSetting/UrlShareSettingLua.hpp
@@ -2,31 +2,18 @@
#include <GooglePlusLibraryExports.hpp>
-#ifdef GOOGLEPLUSLIBRARY_NO_WARNINGS
-#ifdef _MSC_VER
-#pragma warning (disable:4996)
-#endif
-#endif
-
-#include <luabind/luabind.hpp>
+struct lua_State;
namespace Gplusnasite
{
namespace GooglePlusLibrary
{
-class AttachedPageData;
-class JsonObject;
-
-/// @cond Developer
-class GOOGLEPLUSLIBRARY_API AttachedPageDataLua
+class GOOGLEPLUSLIBRARY_API UrlShareSettingLua
{
public:
- AttachedPageDataLua();
+ UrlShareSettingLua();
- static AttachedPageData parse(JsonObject& json);
- static AttachedPageData parse(luabind::object json_object);
-
/// @~english
/// @brief Register this class to lua script to use
/// @invariant This function does not throw an exception
@@ -41,9 +28,8 @@ class GOOGLEPLUSLIBRARY_API AttachedPageDataLua
/// @since Version 1.0
static void bindToScript(lua_State* lua_state);
- virtual ~AttachedPageDataLua();
+ virtual ~UrlShareSettingLua();
};
-/// @endcond Developer
}// namespace GooglePlusLibrary
}// namespace Gplusnasite
View
4 Src/Stream/Post/PostParser/PostParserLua.cpp
@@ -3,7 +3,7 @@
#include <Stream/Post/PostDataLua.hpp>
#include <AttachedData/AttachedLocation/AttachedLocationDataLua.hpp>
#include <AttachedData/AttachedSearchResult/AttachedSearchResultDataLua.hpp>
-#include <AttachedData/AttachedPage/AttachedPageDataLua.hpp>
+#include <AttachedData/AttachedPage/AttachedPageData.hpp>
#include <Utility/LuaScript.hpp>
#include <Json/JsonObject.hpp>
#include <Json/JsonObjectLua.hpp>
@@ -25,7 +25,7 @@ void PostParser::add(const string& account_id, JsonObject& json)
PostDataLua::bindToScript(lua_state);
AttachedLocationDataLua::bindToScript(lua_state);
AttachedSearchResultDataLua::bindToScript(lua_state);
- AttachedPageDataLua::bindToScript(lua_state);
+ AttachedPageData::bindToScript(lua_state);
JsonObjectLua::bindToScript(lua_state);
bindToScript(lua_state);
});
View
1  Src/Thread/ReadWriteMutex.hpp
@@ -5,6 +5,7 @@
#ifdef GOOGLEPLUSLIBRARY_NO_WARNINGS
#ifdef _MSC_VER
#pragma warning (disable:4251)
+#pragma warning (disable:4996)
#endif
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.