[gxml/serialization] Fixed build. Squashed commit of the following:
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml/serialization] Fixed build. Squashed commit of the following:
- Date: Thu, 17 Oct 2013 21:49:17 +0000 (UTC)
commit 355e9f67f912b64ca8cc5a36f539dc0bd908b549
Author: Daniel Espinosa <esodan gmail com>
Date: Fri Oct 11 13:05:44 2013 -0500
Fixed build. Squashed commit of the following:
commit 8ff022ba1c3ee041aeae4a6efe3316b940747d49
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Oct 8 16:15:06 2013 -0500
Moved Object Model Serialization to SerializableObjectModel
commit 413cd1e63931196170eddc0a14731fe939659d92
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 30 16:14:43 2013 -0500
Fixes after 'soc2013' branch merge
commit e0651b58ea64ea9357db80007e66d90647257200
Merge: 2a33ba7 69f18f1
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 30 15:05:38 2013 -0500
Merge branch 'gsoc2013' into serialization
Conflicts:
gxml/Node.vala
gxml/NodeList.vala
gxml/Serializable.vala
gxml/Serialization.vala
test/SerializableTest.vala
commit 2a33ba7efc0dabecdf8b0444a99b7760f9f0e9c5
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 30 14:48:29 2013 -0500
Fixed deserialization get Element content
commit 69f18f1980a970347d69e9b3a176524954dcf221
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
examples/c: fix some whitespace
commit a2951fc791e2925978fef6a069fbd164b89ecba2
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
examples/c/document_factory.c: add print out of example nodes we create
commit 0368f57388e8c9e382bdceaef0e6a4e442aea3a6
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
examples/js: rename several examples, add new ones
commit d10d39a9fa5f62428ba37e03873fe3111cc16f0a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
Implementation.vala: extend from GObject
commit 6c192647f1b9bf13fa0b537ff31bdb201cc788e3
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
document_create_minimal_2.c: incrementally expand the test of memory usage, mwahaha
commit 7002159135ce6f2e4baf1a286ffdbd336841fa4f
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
test/valgrind: add message.c to just test the allocations by g_message
commit 35156771a8445bc0b4ecd977b366334676786383
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
test/valgrind/glib.supp: suppress g_log allocations
commit 8e2f0819ead34e9fa3304b56ac73fa4a8c4f1cf2
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
TextTest.vala: INDEX_SIZE exceptions no longer result in null returns
commit 481bcef345e8df6870fc76d96e47f6d7cd9a4a08
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:12 2013 -0400
DocumentTest.vala: invalid characters no longer cause create_element to return null, so don't test
for it
commit faf06ccdb0690880acce58b4393fbc4e2bd89c18
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
Document.vala: don't return null on create_element if invalid characters have been specified; print a
g_warning and proceed instead (libxml2 accepts invalid characters anyway)
commit 2295955d12448ba0b682630822170a5dd5f3c624
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
CharacterData.vala: change behaviour when offset == length of string for bounds checking, since the
end of a string is a fit place to insert things (but perhaps not remove :D)
commit ef9124ef701320d746561a16eed7b1022aef8dce
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
Memory: Document.vala: node creation methods (e.g. create_element) now return unowned/weak references
to the nodes they create; the Document alone owns them
commit ac18ab2c896c87bbba755e51b36c149bc30e104b
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
Memory: Node.vala, BackedNode.vala, Element.vala, NodeList.vala, Attr.vala, Entity.vala,
Document.vala: change ownership of return value to unowned for a bunch of methods (insert_before,
append/remove/replace_child); references will be handled by the Document
commit 74500fe0ef0e41bea2e838b608d8ec8608612c8b
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
Text.vala: address some compile time warnings; fail split more gracefully
commit 175f49ee80f5325166bb59f7b35772ff4a802212
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
Serialization.vala: address some compile-time warnings
commit e29fae13ca81de3ff281057869e92cfc6fffe364
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
test/vaglrind: add a couple new tests, fix the gtype.supp
commit 2c7a6302f28c726dce1fee4a44548ce16ad956f7
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
ProcessingInstruction.vala: docfix for an entity ref
commit 2cf8640716c64d8fc5e74ee541f5dc9142fd591a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
DocumentType.vala: docfix for an entity ref
commit 51972d0dfa203f5e2b2e9208f52309e096d64eb3
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
Document.vala: touch some comments
commit 138e55515dc58658ef084d268d4141824ac7353e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
CDATASection: docfix for an entity reference
commit 77e88aec2ed6df42210353ccac69b947a318a0c2
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
BackedNode.vala: add a TODO about memory usage
commit bca62f6ca49f6454fed1e881eaf64e930c7af29e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
examples/c: add document_factory.c, remove a comment from document_properties.c
commit 489ea5de5c639c737394043a7920bec8b6bf4880
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
examples/c: add Document properties example; rename examples
commit 376e2da6c24c99a164dc831436deeb2dd80d0123
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
tests/valgrind: correct some permissions
commit e7ada06aec296f6e5543dc29b247ff388a9a77a5
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
tests/valgrind: add memory testing files, like suppression files, and .c and .vala tests
commit 42342ebd86322eedace4a847888ecf2369f6436f
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
examples/vala/example.vala: remove obsolete GError handling
commit d446425cb88b796f309a965ce1d6ab034780eca1
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
examples/js: refactor examples into their own files
commit 2e71e81a62b20f0951804d3cadbfdde0362bebcf
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
examples/c: actually add .c files this time
commit 0042e1d748e04bde69ed6a5adb0db4351bcd4e1c
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:11 2013 -0400
examples/c/Makefile: update
commit acabee7d409a7ba866ba55a7b244326153f5cdcb
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
examples/c: refactor tests, remove GErrors, correct naming
commit e4dc48ddefafc06e5b195a9cc95be39ce00a88bc
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
Some documentation fixes
commit 0c4810362363f8e0b9cb02e7189ed3031f8bee56
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
test/*.vala: change DomNode to GXml.Node
commit b69d2a4b641036635ab8e9f4eac49ae8ea9b5b5e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
gxml/*.vala: Change all DomNode references to Node
commit fafab2754ce79ef3e03704a58585eaa5f9b98818
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
Node.vala: Renamed DomNode to Node; this should break all the other files :D
commit 6e2b4a87e1e89a52dafa4f3883f628a110af0430
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
Node.vala, Makefile.am: rename DomNode.vala to Node.vala for impending change
commit d484ef0d1690ab7feca6dc39e26dd1b70edcdf1d
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:55 2013 -0400
DocumentTest.vala: first testing of warnings
commit 38dafa3af26db5b7001695fa3ef5e53027cdaed9
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:55 2013 -0400
GXmlTest.vala: change how our tests test for warnings
commit e2a67bc4322b9a6eaaa6367a4305c8cb4aae281f
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:55 2013 -0400
Implementation.vala: factor out error checks into check_ functions
commit 454507ecbebc2d9194c127cc5a31aa93d79e3cca
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:55 2013 -0400
CharacterData.vala, Element.vala, Document.vala, DomNode.vala, NodeList.vala: use new GXml.warning
facility, so we can preserve the last error code
commit f38da2f0985ed9592114fc9ef6d589ab28dda119
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:55 2013 -0400
DomException.vala: add NAMESPACE error code
commit 04027b595fff508885fc9f9760d45f281765b24a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
DomException.vala: add facility to set the last DomException set; ooo, classic error codes
commit d4a2c38df16f7dde9e5ecc2c12eec70b84d220b3
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Makefile.am: remove -Wall for now, since we can't do anything about most errors, due to vala :'(
commit f2dcc043c729ba7976515e3b6334852d8b7c0bbb
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
DomException.vala: add a dummy DomError for the transitioning of the tests
commit d472f9dcca1971ba2c980a48d9f42d2e5ef01524
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
DomException.vala: change errordomain DomError -> enum DomException
commit f4e861c02188b3575c92ee4a41de34117deb9b78
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
GXmlTest.vala: override gtester handling of g_warnings; don't want to abort, but verify
commit a0ee0fbd17e3216124d6ee2825f8ef1ed130a994
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Serialization.vala: DomError no longer thrown, so no need to catch it
commit a8d71501ffba7e67c431dd6037084f68b54ba2cb
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Makefile.am: DomError -> DomException
commit eb3414791f8af1996ca05f6f61117ca089df79bf
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
DomException.vala: rename file to comply with spec, improve docs, whitespace
commit f840d4543e0761612b0ce8629aa5fb4e41dcd156
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Document.vala: some small error handling changes; return on invalid chars for create_element
commit f63fdeb3d912ba7b9f93bc1606846c16116836c9
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Tiny fixes.
DomNode.vala: make check_wrong_document and check_read_only protected so only subclasses can see them
Element.vala: fix remove_attribute_node
ProcessingInstruction: properly get and set 'data'
commit 841f354844e7097d738411cb74bd3f20b16fe506
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Text.vala: add more error checking from spec
commit 03105730eb91aae9809fb68afa9e3349e51cbbae
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Text.vala: update documentation, specifically adding refs to spec
commit 5ed7290cca45ae6ee116c102b3e492622c44304f
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
ProcessingInstruction.vala: handle spec'd errors
commit 2469c75a6bc296e82b0b8bc9e5f03b09531a897d
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Element.vala: handle spec'd errors
commit 9dc92434aa90a33ebc7ac5ed6e8f88ba8ddb80d7
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Document.vala, DomNode.vala: move check_wrong_document inot DomNode so other nodes (Element) can use
it
commit d2849156e166740162f30a5c6682c286a0019192
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Element.vala: update documentation, specifically references to spec
commit f98463a2cc8acb5de2cb2d8d9bb177d51609ca67
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Attr.vala: update documentation, specifically references to spec
commit 2ea11338a60474900b6a7bd751ea7b3744c2d4d0
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Document.vala, DomNode.vala: move check_read_only to DomNode, so all its descendents can call it
commit 25e97099d8c0d20e8bd0e74583aacea28be7cfdb
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Text.vala: make use of new check_index_size from parent class CharacterData
commit 56d75a5800f4c8f4c4c99b25f750c95138ce7214
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
CharacterData.vala: improve error handling, check more bounds, factor out bound checking
commit 44be6d2463dbb2f232c6441e38d5a257adcbe324
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
CharacterData.vala: update comments, particularly adding references to spec
commit 39fff91947a3fce8eabc1175c71e0310e9e5d8b5
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
NodeList.vala: improve documentation, particularly adding references to spec
commit 9c3d5e4e7c0023b7a5f49547564ff535a2fe37a5
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
DomNode.vala: remove some trailing whitespace
commit 42197739fb57e8d17d52b1c1b0b5a0745b75b143
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Entity.vala: break API to fix typo: clone_node, not clone_nodes, part 2
commit 7e1645d8fe3dfc2e7dbf2abb15b6932693160649
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
DomNode.vala: update documentation, particularly adding references to the spec
commit eafb5b7ddb0920fe54e17531f7c064ca0afa780e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
DomNode.vala, BackedNode.vala, Attr.vala: break API to fix typo: clone_node, not clone_nodes
commit 982f2cb56186be8962f9e865d53558a39a0a19cf
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
DomNode.vala: update comments, especially adding references to spec
commit b218f53cacb8bc7975b92fefe5ea960cd5471199
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
DocumentFragment.vala: add spec reference
commit 31c2c2e43a2f98f0f57c32e11209f202d0a38171
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Document.vala: Fix a comment
commit 2a97a2b9d4f7096246c453fe0224995c7ad69b7b
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Document.vala: add root element for Document.with_implementation
commit c647f8ad808a91b590800f8a22f5462b6e273e73
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Document.vala: update error checking to use g_warning; add more error checks from spec
commit bc26048f973c337c8461a12a73dc4f93405bee3a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Document.vala: Update comments, particularly with references to spec
commit 36c3a9515312a4b451d7991038b32de58aebc5c1
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Implementation.vala: add commented out code to use xmlHasFeature in the future
commit 48c4ec65b0ad9fc62f489490c6a366ba08f6e12e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Implementation.vala: add error checking to create_document
commit 096c166cb0d61e604dbe1a44686f142fcee19c64
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Implementation.vala: Update comments with references to spec
commit eb1cb9102181fe06c1c3a9b0cbd79c9640cea678
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
Makefile.am: get rid of -Wall for now; reports a lot of warnings we can do nothing about using vala
right now
commit dc663b94cfd2c933b22466a05e659fbc5af47b15
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:53 2013 -0400
DocumentType.vala: update comments
commit 58b0db8026e5651d3993f67e3a74924ae7086c52
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:52 2013 -0400
NodeList.vala: change error handling to g_warning
commit 2b7167238b9296256590c61e6722b3e95db8c333
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:30 2013 -0400
libxml-2.0.vapi: define a few more methods from the C: validate_name, validate_qname, and (commented
out) has_feature (for later)
commit 1bfe1afc3952f047fead56ce1712c8d6e74201c1
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:30 2013 -0400
libxml-2.0.vapi: fix the ctype for dump_memory_format's mem param
commit 93c22c243025339dc490b239cb7c7db22293958a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:30 2013 -0400
Revert to before the Utils fiasco
commit bc775bc4b94b6707e27fabb231a5274f8ef75890
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:30 2013 -0400
whatever
commit d844ec522f7c87d9a9fc20145ace6d3bab4ef106
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:30 2013 -0400
Revert "Revert "bleh""
This reverts commit c907fbb01b7a826afa3e7ff30d60e628f7cb185f.
commit 344b71e8ece446b5b8ed57895bd69b57a9fd64b2
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:30 2013 -0400
Revert "bleh"
This reverts commit 671a8dc2ac7c81bb5a63086c99ab5a4262734dc1.
commit 0001fcb98abeea618f269d67cfb61f24b09c86ff
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
bleh
commit ec99a84163ac68347b0cf8295b93a302eeeb896e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
test/Makefile.am: add UtilsTest.vala UtilsTest.vala: add a basic test; need more
commit aad45f48f1efb86d3568459c3fedc3a0a9577a4a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Utils.vala: fix some errors, add Utils.vala to Makefile.am
commit ee3f0464f8f4cd44a3387880704d07a704296225
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Utils.vala: add class of static internal methods to handle tasks like XML Name validation.
commit 9c73918f34327248c82126af660904be84f5ea71
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Implementation.vala, Document.vala: support creation of documents from Implementation
commit 485dd65079da3bd20862033d14a0988e910f92be
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Document.vala: convert more entity references to their actual characters
commit 7eb9fb8d93c72bdcda6fee474cd0af181bb7cbc0
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
NodeList.vala: fix comment so there's a separate long desc
commit 7bae7e339522166b69ac7f2aaf787c0266167d2a
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Document.vala: update some comments and spacing
commit 2958bf6ba3d65c5a574e6c9d42b08df48fa90f15
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Fix < in docs; I swear that I had to use the entity reference before
commit 09d96c495ad18da51daa450a7843a7675b6b657d
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:29 2013 -0400
Remove unnecessary linking for valadoc command
commit 5cd50780e70ba7ec13226edfb8f9c3a146e3b97f
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Change some errors in CharacterData and Text to use g_warning instead of GError
commit 0e9f943da51e96650fa4b8443e94f2a5dc8efdad
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Remove all throws declarations, since we're shifting to a document-level error variable
commit f6259d42437b29431a57681f7e4977f6116858b7
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Change error handling from throwing errors to setting a document-level error variable
commit 1753318277bea690145b826bc05653c9f40ae895
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Add some TODO items for the future
commit ff872c1f218407d1875385918f040d2c794f950d
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Update libvala version; need a better solution to this
commit e79195ad140bcfd7e8d473a0a4cd216822a588bd
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Fix some cnames in libxml-2.0.vapi
commit 1e2973b930984762bb1488cc82b98fb49e51a9bb
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Set type=xmlChar* on method return values
commit 0214abf0ec951d3c06c1b004a401725fee9e488d
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Set type=xmlChar* on fields
commit 7c243912cb9c1c9d42fd639b0d7e5799bcf04324
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Set type=xmlChar* on parametres, part 2: those with string return types and other nearby changes
commit 582a65a1020cbdc2743ab4e117735f6a02db886b
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:00:18 2013 -0400
Set type=xmlChar* on parametres, part 1
commit c3762b2f133746a445cdc7913049ed5d06805c4d
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Jul 25 21:02:33 2013 -0500
Fixed (again) deserialize objects with objects as properties
commit 9da1ce02046de4c0086a8fc66bf902fc4aaed02e
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Jul 25 18:30:29 2013 -0500
mplemented serialize non-automatic serializable properties
* Implementors must attach a handler to serialize_unknown_property
event in order to serialize any property type non handled
automatically like GLib.Array, GLib.HashTable or others
* Added serialized_node_name property to allow implementator to
override default node name; default is GObject Type's name
* Removed warning messsages
commit c8430c044b7510f0f7f0c15b8353eea5a69802b9
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Jul 24 12:36:49 2013 -0500
Bugs and warnning messages fixes.
* Not used Serializable.serialized_xml_node removed
* Serializable.deserealize fixed return value
* Fixed a bug adding content to top level Element
* Removed warnnings
* Added SerializableError error domain
commit 4f66b9d4356265852d2674b133e72e0b0b225bfd
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 23 22:22:57 2013 -0500
Added UML diagram documentation
commit 978589655a362c9ef270415119ff765f08823ea7
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 23 18:44:42 2013 -0500
SerializableObjectModel: removed value property
commit f1ace6c4a21d46907932d875a647a5f6d8cd0121
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 23 18:04:48 2013 -0500
Fixed serialization and Element.content property
commit 16da349fc9e803c7f8434d8c7b7bff2e7ab0d69a
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 23 17:24:07 2013 -0500
Fixes on SerializableTest
commit 1f11a5b6cf74dad097346fa2ca03db55983dc88a
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 23 16:24:22 2013 -0500
Fixing Serializable.serialize() and deserialize() on conplex Element nodes
commit 6ff61bc4284342842339c2411394053c2ed6c28a
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 23 00:07:22 2013 -0500
Fixes to Serializable.deserialize()
* Moved string_to_gvalue to Serializable interface
* Serializable.serialize_property() deprecates use of ParamSpec
commit d37d5ec6c9301490cef18e687995ac6833d5fdcb
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Jul 22 21:51:04 2013 -0500
Implemented Serializable.deserialize()
* Added test case for serialize()
* Added SerializableObjectModel class to help Serializable implementators
commit 82fbfc1d5e99d3c9eda1ea533683d11916c7ec62
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Jul 22 17:28:27 2013 -0500
Serializable now use nick for properties name. Fiexed segfault.
* serialized_property_use_blurb renamed to serialized_property_use_nick
* serialized_xml_node_value default to null
commit 13ddd94dec7994bf5839723334fc9f3578e39eca
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Jul 22 16:33:12 2013 -0500
Fixing recursive XmlObjectModel serialization on Serializable properties
commit 349673ea440f3cfdaeca5c27279171ced27b3e99
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Jul 22 12:32:35 2013 -0500
Initial setup of XmlObjectModel to Serializable interface
gxml/Serializable.vala | 9 +-
gxml/SerializableJson.vala | 72 ++++---
gxml/SerializableObjectModel.vala | 7 +-
gxml/Serialization.vala | 403 +++++++++++--------------------------
test/SerializableTest.vala | 15 +-
test/SerializationTest.vala | 13 +-
6 files changed, 178 insertions(+), 341 deletions(-)
---
diff --git a/gxml/Serializable.vala b/gxml/Serializable.vala
index b21a2f9..3248f87 100644
--- a/gxml/Serializable.vala
+++ b/gxml/Serializable.vala
@@ -108,7 +108,7 @@ namespace GXml {
*
* @doc an { link GXml.Document} object to serialise to
*/
- public abstract Node? serialize (Node node);
+ public abstract Node? serialize (Node node) throws Error;
/**
* Handles serializing individual properties.
@@ -133,7 +133,8 @@ namespace GXml {
* @return a new { link GXml.Node}, or `null`
*/
public abstract GXml.Node? serialize_property (Element element,
- GLib.ParamSpec prop);
+ GLib.ParamSpec prop)
+ throws Error;
/**
* Deserialize this object.
@@ -141,7 +142,7 @@ namespace GXml {
* @node { link GXml.Node} used to deserialize from.
*/
public abstract Node? deserialize (Node node)
- throws SerializableError;
+ throws Error;
/**
* Handles deserializing individual properties.
*
@@ -161,7 +162,7 @@ namespace GXml {
* @return `true` if the property was handled, `false` if { link GXml.Serialization} should
handle it.
*/
public abstract bool deserialize_property (GXml.Node property_node)
- throws SerializableError;
+ throws Error;
/**
* Signal to serialize unknown properties.
diff --git a/gxml/SerializableJson.vala b/gxml/SerializableJson.vala
index a207650..045678d 100644
--- a/gxml/SerializableJson.vala
+++ b/gxml/SerializableJson.vala
@@ -32,7 +32,7 @@
* serialization themselves, including non-public properties or
* data types not automatically supported by { link GXml.Serialization}.
*/
-public class GXml.SerializableJason : GLib.Object, Serializable
+public class GXml.SerializableJson : GLib.Object, Serializable
{
/* Serializable Interface properties */
public string serializable_node_name { get; protected set; }
@@ -50,7 +50,7 @@ public class GXml.SerializableJason : GLib.Object, Serializable
* Is up to you to add convenient Element node to a Document, in order to be
* used by serialize and add new <Object> tags per object to serialize.
*/
- public Node? serialize (Node node)
+ public Node? serialize (Node node) throws Error
{
Document doc;
Element root;
@@ -66,46 +66,54 @@ public class GXml.SerializableJason : GLib.Object, Serializable
root = doc.create_element ("Object");
doc.append_child (root);
- root.set_attribute ("otype", object.get_type ().name ());
+ root.set_attribute ("otype", this.get_type ().name ());
root.set_attribute ("oid", oid);
- prop_specs = serializable.list_properties ();
+ prop_specs = list_serializable_properties ();
foreach (ParamSpec prop_spec in prop_specs) {
prop = doc.create_element ("Property");
prop.set_attribute ("ptype", prop_spec.value_type.name ());
prop.set_attribute ("pname", prop_spec.name);
- value_prop = serialize_property (prop, prop_spe);
+ value_prop = serialize_property (prop, prop_spec);
prop.append_child (value_prop);
root.append_child (prop);
}
return root;
}
- public GXml.Node? serialize_property (Element element,
- GLib.ParamSpec prop)
+ public GXml.Node? serialize_property (Element element,
+ GLib.ParamSpec prop)
+ throws Error
{
Type type;
Value value;
Node value_node = null;
-
+ Element prop_node;
+
type = prop.value_type;
- if (type.is_a (typeof (Serializable)))
- return (Serializable).serialize ();
+ if (type.is_a (typeof (Serializable))) {
+ value = Value (type);
+ this.get_property (prop.name, ref value);
+ return ((Serializable)value.get_object ()).serialize (element);
+ }
var doc = element.owner_document;
+ prop_node = doc.create_element ("Property");
+ prop_node.set_attribute ("ptype", prop.value_type.name ());
+ prop_node.set_attribute ("pname", prop.name);
if (type.is_enum ())
{
value = Value (typeof (int));
- this.get_property (prop_spec.name, ref value);
+ this.get_property (prop.name, ref value);
value_node = doc.create_text_node ("%d".printf (value.get_int ()));
}
else if (Value.type_transformable (type, typeof (string)))
{ // e.g. int, double, string, bool
value = Value (typeof (string));
- this.get_property (prop_spec.name, ref value);
+ this.get_property (prop.name, ref value);
value_node = doc.create_text_node (value.get_string ());
}
else if (type == typeof (GLib.Type)) {
@@ -125,22 +133,18 @@ public class GXml.SerializableJason : GLib.Object, Serializable
value_node = doc.copy_node (value_doc.document_element);
}
else if (type.name () == "gpointer") {
- GLib.warning ("DEBUG: skipping gpointer with name '%s' of object '%s'",
prop_spec.name, object.get_type ().name ());
+ GLib.warning ("DEBUG: skipping gpointer with name '%s' of object '%s'", prop.name,
this.get_type ().name ());
value_node = doc.create_text_node (prop.name);
} else {
- throw new SerializationError.UNSUPPORTED_TYPE ("Can't currently serialize type '%s'
for property '%s' of object '%s'", type.name (), prop.name, object.get_type ().name ());
+ throw new SerializationError.UNSUPPORTED_TYPE ("Can't currently serialize type '%s'
for property '%s' of object '%s'", type.name (), prop.name, this.get_type ().name ());
}
return value_node;
}
- public Node? deserialize (Node node) throws SerializableError
+ public Node? deserialize (Node node) throws Error
{
- bool ret = true;
Element obj_elem;
- string otype;
- string oid;
- Type type;
ParamSpec[] specs;
if (node is Document) {
@@ -158,39 +162,43 @@ public class GXml.SerializableJason : GLib.Object, Serializable
return obj_elem;
}
- public bool deserialize_property (GXml.Node property_node) throws SerializableError
+ public bool deserialize_property (GXml.Node property_node) throws Error
{
- if (properly_node.node_name == "Property")
+ if (property_node.node_name == "Property")
{
Element prop_elem;
string pname;
+ string otype;
+ Type type;
Value val;
+ ParamSpec spec;
//string ptype;
- prop_elem = (Element)child_node;
+ prop_elem = (Element)property_node;
pname = prop_elem.get_attribute ("pname");
+ otype = prop_elem.get_attribute ("otype");
+ type = Type.from_name (otype);
//ptype = prop_elem.get_attribute ("ptype"); // optional
// Check name and type for property
spec = this.find_property_spec (pname);
if (spec == null) {
- GLib.message ("Deserializing object of type '%s' claimed unknown property
named '%s'\nXML [%s]", otype, pname, obj_elem.to_string ());
+ GLib.message ("Deserializing object of type '%s' claimed unknown property
named '%s'\nXML [%s]", otype, pname, property_node.to_string ());
unknown_serializable_property.set (property_node.node_name, property_node);
- continue;
}
else {
- if (spec.value_type ().is_a (typeof(Serializable)))
+ if (spec.value_type.is_a (typeof(Serializable)))
{
- Value vobj;
- this.get_property (pname, out vobj);
- ((Serializable) vobj).deserialize (child_node);
+ Value vobj = Value (spec.value_type);
+ this.get_property (pname, ref vobj);
+ ((Serializable) vobj).deserialize (property_node);
}
else {
val = Value (type);
if (GLib.Value.type_transformable (type, typeof (string))) {
Serializable.string_to_gvalue (prop_elem.content, ref val);
- this.set_property_value (pname, val);
+ this.set_property_value (spec, val);
}
else if (type.is_a (typeof (GLib.Object)))
{
@@ -203,11 +211,13 @@ public class GXml.SerializableJason : GLib.Object, Serializable
val.set_object (property_object);
}
else {
- deserialize_unknown_property_type.set (prop_elem, spec);
- ret = false;
+ deserialize_unknown_property_type (prop_elem, spec);
+ return false;
}
}
}
+ return true;
}
+ return false;
}
}
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index b554154..c5ef31a 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -36,7 +36,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
serializable_node_name = get_type().name().down();
}
- public Node? serialize (Node node)
+ public Node? serialize (Node node) throws Error
{
Document doc;
if (node is Document)
@@ -59,6 +59,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
public GXml.Node? serialize_property (Element element,
GLib.ParamSpec prop)
+ throws Error
{
if (prop.value_type.is_a (typeof (Serializable)))
{
@@ -92,7 +93,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
}
public virtual Node? deserialize (Node node)
- throws SerializableError
+ throws Error
{
Document doc;
if (node is Document) {
@@ -127,7 +128,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
}
public virtual bool deserialize_property (GXml.Node property_node)
- throws SerializableError
+ throws Error
{
bool ret = false;
var prop = find_property_spec (property_node.node_name);
diff --git a/gxml/Serialization.vala b/gxml/Serialization.vala
index e166a03..e7f1234 100644
--- a/gxml/Serialization.vala
+++ b/gxml/Serialization.vala
@@ -56,9 +56,17 @@ namespace GXml {
*/
UNKNOWN_PROPERTY,
/**
- * An object with a known { link GLib.Type} that we do not support was encountered.
+ * Serialization/Deserialization is unsupported for given object type
*/
- UNSUPPORTED_TYPE
+ UNSUPPORTED_OBJECT_TYPE,
+ /**
+ * Serialization/Deserialization is unsupported for given property type
+ */
+ UNSUPPORTED_PROPERTY_TYPE,
+ /**
+ * Serialization/Deserialization is unsupported for given { link GLib.Type}
+ */
+ UNSUPPORTED_TYPE,
}
/**
@@ -87,7 +95,11 @@ namespace GXml {
* { link GLib.Value} can transform into a string, and
* operates recursively.
*/
- private static GXml.Node serialize_property (GLib.Object object, ParamSpec prop_spec,
GXml.Document doc) throws SerializationError {
+ private static GXml.Node serialize_property (GLib.Object object,
+ ParamSpec prop_spec,
+ GXml.Document doc)
+ throws Error
+ {
Type type;
Value value;
Node value_node;
@@ -112,21 +124,13 @@ namespace GXml {
it truly is the latter, but is returned as the
former by list_properties) */
value = Value (typeof (int));
- if (serializable != null) {
- serializable.get_property (prop_spec, ref value);
- } else {
- object.get_property (prop_spec.name, ref value);
- }
+ object.get_property (prop_spec.name, ref value);
value_node = doc.create_text_node ("%d".printf (value.get_int ()));
/* TODO: in the future, perhaps figure out GEnumClass
and save it as the human readable enum value :D */
} else if (Value.type_transformable (prop_spec.value_type, typeof (string))) { //
e.g. int, double, string, bool
value = Value (typeof (string));
- if (serializable != null) {
- serializable.get_property (prop_spec, ref value);
- } else {
- object.get_property (prop_spec.name, ref value);
- }
+ object.get_property (prop_spec.name, ref value);
value_node = doc.create_text_node (value.get_string ());
} else if (type == typeof (GLib.Type)) {
value_node = doc.create_text_node (type.name ());
@@ -152,30 +156,27 @@ namespace GXml {
0x7ffff7b7d67c "dup func", qdata = 0x0, ref_count = 4, param_id = 2}
*/
} else if (type.is_a (typeof (GLib.Object))
- && ! type.is_a (typeof (Gee.Collection))) {
- GLib.Object child_object;
-
- // TODO: this is going to get complicated
- value = Value (typeof (GLib.Object));
- if (serializable != null) {
- serializable.get_property (prop_spec, ref value);
- } else {
+ && ! type.is_a (typeof (Gee.Collection)))
+ {
+ GLib.Object child_object;
+
+ // TODO: this is going to get complicated
+ value = Value (typeof (GLib.Object));
object.get_property (prop_spec.name, ref value);
/* This can fail; consider case of Gee.TreeSet that isn't special
cased above, gets error
-
(/home/richard/mine/development/gnome/gdom/gxml/test/.libs/gxml_test:10996):
- GLib-GObject-CRITICAL **: Read-only property 'read-only-view' on
class 'GeeReadOnlyBidirSortedSet' has type
- 'GeeSortedSet' which is not equal to or more restrictive than the
type 'GeeBidirSortedSet' of the property
- on the interface 'GeeBidirSortedSet' */
- }
- child_object = value.get_object ();
- Document value_doc = Serialization.serialize_object (child_object); // catch
serialisation errors?
-
- value_node = doc.copy_node (value_doc.document_element);
+
(/home/richard/mine/development/gnome/gdom/gxml/test/.libs/gxml_test:10996):
+ GLib-GObject-CRITICAL **: Read-only property
'read-only-view' on class 'GeeReadOnlyBidirSortedSet' has type
+ 'GeeSortedSet' which is not equal to or more restrictive
than the type 'GeeBidirSortedSet' of the property
+ on the interface 'GeeBidirSortedSet' */
+ child_object = value.get_object ();
+ Document value_doc = Serialization.serialize_object (child_object);
// catch serialisation errors?
+
+ value_node = doc.copy_node (value_doc.document_element);
} else if (type.name () == "gpointer") {
GLib.warning ("DEBUG: skipping gpointer with name '%s' of object '%s'",
prop_spec.name, object.get_type ().name ());
value_node = doc.create_text_node (prop_spec.name);
} else {
- throw new SerializationError.UNSUPPORTED_TYPE ("Can't currently serialize
type '%s' for property '%s' of object '%s'", type.name (), prop_spec.name, object.get_type ().name ());
+ throw new SerializationError.UNSUPPORTED_PROPERTY_TYPE ("Can't currently
serialize type '%s' for property '%s' of object '%s'", type.name (), prop_spec.name, object.get_type ().name
());
}
return value_node;
@@ -205,82 +206,64 @@ namespace GXml {
* @param object A { link GLib.Object} to serialize
* @return a { link GXml.Document} representing the serialized `object`
*/
- public static GXml.Document serialize_object (GLib.Object object) throws SerializationError {
+ public static GXml.Document serialize_object (GLib.Object object) throws Error
+ {
Document doc;
Element root;
ParamSpec[] prop_specs;
Element prop;
- Serializable serializable = null;
Node value_prop = null;
string oid;
+ Serialization.init_caches ();
+ /* Create an XML Document to return the object
+ in. TODO: consider just returning an
+ <Object> node; but then we'd probably want
+ a separate document for it to already be a
+ part of as its owner_document. */
+ doc = new Document ();
// If the object has been serialized before, let's not do it again!
oid = "%p".printf (object);
- Serialization.init_caches ();
-
- try {
- /* Create an XML Document to return the object
- in. TODO: consider just returning an
- <Object> node; but then we'd probably want
- a separate document for it to already be a
- part of as its owner_document. */
- doc = new Document ();
-
- // first, check if its been serialised already, and if so, just return an
ObjectRef element for it.
- if (oid != "" && Serialization.serialize_cache.contains (oid)) {
- // GLib.message ("cache hit on oid %s", oid);
- root = doc.create_element ("ObjectRef");
- doc.append_child (root);
- root.set_attribute ("otype", object.get_type ().name ());
- root.set_attribute ("oid", oid);
- return doc;
- }
-
- if (object.get_type ().is_a (typeof (Serializable))) {
- serializable = (Serializable)object;
- }
-
- root = doc.create_element ("Object");
+ // first, check if its been serialised already, and if so, just return an ObjectRef
element for it.
+ if (oid != "" && Serialization.serialize_cache.contains (oid)) {
+ // GLib.message ("cache hit on oid %s", oid);
+ root = doc.create_element ("ObjectRef");
doc.append_child (root);
root.set_attribute ("otype", object.get_type ().name ());
root.set_attribute ("oid", oid);
+ return doc;
+ }
- // Cache this before we start exploring properties in case there's a cycle
- Serialization.serialize_cache.set (oid, root);
-
- /* TODO: make sure we don't use an out param for our returned list
- size in our interface's list_properties (), using
- [CCode (array_length_type = "guint")] */
- if (serializable != null) {
- prop_specs = serializable.list_properties ();
- } else {
- prop_specs = object.get_class ().list_properties ();
- }
-
- /* Exam the properties of the object and store
- them with their name, type and value in XML
- Elements. Use GValue to convert them to
- strings. (Too bad deserialising isn't that
- easy w.r.t. string conversion.) */
- foreach (ParamSpec prop_spec in prop_specs) {
- prop = doc.create_element ("Property");
- prop.set_attribute ("ptype", prop_spec.value_type.name ());
- prop.set_attribute ("pname", prop_spec.name);
-
- value_prop = null;
- if (serializable != null) {
- value_prop = serializable.serialize_property (prop_spec.name,
prop_spec, doc);
- }
- if (value_prop == null) {
- value_prop = Serialization.serialize_property (object,
prop_spec, doc);
- }
-
- prop.append_child (value_prop);
- root.append_child (prop);
- }
- } catch (GLib.Error e) {
- GLib.error ("%s", e.message);
- // TODO: handle this better
+ if (object is Serializable) {
+ ((Serializable) object).serialize (doc);
+ Serialization.serialize_cache.set (oid, doc.document_element);
+ return doc;
+ }
+ // For now and on assume is not a Serializable object
+ root = doc.create_element ("Object");
+ doc.append_child (root);
+ root.set_attribute ("otype", object.get_type ().name ());
+ root.set_attribute ("oid", oid);
+ // Cache this before we start exploring properties in case there's a cycle
+ Serialization.serialize_cache.set (oid, root);
+
+ /* TODO: make sure we don't use an out param for our returned list
+ size in our interface's list_properties (), using
+ [CCode (array_length_type = "guint")] */
+ prop_specs = object.get_class ().list_properties ();
+
+ /* Exam the properties of the object and store
+ them with their name, type and value in XML
+ Elements. Use GValue to convert them to
+ strings. (Too bad deserialising isn't that
+ easy w.r.t. string conversion.) */
+ foreach (ParamSpec prop_spec in prop_specs) {
+ prop = doc.create_element ("Property");
+ prop.set_attribute ("ptype", prop_spec.value_type.name ());
+ prop.set_attribute ("pname", prop_spec.name);
+ value_prop = Serialization.serialize_property (object, prop_spec, doc);
+ prop.append_child (value_prop);
+ root.append_child (prop);
}
/* Debug output */
@@ -298,63 +281,40 @@ namespace GXml {
* strings back to other types, we use our own function to do
* that.
*/
- private static void deserialize_property (ParamSpec spec, Element prop_elem, out Value val)
throws SerializationError {
+ private static void deserialize_property (ParamSpec spec, Element prop_elem,
+ out Value val)
+ throws Error
+ {
Type type;
-
type = spec.value_type;
-
- // if (false || ptype != "") {
- // // TODO: undisable if we support fields at some point
- // type = Type.from_name (ptype);
- // if (type == 0) {
- // /* This probably shouldn't happen while we're using
- // ParamSpecs but if we support non-property fields
- // later, it might be necessary again :D */
- // throw new SerializationError.UNKNOWN_TYPE ("Deserializing object '%s'
has property '%s' with unknown type '%s'", otype, pname, ptype);
- // }
- // }
-
// Get value and save this all as a parameter
bool transformed = false;
val = Value (type);
if (GLib.Value.type_transformable (type, typeof (string))) {
- try {
- string_to_gvalue (prop_elem.content, ref val);
- transformed = true;
- } catch (SerializationError e) {
- throw new SerializationError.UNSUPPORTED_TYPE ("string_to_gvalue
should transform it but failed");
- }
- // } else if (type.is_a (typeof (Gee.Collection))) {
+ Serializable.string_to_gvalue (prop_elem.content, ref val);
} else if (type.is_a (typeof (GLib.Object))) {
GXml.Node prop_elem_child;
Object property_object;
-
prop_elem_child = prop_elem.first_child;
-
- try {
- property_object = Serialization.deserialize_object_from_node
(prop_elem_child);
- val.set_object (property_object);
- transformed = true;
- } catch (GXml.SerializationError e) {
- // We don't want this one caught by deserialize_object, or we'd have
a cascading error message. Hmm, not so bad if it does, though.
- e.message += "\nXML [%s]".printf (prop_elem.to_string ());
- throw e;
- }
- }
-
- if (transformed == false) {
- throw new SerializationError.UNSUPPORTED_TYPE ("Failed to transform property
from string to type.");
+ property_object = Serialization.deserialize_object_from_node
(prop_elem_child);
+ val.set_object (property_object);
}
}
- /*
+ /**
+ * FIXME: DON'T USE CACHE. SERIALIZE OVER NEW OBJECTS OR OVERWRITE PROPERTIES.
+ * When serialize a set of objects, you can add Node Elements <Object>
+ * as many as objects you have serialized to the XML Document. On
+ * deserialization, you must create a new GObject, on the fly, for each
+ * <Object> tag found in the file.
+ *
* This table is used while deserializing objects to avoid
* creating duplicate objects when we encounter multiple
* references to a single serialized object.
*
* TODO: one problem, if you deserialize two XML structures,
* some differing objects might have the same OID :( Need to
- * find make it more unique than just the memory address. */
+ * find make it more unique than just the memory address. SEE ABOVE!!!!*/
private static HashTable<string,Object> deserialize_cache = null;
private static HashTable<string,GXml.Node> serialize_cache = null;
// public so that tests can call it
@@ -388,10 +348,21 @@ namespace GXml {
* @param node { link GXml.Node} representing a { link GLib.Object}
* @return the deserialized { link GLib.Object}
*/
- public static GLib.Object deserialize_object (GXml.Document doc) throws SerializationError {
+ public static GLib.Object deserialize_object (GXml.Document doc) throws Error
+ {
+ // FIXME: Use some heuristics to find the kind of serialization used
+ // or ADD A PARAMETER to define the method to use.
+ // This command use just GObject and JSON methods. No Serializable
+ // implementators are used.
return deserialize_object_from_node (doc.document_element);
}
- internal static GLib.Object deserialize_object_from_node (GXml.Node obj_node) throws
SerializationError {
+ /**
+ * This function must assume deserialize over non-Serializable objects
+ * because Serializable have its own method serialize/deserialize
+ */
+ internal static GLib.Object? deserialize_object_from_node (GXml.Node obj_node)
+ throws Error
+ {
Element obj_elem;
string otype;
string oid;
@@ -399,10 +370,10 @@ namespace GXml {
Object obj;
unowned ObjectClass obj_class;
ParamSpec[] specs;
- Serializable serializable = null;
obj_elem = (Element)obj_node;
+ // FIXME: Remove cache.
// If the object has been deserialised before, get it from cache
oid = obj_elem.get_attribute ("oid");
Serialization.init_caches ();
@@ -415,7 +386,7 @@ namespace GXml {
otype = obj_elem.get_attribute ("otype");
type = Type.from_name (otype);
if (type == 0) {
- throw new SerializationError.UNKNOWN_TYPE ("Deserializing object claims
unknown type '%s'", otype);
+ throw new SerializationError.UNKNOWN_TYPE ("Deserializing unknown GType '%s'
objects is unsupported", otype);
}
// Get the list of properties as ParamSpecs
@@ -424,177 +395,29 @@ namespace GXml {
// Set it as the last possible action, so that invalid objects won't end up getting
stored // Changed our mind, for deserializing ObjectRefs
Serialization.deserialize_cache.set (oid, obj);
-
- if (type.is_a (typeof (Serializable))) {
- serializable = (Serializable)obj;
- }
-
- if (serializable != null) {
- specs = serializable.list_properties ();
- } else {
- specs = obj_class.list_properties ();
- }
-
- SerializationError err = null;
+ specs = obj_class.list_properties ();
foreach (Node child_node in obj_elem.child_nodes) {
if (child_node.node_name == "Property") {
Element prop_elem;
string pname;
Value val;
- //string ptype;
prop_elem = (Element)child_node;
pname = prop_elem.get_attribute ("pname");
- //ptype = prop_elem.get_attribute ("ptype"); // optional
-
// Check name and type for property
ParamSpec? spec = null;
- if (serializable != null) {
- spec = serializable.find_property (pname);
- } else {
- spec = obj_class.find_property (pname);
- }
+ spec = obj_class.find_property (pname);
if (spec == null) {
- err = new SerializationError.UNKNOWN_PROPERTY ("Deserializing
object of type '%s' claimed unknown property named '%s'\nXML [%s]", otype, pname, obj_elem.to_string ());
- break;
- }
-
- try {
- bool serialized = false;
-
- if (serializable != null) {
- serialized = serializable.deserialize_property
(spec.name, /* out val, */ spec, prop_elem); // TODO: consider rearranging these or the ones in Serializer to
match
- }
- if (!serialized) {
- Serialization.deserialize_property (spec, prop_elem,
out val);
- if (serializable != null) {
- serializable.set_property (spec, val);
- } else {
- obj.set_property (pname, val);
- }
- /* TODO: should we make a note that for implementing
{get,set}_property in
- the interface, they should specify override (in
Vala)? What about in C?
- Need to test which one gets called in which
situations (yeah, already read
- the tutorial) */
- }
- } catch (SerializationError.UNSUPPORTED_TYPE e) {
- err = new SerializationError.UNSUPPORTED_TYPE ("Cannot
deserialize object '%s's property '%s' with type '%s/%s': %s\nXML [%s]", otype, spec.name,
spec.value_type.name (), spec.value_type.to_string (), e.message, obj_elem.to_string ());
- break;
+ throw new SerializationError.UNKNOWN_PROPERTY ("Deserializing
property type '%s' for object type '%s' is unsupported-->XML: [%s]", pname, otype, obj_elem.to_string ());
+ return null;
}
+ Serialization.deserialize_property (spec, prop_elem, out val);
+ obj.set_property (pname, val);
}
}
-
- // TODO: should make a test to ensure this works
- if (err != null) {
- Serialization.deserialize_cache.remove (oid);
- throw err;
- }
-
return obj;
}
-
- /* TODO:
- * - can't seem to pass delegates on struct methods to another function :(
- * - no easy string_to_gvalue method in GValue :(
- */
-
- /**
- * Transforms a string into another type hosted by { link GLib.Value}.
- *
- * A utility function that handles converting a string
- * representation of a value into the type specified by the
- * supplied #GValue dest. A #GXmlSerializationError will be
- * set if the string cannot be parsed into the desired type.
- *
- * @param str the string to transform into the given #GValue object
- * @param dest the #GValue out parameter that will contain the parsed value from the string
- * @return `true` if parsing succeeded, otherwise `false`
- */
- /*
- * @todo: what do functions written in Vala return in C when
- * they throw an exception? NULL/0/FALSE?
- */
- public static bool string_to_gvalue (string str, ref GLib.Value dest) throws
SerializationError {
- Type t = dest.type ();
- GLib.Value dest2 = Value (t);
- bool ret = false;
-
- if (t == typeof (int64)) {
- int64 val;
- if (ret = int64.try_parse (str, out val)) {
- dest2.set_int64 (val);
- }
- } else if (t == typeof (int)) {
- int64 val;
- if (ret = int64.try_parse (str, out val)) {
- dest2.set_int ((int)val);
- }
- } else if (t == typeof (long)) {
- int64 val;
- if (ret = int64.try_parse (str, out val)) {
- dest2.set_long ((long)val);
- }
- } else if (t == typeof (uint)) {
- uint64 val;
- if (ret = uint64.try_parse (str, out val)) {
- dest2.set_uint ((uint)val);
- }
- } else if (t == typeof (ulong)) {
- uint64 val;
- if (ret = uint64.try_parse (str, out val)) {
- dest2.set_ulong ((ulong)val);
- }
- } else if ((int)t == 20) { // gboolean
- bool val = (str == "TRUE");
- dest2.set_boolean (val); // TODO: huh, investigate why the type is gboolean
and not bool coming out but is going in
- ret = true;
- } else if (t == typeof (bool)) {
- bool val;
- if (ret = bool.try_parse (str, out val)) {
- dest2.set_boolean (val);
- }
- } else if (t == typeof (float)) {
- double val;
- if (ret = double.try_parse (str, out val)) {
- dest2.set_float ((float)val);
- }
- } else if (t == typeof (double)) {
- double val;
- if (ret = double.try_parse (str, out val)) {
- dest2.set_double (val);
- }
- } else if (t == typeof (string)) {
- dest2.set_string (str);
- ret = true;
- } else if (t == typeof (char)) {
- int64 val;
- if (ret = int64.try_parse (str, out val)) {
- dest2.set_schar ((int8)val);
- }
- } else if (t == typeof (uchar)) {
- int64 val;
- if (ret = int64.try_parse (str, out val)) {
- dest2.set_uchar ((uchar)val);
- }
- } else if (t == Type.BOXED) {
- } else if (t.is_enum ()) {
- int64 val;
- if (ret = int64.try_parse (str, out val)) {
- dest2.set_enum ((int)val);
- }
- } else if (t.is_flags ()) {
- } else if (t.is_object ()) {
- } else {
- }
-
- if (ret == true) {
- dest = dest2;
- return true;
- } else {
- throw new SerializationError.UNSUPPORTED_TYPE ("%s/%s", t.name (),
t.to_string ());
- }
- }
}
}
diff --git a/test/SerializableTest.vala b/test/SerializableTest.vala
index 9377dee..34cb42c 100644
--- a/test/SerializableTest.vala
+++ b/test/SerializableTest.vala
@@ -25,7 +25,7 @@ using Gee;
Test overriding {set,get}_property
*/
-public class SerializableTomato : GLib.Object, GXml.Serializable {
+public class SerializableTomato : GXml.SerializableJson {
public int weight;
private int age { get; set; }
public int height { get; set; }
@@ -52,7 +52,7 @@ public class SerializableTomato : GLib.Object, GXml.Serializable {
}
}
-public class SerializableCapsicum : GLib.Object, GXml.Serializable {
+public class SerializableCapsicum : GXml.SerializableJson {
public int weight;
private int age { get; set; }
public int height { get; set; }
@@ -102,7 +102,6 @@ public class SerializableCapsicum : GLib.Object, GXml.Serializable {
return false;
}
public GXml.Node? serialize_property (string property_name, /*GLib.Value value,*/ GLib.ParamSpec
spec, GXml.Document doc) {
- GXml.Element c_prop;
GXml.Element rating;
switch (property_name) {
@@ -127,7 +126,7 @@ public class SerializableCapsicum : GLib.Object, GXml.Serializable {
}
-public class SerializableBanana : GLib.Object, GXml.Serializable {
+public class SerializableBanana : GXml.SerializableJson {
private int private_field;
public int public_field;
private int private_property { get; set; }
@@ -179,7 +178,7 @@ public class SerializableBanana : GLib.Object, GXml.Serializable {
return null;
}
- public void get_property (GLib.ParamSpec spec, ref GLib.Value str_value) {
+ public new void get_property (GLib.ParamSpec spec, ref GLib.Value str_value) {
Value value = Value (typeof (int));
switch (spec.name) {
@@ -204,7 +203,7 @@ public class SerializableBanana : GLib.Object, GXml.Serializable {
return;
}
- public void set_property (GLib.ParamSpec spec, GLib.Value value) {
+ public new void set_property (GLib.ParamSpec spec, GLib.Value value) {
switch (spec.name) {
case "private-field":
this.private_field = value.get_int ();
@@ -251,7 +250,7 @@ class SerializableTest : GXmlTest {
capsicum = new SerializableCapsicum (2, 3, 5, ratings);
try {
doc = Serialization.serialize_object (capsicum);
- } catch (GXml.SerializationError e) {
+ } catch (Error e) {
Test.message ("%s", e.message);
assert_not_reached ();
}
@@ -267,7 +266,7 @@ class SerializableTest : GXmlTest {
try {
capsicum_new =
(SerializableCapsicum)Serialization.deserialize_object (doc);
- } catch (GXml.SerializationError e) {
+ } catch (Error e) {
Test.message ("%s", e.message);
assert_not_reached ();
}
diff --git a/test/SerializationTest.vala b/test/SerializationTest.vala
index 00c00b3..f93bc03 100644
--- a/test/SerializationTest.vala
+++ b/test/SerializationTest.vala
@@ -322,6 +322,9 @@ class SerializationTest : GXmlTest {
} catch (GXml.SerializationError e) {
Test.message ("%s", e.message);
assert_not_reached ();
+ } catch (Error e) {
+ Test.message ("%s", e.message);
+ assert_not_reached ();
}
});
@@ -430,13 +433,13 @@ class SerializationTest : GXmlTest {
Serialization.clear_cache ();
simple_properties = new SimpleProperties (3, 4.2, "catfish", true, 0);
- obj = new ComplexDuplicateProperties (simple_properties);
try {
+ obj = new ComplexDuplicateProperties (simple_properties);
xml = Serialization.serialize_object (obj);
restored =
(ComplexDuplicateProperties)Serialization.deserialize_object (xml);
- } catch (GXml.SerializationError e) {
+ } catch (Error e) {
Test.message ("%s", e.message);
assert_not_reached ();
}
@@ -562,9 +565,9 @@ class SerializationTest : GXmlTest {
// weight expected to be 9 because age sets it *3
fruit = new Fruit ();
- fruit.set_all ("blue", 11, "fish", 3);
try {
+ fruit.set_all ("blue", 11, "fish", 3);
fruit_xml = Serialization.serialize_object (fruit);
regex = new Regex (expectation);
@@ -577,7 +580,7 @@ class SerializationTest : GXmlTest {
Test.message ("Regular expression [%s] for test failed: %s",
expectation, e.message);
assert_not_reached ();
- } catch (GXml.SerializationError e) {
+ } catch (Error e) {
Test.message ("%s", e.message);
assert_not_reached ();
}
@@ -600,7 +603,7 @@ class SerializationTest : GXmlTest {
Test.message ("Expected [\"%s\", %d, \"%s\", %d] but
found [%s]", "blue", 11, "fish", 3, fruit.to_string ());
assert_not_reached (); // Note that age sets weight
normally
}
- } catch (GXml.SerializationError e) {
+ } catch (Error e) {
Test.message ("%s", e.message);
assert_not_reached ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]