LibreOffice Module shell (master) 1
metainforeader.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_SHELL_INC_INTERNAL_METAINFOREADER_HXX
21#define INCLUDED_SHELL_INC_INTERNAL_METAINFOREADER_HXX
22
23#include "basereader.hxx"
24#include "types.hxx"
25#include <stack>
26#include "filepath.hxx"
27
28class ITag;
29class CKeywordsTag;
30class CSimpleTag;
31class CDummyTag;
32
34{
35public:
36 virtual ~CMetaInfoReader() override;
37
38 CMetaInfoReader(const Filepath_t& DocumentName);
39
41
47 bool hasTag(const std::wstring& TagName) const;
48
54 std::wstring getTagData(const std::wstring& TagName);
55
63 bool hasTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName);
64
72 std::wstring getTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName);
73
77
78protected: // protected because its only an implementation relevant class
88 virtual void start_element(const string_t& raw_name, const string_t& local_name,
89 const xml_tag_attribute_container_t& attributes) override;
90
98 virtual void end_element(const string_t& raw_name, const string_t& local_name) override;
99
105 virtual void characters(const string_t& character) override;
106
107protected:
115 ITag* chooseTagReader(const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes);
116
122 void saveTagContent(const std::wstring& tag_name);
123
124private:
126
127private:
128 std::stack<ITag*> m_TagBuilderStack;
129
130private:
134};
135
136#endif
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implements the ITag interface but does nothing (Null object pattern), may be used for tags we are not...
Definition: dummytag.hxx:34
Implements the ITag interface for building a keyword list.
Definition: keywordstag.hxx:32
std::wstring getTagData(const std::wstring &TagName)
Get a specific tag content, compound tags will be returned as comma separated list.
virtual void characters(const string_t &character) override
characters occurs when receiving characters
bool hasTag(const std::wstring &TagName) const
check if the Tag is in the target meta.xml file.
void saveTagContent(const std::wstring &tag_name)
save the received content into structure.
std::wstring getTagAttribute(const std::wstring &TagName, const std::wstring &AttributeName)
Get a specific attribute content.
std::stack< ITag * > m_TagBuilderStack
CMetaInfoReader(const Filepath_t &DocumentName)
constructor.
ITag * chooseTagReader(const std::wstring &tag_name, const XmlTagAttributes_t &XmlAttributes)
choose an appropriate tag reader to handle the tag.
virtual void start_element(const string_t &raw_name, const string_t &local_name, const xml_tag_attribute_container_t &attributes) override
start_element occurs when a tag is start.
CDummyTag * m_pDummy_Builder
XmlTags_t m_AllMetaInfo
virtual void end_element(const string_t &raw_name, const string_t &local_name) override
end_element occurs when a tag is closed
CSimpleTag * m_pSimple_Builder
bool hasTagAttribute(const std::wstring &TagName, const std::wstring &AttributeName)
check if the a tag has the specific attribute.
CKeywordsTag * m_pKeywords_Builder
virtual ~CMetaInfoReader() override
destructor.
LocaleSet_t getDefaultLocale()
Get the default language of the whole document.
Implements the ITag interface for building a general info that is not a compound tag.
Definition: simpletag.hxx:32
Interface for a xml tag character builder.
Definition: itag.hxx:32
Reference< XOutputStream > stream
std::string Filepath_t
Definition: filepath.hxx:22
std::string string_t
std::map< string_t, string_t > xml_tag_attribute_container_t
@ character
std::map< std::wstring, XmlTag_t > XmlTags_t
Definition: types.hxx:36
::std::pair< Language_t, Country_t > LocaleSet_t
Definition: types.hxx:48
std::map< std::wstring, std::wstring > XmlTagAttributes_t
Definition: types.hxx:34