[libsoupmm] Add Soup::Cookie
- From: Siavash Safi <siavashs src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoupmm] Add Soup::Cookie
- Date: Thu, 3 Sep 2009 12:53:19 +0000 (UTC)
commit e027f5cb8d15b6e77f606dfdba61bdad22f3dba5
Author: Siavash Safi <siavash siavashs org>
Date: Thu Sep 3 17:19:16 2009 +0430
Add Soup::Cookie
* libsoup/.gitignore:
* libsoup/libsoupmm.h:
* libsoup/src/cookie.ccg:
* libsoup/src/cookie.hg:
* libsoup/src/filelist.am: Add cookie.hg
libsoup/.gitignore | 2 +
libsoup/libsoupmm.h | 1 +
libsoup/src/cookie.ccg | 34 +++++++++++++++++++++++++++++++++
libsoup/src/cookie.hg | 48 +++++++++++++++++++++++++++++++++++++++++++++++
libsoup/src/filelist.am | 2 +-
5 files changed, 86 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/.gitignore b/libsoup/.gitignore
index f65f7c8..cc4450a 100644
--- a/libsoup/.gitignore
+++ b/libsoup/.gitignore
@@ -4,6 +4,8 @@
/libsoupmm/address.h
/libsoupmm/auth.cc
/libsoupmm/auth.h
+/libsoupmm/cookie.cc
+/libsoupmm/cookie.h
/libsoupmm/enums.cc
/libsoupmm/enums.h
/libsoupmm/message.cc
diff --git a/libsoup/libsoupmm.h b/libsoup/libsoupmm.h
index c6a1415..7add5c1 100644
--- a/libsoup/libsoupmm.h
+++ b/libsoup/libsoupmm.h
@@ -25,6 +25,7 @@
#include <libsoupmmconfig.h>
#include <libsoupmm/address.h>
#include <libsoupmm/auth.h>
+#include <libsoupmm/cookie.h>
#include <libsoupmm/enums.h>
#include <libsoupmm/form.h>
#include <libsoupmm/message.h>
diff --git a/libsoup/src/cookie.ccg b/libsoup/src/cookie.ccg
new file mode 100644
index 0000000..e73ab01
--- /dev/null
+++ b/libsoup/src/cookie.ccg
@@ -0,0 +1,34 @@
+/* Copyright (c) 2009 Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libsoup/soup-cookie.h>
+
+namespace Soup
+{
+
+Cookie::Cookie(const std::string& name, const std::string& value, const std::string& domain, const std::string& path, int max_age)
+{
+ gobject_ = soup_cookie_new(name.c_str(), value.c_str(), domain.c_str(), path.c_str(), max_age);
+}
+
+Cookie::Cookie(const std::string& header, URI& origin)
+{
+ gobject_ = soup_cookie_parse(header.c_str(), origin.gobj());
+}
+
+} // namespace Soup
diff --git a/libsoup/src/cookie.hg b/libsoup/src/cookie.hg
new file mode 100644
index 0000000..f14dc78
--- /dev/null
+++ b/libsoup/src/cookie.hg
@@ -0,0 +1,48 @@
+/* Copyright (c) 2009 Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libsoupmm/uri.h>
+
+_DEFS(libsoupmm,libsoup)
+
+namespace Soup
+{
+
+class Cookie
+{
+ _CLASS_BOXEDTYPE(Cookie, SoupCookie, soup_cookie_new, soup_cookie_copy, soup_cookie_free)
+ _CUSTOM_DEFAULT_CTOR
+ _IGNORE(soup_cookie_copy, soup_cookie_free, soup_cookie_equal)
+
+public:
+ explicit Cookie(const std::string& name, const std::string& value, const std::string& domain, const std::string& path, int max_age);
+ explicit Cookie(const std::string& header, URI& origin);
+
+ _WRAP_METHOD(void set_name(const std::string& name), soup_cookie_set_name)
+ _WRAP_METHOD(void set_value(const std::string& value), soup_cookie_set_value)
+ _WRAP_METHOD(void set_domain(const std::string& domain), soup_cookie_set_domain)
+ _WRAP_METHOD(void set_path(const std::string& path), soup_cookie_set_path)
+ _WRAP_METHOD(void set_max_age(int max_age), soup_cookie_set_max_age)
+ _WRAP_METHOD(void set_secure(bool secure=true), soup_cookie_set_secure)
+ _WRAP_METHOD(void set_http_only(bool http_only=true), soup_cookie_set_http_only)
+ _WRAP_METHOD(bool applies_to_uri(URI& uri), soup_cookie_applies_to_uri)
+ _WRAP_METHOD(std::string to_cookie_header(), soup_cookie_to_cookie_header)
+ _WRAP_METHOD(std::string to_set_cookie_header(), soup_cookie_to_set_cookie_header)
+};
+
+} // namespace Soup
diff --git a/libsoup/src/filelist.am b/libsoup/src/filelist.am
index ace6e5c..44a5f92 100644
--- a/libsoup/src/filelist.am
+++ b/libsoup/src/filelist.am
@@ -9,5 +9,5 @@ files_defs = \
libsoup_docs.xml \
libsoup_docs_override.xml
-files_hg = address.hg auth.hg enums.hg message.hg message-body.hg server.hg session.hg uri.hg
+files_hg = address.hg auth.hg cookie.hg enums.hg message.hg message-body.hg server.hg session.hg uri.hg
files_ccg = $(files_hg:.hg=.ccg)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]