diff options
-rw-r--r-- | src/lib/VSDXMetaData.cpp | 44 | ||||
-rw-r--r-- | src/lib/VSDXMetaData.h | 2 | ||||
-rw-r--r-- | src/lib/tokens.txt | 2 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/VSDXMetaData.cpp b/src/lib/VSDXMetaData.cpp index 3cbd61d..19c9709 100644 --- a/src/lib/VSDXMetaData.cpp +++ b/src/lib/VSDXMetaData.cpp @@ -37,6 +37,42 @@ void libvisio::VSDXMetaData::readTitle(xmlTextReaderPtr reader) m_metaData.insert("dc:title", title); } +void libvisio::VSDXMetaData::readCreated(xmlTextReaderPtr reader) +{ + int ret = 1; + int tokenId = XML_TOKEN_INVALID; + int tokenType = -1; + librevenge::RVNGString created; + do + { + ret = xmlTextReaderRead(reader); + tokenId = getElementToken(reader); + tokenType = xmlTextReaderNodeType(reader); + if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) + created.append((const char *)xmlTextReaderConstValue(reader)); + } + while ((XML_DCTERMS_CREATED != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + m_metaData.insert("meta:creation-date", created); +} + +void libvisio::VSDXMetaData::readModified(xmlTextReaderPtr reader) +{ + int ret = 1; + int tokenId = XML_TOKEN_INVALID; + int tokenType = -1; + librevenge::RVNGString modified; + do + { + ret = xmlTextReaderRead(reader); + tokenId = getElementToken(reader); + tokenType = xmlTextReaderNodeType(reader); + if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) + modified.append((const char *)xmlTextReaderConstValue(reader)); + } + while ((XML_DCTERMS_MODIFIED != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + m_metaData.insert("dc:date", modified); +} + void libvisio::VSDXMetaData::readCoreProperties(xmlTextReaderPtr reader) { int ret = 1; @@ -57,6 +93,14 @@ void libvisio::VSDXMetaData::readCoreProperties(xmlTextReaderPtr reader) if (tokenType == XML_READER_TYPE_ELEMENT) readTitle(reader); break; + case XML_DCTERMS_CREATED: + if (tokenType == XML_READER_TYPE_ELEMENT) + readCreated(reader); + break; + case XML_DCTERMS_MODIFIED: + if (tokenType == XML_READER_TYPE_ELEMENT) + readModified(reader); + break; default: break; } diff --git a/src/lib/VSDXMetaData.h b/src/lib/VSDXMetaData.h index 15d22c1..5ef98b8 100644 --- a/src/lib/VSDXMetaData.h +++ b/src/lib/VSDXMetaData.h @@ -31,6 +31,8 @@ private: int getElementToken(xmlTextReaderPtr reader); void readCoreProperties(xmlTextReaderPtr reader); void readTitle(xmlTextReaderPtr reader); + void readCreated(xmlTextReaderPtr reader); + void readModified(xmlTextReaderPtr reader); librevenge::RVNGPropertyList m_metaData; }; diff --git a/src/lib/tokens.txt b/src/lib/tokens.txt index 544bab4..5bf651d 100644 --- a/src/lib/tokens.txt +++ b/src/lib/tokens.txt @@ -228,3 +228,5 @@ XForm1D Y cp:coreProperties dc:title +dcterms:created +dcterms:modified |