CLOG-Location implementation

This commit is contained in:
David Botton 2020-12-30 13:40:48 -05:00
parent 6b67bfbcc1
commit 209c224765
3 changed files with 295 additions and 3 deletions

View file

@ -23,3 +23,179 @@
(defun make-clog-location (connection-id)
"Construct a new clog-location. (Private)"
(make-instance 'clog-location :connection-id connection-id :html-id "location"))
;;;;;;;;;
;; url ;;
;;;;;;;;;
(defgeneric url (clog-location)
(:documentation "Get/Setf full url."))
(defmethod url ((obj clog-location))
(property obj "href"))
(defgeneric set-url (clog-location value)
(:documentation "Set url VALUE for CLOG-LOCATION"))
(defmethod set-url ((obj clog-location) value)
(setf (property obj "href") value))
(defsetf url set-url)
;;;;;;;;;;
;; hash ;;
;;;;;;;;;;
(defgeneric hash (clog-location)
(:documentation "Get/Setf url hash."))
(defmethod hash ((obj clog-location))
(property obj "hash"))
(defgeneric set-hash (clog-location value)
(:documentation "Set hash VALUE for CLOG-LOCATION"))
(defmethod set-hash ((obj clog-location) value)
(setf (property obj "hash") value))
(defsetf hash set-hash)
;;;;;;;;;;
;; host ;;
;;;;;;;;;;
(defgeneric host (clog-location)
(:documentation "Get/Setf url host."))
(defmethod host ((obj clog-location))
(property obj "host"))
(defgeneric set-host (clog-location value)
(:documentation "Set host VALUE for CLOG-LOCATION"))
(defmethod set-host ((obj clog-location) value)
(setf (property obj "host") value))
(defsetf host set-host)
;;;;;;;;;;;;;;;
;; host-name ;;
;;;;;;;;;;;;;;;
(defgeneric host-name (clog-location)
(:documentation "Get/Setf url host name."))
(defmethod host-name ((obj clog-location))
(property obj "hostname"))
(defgeneric set-host-name (clog-location value)
(:documentation "Set host-name VALUE for CLOG-LOCATION"))
(defmethod set-host-name ((obj clog-location) value)
(setf (property obj "hostname") value))
(defsetf host-name set-host-name)
;;;;;;;;;;;;
;; origin ;;
;;;;;;;;;;;;
(defgeneric origin (clog-location)
(:documentation "Get url origin."))
(defmethod origin ((obj clog-location))
(property obj "origin"))
;;;;;;;;;;;;;;;
;; path-name ;;
;;;;;;;;;;;;;;;
(defgeneric path-name (clog-location)
(:documentation "Get/Setf url path-name."))
(defmethod path-name ((obj clog-location))
(property obj "pathname"))
(defgeneric set-path-name (clog-location value)
(:documentation "Set path-name VALUE for CLOG-LOCATION"))
(defmethod set-path-name ((obj clog-location) value)
(setf (property obj "pathname") value))
(defsetf path-name set-path-name)
;;;;;;;;;;
;; port ;;
;;;;;;;;;;
(defgeneric port (clog-location)
(:documentation "Get/Setf url port."))
(defmethod port ((obj clog-location))
(property obj "port"))
(defgeneric set-port (clog-location value)
(:documentation "Set port VALUE for CLOG-LOCATION"))
(defmethod set-port ((obj clog-location) value)
(setf (property obj "port") value))
(defsetf port set-port)
;;;;;;;;;;;;;;
;; protocol ;;
;;;;;;;;;;;;;;
(defgeneric protocol (clog-location)
(:documentation "Get/Setf url protocol."))
(defmethod protocol ((obj clog-location))
(property obj "protocol"))
(defgeneric set-protocol (clog-location value)
(:documentation "Set protocol VALUE for CLOG-LOCATION"))
(defmethod set-protocol ((obj clog-location) value)
(setf (property obj "protocol") value))
(defsetf protocol set-protocol)
;;;;;;;;;;;;;;;;
;; url-search ;;
;;;;;;;;;;;;;;;;
(defgeneric url-search (clog-location)
(:documentation "Get/Setf url-search."))
(defmethod url-search ((obj clog-location))
(property obj "search"))
(defgeneric set-url-search (clog-location value)
(:documentation "Set url-search VALUE for CLOG-LOCATION"))
(defmethod set-url-search ((obj clog-location) value)
(setf (property obj "search") value))
(defsetf url-search set-url-search)
;;;;;;;;;;;;
;; reload ;;
;;;;;;;;;;;;
(defgeneric reload (clog-window)
(:documentation "Reload browser window."))
(defmethod reload ((obj clog-window))
(execute obj "reload()"))
;;;;;;;;;;;;;;;;;
;; url-replace ;;
;;;;;;;;;;;;;;;;;
(defgeneric url-replace (clog-window replace-url)
(:documentation "Replace browser url."))
(defmethod url-replace ((obj clog-window) replace-url)
(execute obj (format nil "replace('~A')" replace-url)))
;;;;;;;;;;;;;;;;
;; url-assign ;;
;;;;;;;;;;;;;;;;
(defgeneric url-assign (clog-window assign-url)
(:documentation "Assign browser url."))
(defmethod url-assign ((obj clog-window) assign-url)
(execute obj (format nil "assign('~A')" assign-url)))

View file

@ -188,7 +188,23 @@ application."
(defsection @clog-location (:title "CLOG Location Objects")
"CLOG-Location - CLOG Location Objects"
(clog-location class))
(clog-location class)
"CLOG-Location - Properties"
(url generic-function)
(hash generic-function)
(host generic-function)
(host-name generic-function)
(origin generic-function)
(path-name generic-function)
(port generic-function)
(protocol generic-function)
(url-search generic-function)
"CLOG-Location - Methods"
(reload generic-function)
(url-replace generic-function)
(url-assign generic-function))
(export 'make-markup)
(defun make-markup ()

View file

@ -934,9 +934,9 @@ is nil unbind the event.</p></li>
<p><a id='x-28CLOG-3AURL-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AURL-20GENERIC-FUNCTION-29" >URL</a></span></span> <span class="locative-args">CLOG-DOCUMENT</span></span></p>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AURL-20GENERIC-FUNCTION-29" >URL</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get url.</p></li>
<p>Get/Setf full url.</p></li>
</ul>
<p><a id='x-28CLOG-3AHEAD-ELEMENT-20GENERIC-FUNCTION-29'></a></p>
@ -1025,6 +1025,106 @@ is nil unbind the event.</p></li>
<p><a href="#x-28-22clog-22-20ASDF-2FSYSTEM-3ASYSTEM-29" title="(\&quot;clog\&quot; ASDF/SYSTEM:SYSTEM)"><code>CLOG</code></a> Location Objects encapsulate the location.</p></li>
</ul>
<p>CLOG-Location - Properties</p>
<p><a id='x-28CLOG-3AURL-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AURL-20GENERIC-FUNCTION-29" >URL</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf full url.</p></li>
</ul>
<p><a id='x-28CLOG-3AHASH-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AHASH-20GENERIC-FUNCTION-29" >HASH</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url hash.</p></li>
</ul>
<p><a id='x-28CLOG-3AHOST-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AHOST-20GENERIC-FUNCTION-29" >HOST</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url host.</p></li>
</ul>
<p><a id='x-28CLOG-3AHOST-NAME-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AHOST-NAME-20GENERIC-FUNCTION-29" >HOST-NAME</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url host name.</p></li>
</ul>
<p><a id='x-28CLOG-3AORIGIN-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AORIGIN-20GENERIC-FUNCTION-29" >ORIGIN</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get url origin.</p></li>
</ul>
<p><a id='x-28CLOG-3APATH-NAME-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3APATH-NAME-20GENERIC-FUNCTION-29" >PATH-NAME</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url path-name.</p></li>
</ul>
<p><a id='x-28CLOG-3APORT-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3APORT-20GENERIC-FUNCTION-29" >PORT</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url port.</p></li>
</ul>
<p><a id='x-28CLOG-3APROTOCOL-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3APROTOCOL-20GENERIC-FUNCTION-29" >PROTOCOL</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url protocol.</p></li>
</ul>
<p><a id='x-28CLOG-3AURL-SEARCH-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AURL-SEARCH-20GENERIC-FUNCTION-29" >URL-SEARCH</a></span></span> <span class="locative-args">CLOG-LOCATION</span></span></p>
<p>Get/Setf url-search.</p></li>
</ul>
<p>CLOG-Location - Methods</p>
<p><a id='x-28CLOG-3ARELOAD-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3ARELOAD-20GENERIC-FUNCTION-29" >RELOAD</a></span></span> <span class="locative-args">CLOG-WINDOW</span></span></p>
<p>Reload browser window.</p></li>
</ul>
<p><a id='x-28CLOG-3AURL-REPLACE-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AURL-REPLACE-20GENERIC-FUNCTION-29" >URL-REPLACE</a></span></span> <span class="locative-args">CLOG-WINDOW REPLACE-URL</span></span></p>
<p>Replace browser url.</p></li>
</ul>
<p><a id='x-28CLOG-3AURL-ASSIGN-20GENERIC-FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AURL-ASSIGN-20GENERIC-FUNCTION-29" >URL-ASSIGN</a></span></span> <span class="locative-args">CLOG-WINDOW ASSIGN-URL</span></span></p>
<p>Assign browser url.</p></li>
</ul>
<p><a id='x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29'></a></p>
<p><span class="outer-navigation"><span class="navigation"> <a href="#x-28CLOG-3A-40CLOG-LOCATION-20MGL-PAX-3ASECTION-29" title="CLOG Location Objects">&#8592;</a> <a href="#x-28CLOG-3A-40CLOG-MANUAL-20MGL-PAX-3ASECTION-29" title="The CLOG manual">&#8593;</a> <a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29" title="CLOG Navigator Objects">&#8634;</a></span></span></p>